klange changed the topic of #osdev to: Operating System Development || Don't ask to ask---just ask! || For 3+ LoC, use a pastebin (for example https://gist.github.com/) || Stats + Old logs: http://osdev-logs.qzx.com New Logs: https://libera.irclog.whitequark.org/osdev || Visit https://wiki.osdev.org and https://forum.osdev.org || Books: https://wiki.osdev.org/Books
X-Scale` has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale` is now known as X-Scale
\Test_User has joined #osdev
gog has joined #osdev
<zid> morning gog
<gog> mew
* moon-child pets god
* gog prrs
<zid> gog is here too moon-child
SpikeHeron has joined #osdev
* geist pets gog
<geist> Hi the gog
<zid> Hmm where was that nice serial port config doc I had
Teukka has quit [Read error: Connection reset by peer]
Teukka has joined #osdev
<zid> whatever I cobbled it together with shit docs, time to add a printf syscall via the serial port
<zid> so I can figure out why my damn game is crashing :P
gog has quit [Ping timeout: 246 seconds]
<geist> You got this
<geist> Just keep at it
<geist> We belive in you zid
<zid> I just need to spend more than 4 consecutive minutes on it
<zid> youtube is SO shiny
<sbalmos> definitely shiny. somehow ended up watching vids of what happens when you shoot the dog in Duck Hunt
PSedlacek has joined #osdev
<geist> Shiny
<zid> For security, my OS now requires there to be a gap between user and kernel memory a la current canonical addressing
<zid> (I'm too lazy to do bounds checking)
<moon-child> lol
qubasa has joined #osdev
<zid> Check for negative, strcpy forwards, if you hit the 48bit limit that's not my fault and your process crashes
<zid> ez
<zid> my syscall stack has some issues though that -OOH YOUTUBE
<moon-child> what if I forget to check for a null array and I accidentally have a negative index
<zid> why would you walk a string backwards
<moon-child> I'm not walking it backwards. Someone hands me an index in a signed integer, which I expect to be positive, but which is actually negative
<zid> why are you letting people give you offsets
<zid> that sounds dangerous
<moon-child> why are you letting users run apps
<moon-child> that sounds dangerous
<\Test_User> use an unsigned integer then?
<zid> good point
<moon-child> put everything in kernelspace
<zid> unsigned doesn't help
<\Test_User> it guarantees no negative
<moon-child> yeah, can still underflow
<zid> it doesn't when you add it
<\Test_User> simply check for a positive range check
<moon-child> x-y, kaboom
<zid> you know, like you might, with an offset
<moon-child> \Test_User: if you can have range checks, then you might as well have bounds checks
<moon-child> but we're lazy, remember?
<zid> puts(const char *s){ if((s64)s < 0) return; while(*s) putchar(s++); }
<\Test_User> if you know the size of the array, and it's unsigned, you can simply ensure it's within range and not need a second check
<zid> I figure that's secure as long as non-canonical addresses exist
<\Test_User> the bounds check is in the fact of the array existing
<zid> "The solution to no bounds checks is to add bounds checks"
<moon-child> ^
<zid> I'm using the cpu to do the right-hand-side bounds check
<\Test_User> yes, my point is you can do both in one rather than two seperate
<zid> because you can't offset it past any gaps because it's a byte-walk, I only need to check the left hand side
gorgonical has quit [Quit: Client closed]
Likorn has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
sonny has joined #osdev
sonny has quit [Quit: Client closed]
Burgundy has joined #osdev
PSedlacek has quit [Quit: Connection closed for inactivity]
sonny has joined #osdev
<zid> (T/N: A 'score' is a piece of paper filled with tadpoles.)
sonny has quit [Quit: Client closed]
Burgundy has quit [Ping timeout: 276 seconds]
user has joined #osdev
<user> How do you go about detecting malware on your Linux machine besides network analysis?
Oshawott has joined #osdev
archenoth has quit [Ping timeout: 272 seconds]
<moon-child> very carefully
<moon-child> do you have reason to suspect that your machine is infected with malware?
<zid> Fill the ram with known good values and see if you have less ram than you thought obviously
<zid> I recommend 7s
<user> moon-child: I don't have a reason to suspect but I install and run shitload of packages from npm, cargo, pip, etc.
<psykose> there are av scanners for linux... if you trust the av scanners :p
Likorn has quit [Quit: WeeChat 3.4.1]
<zid> That's why you should fill the ram with 7s, it can't be subtly changing the results of the measuring tools if it runs out of places to hide all the code that does that
_xor has quit [Quit: bbiab]
user has quit [Quit: WeeChat 3.5]
archenoth has joined #osdev
Oshawott has quit [Ping timeout: 255 seconds]
Oshawott has joined #osdev
archenoth has quit [Ping timeout: 246 seconds]
bauen1 has quit [Ping timeout: 244 seconds]
Oshawott has quit [Ping timeout: 246 seconds]
bauen1 has joined #osdev
zaquest has quit [Remote host closed the connection]
zaquest has joined #osdev
nyah has joined #osdev
pretty_dumm_guy has joined #osdev
gog has joined #osdev
bauen1 has quit [Ping timeout: 240 seconds]
bauen1 has joined #osdev
Jari-- has joined #osdev
<Jari--> Hi all developers! I have been using Bochs on Windows, but on Ubuntu it appears to be put on some unknown location. Wondering where it is.
<Jari--> bochs-x does not install any special binary
<Jari--> looking for Bochs GUI that works on Ubuntu
<klange> Did you install `bochs`?
<klange> Or just `bochs-x`? You may have the UI plugin and not the actual application.
<Jari--> klange: installed both like Google told me to
<Jari--> and its not at /usr/local/bin /usr/share/bochs
<klange> of course not
<klange> it's in /usr/bin/bochs
<Jari--> klange: I mean the GUI binary executable
<klange> That is the GUI binary.
<Jari--> github has more fresh stuff, so looking there for a GUI for the Bochs
<klange> Are you looking for a GUI _configuration tool_?
<Jari--> klange: yeah producing the configuration I can start up
<klange> You don't do that in a GUI normally. I guess the Windows version has that out of necessity.
<klange> Maybe the wx frontend has a GUI config tool.
<Jari--> klange: I have bochs-bin and bochs... both same executables
<Jari--> bochs[tab]
<klange> The UI frontends are not separate executables.
<klange> They are plugins.
<Jari--> ohh
<Jari--> 386 kernels might be more stable on an ISA virtualized environment
<Jari--> also known as DOS kernels
<klange> The manual suggests the wx UI frontend _does_ have a config tool.
<klange> Though I'm not sure how to get it without writing a config file that specifies it (`config_interface: wx`)
<klange> ToaruOS 2.1 runs in Bochs, though it takes ages to boot, the clock doesn't run right, and I think the Bochs BIOS doesn't support the extended keyboard reads my loader tries to do :)
<mrvn> klange: in bochs you can set the IPS
<mrvn> instructions per second
<klange> I am well aware of bochs' options.
<mrvn> and bochs being slow is a feature. how else are you going to play your old games that assume a 16MHz cpu?
<klange> bochs lacks a consistent timestamp counter, so to fix the clock in this kernel I would need to step down to maximum consistent clock rate, but then the boot times would be even longer.
GeDaMo has joined #osdev
<klange> The trouble is really that bochs' 64-bit emulation is particularly slow, so even if you ask for 20M IPS on a system that can do that in 32-bit mode, you're lucky to get 40K.
<mrvn> Does bochs do dynamic translations for 64bit?
<klange> As far as I am aware, bochs does not do dynamic translation _at all_?
<mrvn> thought so.
<mrvn> anyone know how fast qemu is without kvm?
<klange> tcg can be very good
<mrvn> without that too
<mrvn> I have to confess I've never benchmarked qemu, just wondering how it compares
<klange> I don't think you can turn off tcg any more.
<klange> You're either virtualized with KVM/HVF/whatever, or you're using TCG.
<j`ey> what else is there?
<klange> QEMU did, at one point long before TCG, operate like Bochs.
<j`ey> which is just emulating an opcode at a time?
<j`ey> *interpreting
<klange> Yes, good ol' traditional straight-forward emulation.
<mrvn> why has nobody turned qemu into a cross-compiler?
<klange> Because the output of TCG is not really suitable for static usage.
Jari-- has quit [Ping timeout: 260 seconds]
<klange> (fun fact is tcg started as a C compiler backend)
<mrvn> "Live life like you will live forever. You will only be wronf once."
Burgundy has joined #osdev
Jari-- has joined #osdev
<kingoffrance> there was formerly "kqemu" which IIRC used a "kernel module" (or windows driver). dont recall if guests needed special drivers or whatnot.
bliminse has quit [Quit: leaving]
<kingoffrance> s/special drivers/a special kernel/
<Mutabah> I think that became libvirtd
<klange> kqemu is a pre-VT approach
<klange> with some help from the host kernel, just run guest code directly and handle faults specially
<Jari--> "Rent the world's 30th-fastest, 30,472-core supercomputer for $1,279 per hour. Cycle Computing, a high-performance computing vendor, has successfully bonded 3,809 eight-core Amazon AWS Elastic Compute 2 instances together to create a supercomputer cluster of 30,472 processor cores with 27TB of memory and 2PB of storage.20 Sept 2011"
<Jari--> This would be nice for databases.
bliminse has joined #osdev
srjek has joined #osdev
terminalpusher has joined #osdev
<mrvn> And why would I rent that from them instead of just renting my own AWS systems?
<mrvn> Jari--: you realize that 2PB of storage is just 0.5TB per system, right? That's a jobe.
<mrvn> joke
<mrvn> Under 1GB memory per core isn't going to WOW your DB eigther
<Jari--> mrvn: maybe I should buy the Intel Platinium processor, build a computer
<mrvn> build a nice 512GB ram server
<mrvn> duplicate 3808 times and you have 2PB memory.
Jari-- has quit [Ping timeout: 246 seconds]
bauen1 has quit [Ping timeout: 272 seconds]
bauen1 has joined #osdev
sortie has quit [Ping timeout: 258 seconds]
sortie has joined #osdev
pretty_dumm_guy has quit [Quit: WeeChat 3.5]
eroux has joined #osdev
eroux has quit [Quit: Textual IRC Client: www.textualapp.com]
ephemer0l has quit [Ping timeout: 276 seconds]
sortie has quit [Ping timeout: 246 seconds]
eroux has joined #osdev
sortie has joined #osdev
blockhead has quit []
the_lanetly_052_ has joined #osdev
the_lanetly_052 has quit [Ping timeout: 276 seconds]
bauen1 has quit [Ping timeout: 258 seconds]
bauen1 has joined #osdev
heat has joined #osdev
bauen1 has quit [Ping timeout: 246 seconds]
<heat> sup noobs
<sbalmos> I'm not even at noob level yet. still stuck in the wistful dreaming stage.
<heat> something interesting I found out about the other day: macOS can ask you for permission when programs are accessing certain directories
<jimbzy> I'm the noobiest noob to walk out of Noobville since Nooby McNoob back in the 1980's.
<heat> i'm very confused since that makes no sense per POSIX (tm)
FatAlbert has joined #osdev
<FatAlbert> GeDaMo: hey hey hey
<bslsk05> ​'Freewill' by Rush - Topic (00:05:22)
<FatAlbert> im on it
<j`ey> heat: really, ive never seen it ask!
<heat> j`ey, maybe it's the work laptop?
<FatAlbert> a symbol table in compiler context is implemented as a hash table internally ?
<heat> but it seems macOS-ish enough that it's part of the base system
<\Test_User> you expect apple to follow posix in everything?
<heat> i just went into iTerm and started ls'ing home sub-directories (downloads, etc)
<FatAlbert> heat: hi
<FatAlbert> i see you new here
<heat> macOS was at one point SUS certified
<j`ey> heat: interesting
<FatAlbert> guys i have a problem
<FatAlbert> common
<FatAlbert> a symbol table in compiler context is implemented as a hash table internally ?
<heat> j`ey, btw it turns out my macbook isn't arm64 bcuz IT
<sbalmos> heat: what about POSIX ACLs?
<heat> the thing i'm working on supports arm64
<heat> sbalmos, what about them?
<heat> FatAlbert, yes I believe so
<j`ey> heat: lol.. we had to have a trial as well, to sort out arm64 issues :P
<sbalmos> heat: you were saying that asking for permission makes no sense per POSIX
<heat> sbalmos, I get a UI prompt
<sbalmos> oh cute
<heat> unless the file server (is that a thing on macOS? I believe so?) is making it prompt me
<sbalmos> maybe
<heat> j`ey, ironic... le arm sorting out arm64 issues :D
<FatAlbert> heat: so when i see the word symbol table in computer science context it's actually means hash table or at least one of hash table implementations
<sbalmos> heat: would be neater if it was text-based "Access requires elevated privileges, please enter your sudo password:"
<j`ey> heat: all the arm64 machines that people use arent usually 'IT' machines, but these macs were
<heat> FatAlbert, idk. computer science context is computer science context
<heat> the logic way to implement one of those is with a dictionary. unordered dictionaries are usually hash tables
<heat> sbalmos, that would defo break POSIX
<heat> I'm not saying this behavior is breaking POSIX, but it's definitely mysterious to me
<sbalmos> heat: how about a filesystem that virtually calculated and followed POSIX u,g,o triples based on your effective ACLs
<FatAlbert> Thanks
<FatAlbert> god
<FatAlbert> i hope one day i will be helpful in #osdev
<FatAlbert> although i don't have much time to practice, i have faith
<mrvn> But you need a unordered_multimap
<heat> sbalmos, wdym?
<mrvn> FatAlbert: You normaly don't have that many symbols that it matters what you use. unless you have c++
<heat> right. I was going to say you can't use a symbol table in a compiler
<heat> I think you always end up walking AST
<heat> defo for a linker though
<sbalmos> heat: a filesystem that at its heart was ACL-based. but for POSIX compatibility, had a layer that, as you were traversing and listing (in text format or otherwise) was dynamically calculating the user,group,other rwx triples based on the effective ACLs of the current user. So those ugo+rwx triples might change per-user, or even if you were traversing first as a normal user vs elevated (sudo-like)
<sbalmos> privilieges
<mrvn> heat: why would you walk the ast?
<heat> sbalmos, how can ugo change per-user?
<mrvn> or rather isn't the ast a symbol table on the top level?
<heat> ugo refers to the owner of the file, not the stat() caller
<heat> mrvn: I guess symbol lookup is complicated?
<heat> like, imagine C++ name resolution rules
<j`ey> heat: i think that was kinda the point? that you could do it based on the stat caller?
the_lanetly_052_ has quit [Ping timeout: 244 seconds]
<sbalmos> j`ey: that's more my point, yes
<mrvn> heat: posix says nothing about what the FS does internally
<heat> but then you're breaking POSIX
<sbalmos> eh screw it. POSIX is meant to be broken nowadays. :D
<mrvn> On AmigaOS the kernel asks you to insert the relevant floppy disk when you try to access it. Totaly transparent to the app or POSIX.
<heat> having ACLs only and calculating the mask based on the ACLs makes some sense. having it change doesn't. you're providing POSIX compatibility and then breaking POSIX
<mrvn> heat: C++ name resolution is kind of screwy with the templates and overloads.
terminalpusher has quit [Remote host closed the connection]
<FatAlbert> mrvn: not really thanks to name mangling
<heat> name mangling isn't apart of this
<mrvn> FatAlbert: name mangling is after the compiler has done it's thing.
<mrvn> it's the result of the name lookup
<FatAlbert> im quiting
<FatAlbert> not really ...
<FatAlbert> but i have to go
<heat> mrvn, right. which is part of the reason why symbol tables are not used I believe (take this with a grain of salt, I may very well be wrong)
<FatAlbert> mrvn: im sure you are right
FatAlbert has quit [Quit: WeeChat 3.5]
<mrvn> heat: at least you need a map std::string -> std::some_container<ast thingy>
<mrvn> lots of possibilities for each name
<heat> hm right
<heat> maybe there is a table after all?
<heat> idk screw compilers
<mrvn> The hardest I find is that you have layers of symbols. Every { starts a new layer and every } has to remove it again. A list or stack really fits better than hashtbl alone.
<heat> chad x86 kernel written in assembly >>>>>>>>>>>>>>>> stupid compiler
<j`ey> you mispelt arm64
<heat> you mispelt java bytecode accelerated by jazelle
<j`ey> lol
<heat> hrrrrrrrrrrrrrmmmmmmmmmmm
<heat> what if we designed a CPU that just ran jvm bytecode?
<heat> the ultimate android CPU
<heat> (or Enterprise(tm)(c) CPU)
<bslsk05> ​en.wikipedia.org: Jazelle - Wikipedia
<heat> well yes, but only jazelle and more complete
<heat> your reset vector is literally JVM bytecode
<\Test_User> then I'd burn it
<mrvn> Worse, int foo(); int foo(int); void bar() { foo(); int foo; foo += 1; } In bar the first foo as to lookup all the possibilities for foo. But not when it's a variable instead of a function.
<mrvn> heat: yeo mean like ARM with the jvm extension?
<heat> ARM, with the JVM extension, but then without ARM
<heat> ARM + JVM - ARM = JVM
<heat> this sounds like the perfect new raspberry pi coprocessor
<mrvn> I never figured out if the RPi cores actually support jazelle
<heat> broadcom, email me
<GeDaMo> A Java non-virtual machine :P
<Andrew> Eww
<sbalmos> so, like the old native-LISP machines?
ephemer0l has joined #osdev
<Andrew> Lisp is better than Java IMO
<Andrew> \Test_User:
<\Test_User> might still burn those, having your CPU able to use a variety of languages is generally useful
<Andrew> \Test_User: Well, you can certainlly make C compilers out of Lisp
<Andrew> Lambda Calculus is turing complete
<jimbzy> You can also make C compilers out of C.
<Andrew> \Test_User: But Lisp is much saner than a native language than Java
<\Test_User> I wouldn't be able to sanely write C for that though
<Andrew> jimbzy: Of course
<Andrew> \Test_User: True, as in I can't sanely write Lisp on current hardware either ...
<jimbzy> I have no idea what's going on, btw. I'm just trying to participate.
<jimbzy> ;)
<\Test_User> true but you also can't sanely write java on current hardware :P
<jimbzy> I have been messing with programming for 20+ years and I have never once written a java program.
<\Test_User> read up a little and you'll see why java is here, I haven't either
<\Test_User> ...though I also haven't been programming for 20 years, mostly for lack of existing that long
<mrvn> I have, before it had const
<mrvn> aka final
* Andrew forces \Test_User to exist for the same length as Andrew themselves
<mrvn> And hey, if you get a null pointer exception just keep going, nothing to see.
<\Test_User> Andrew: you also haven't been existing for 20 years
<Andrew> \Test_User: I make you exist for shorter
<\Test_User> yes
<Andrew> ... Uh, what consequences would that have
<\Test_User> I'd be sent back in time to where I was a total noob in computers is likely
<Andrew> Hmm
<Andrew> That means you have a max computer experience of six years
<jimbzy> mrvn, It just never came up. I have nothing against the language, but it seems like I've always found a better solution.
<\Test_User> Andrew: sounds about right
<Andrew> \Test_User: Do you like the Dangerous Bend sign?
<\Test_User> "the what"
<Andrew> Uh, wrong channel
<mrvn> jimbzy: When I learned it was lauded for not having operator overloading like c++ because that is way too confusing. So the graphics vector class had a method "add" instead. But you never knew if "add" was a + b or a += b. That was so much better. NOT
<mrvn> jimbzy: and microsofts java didn't show null pointer exceptions, just keept going silently. That really turned me against java.
<jimbzy> Ugh. That sounds terrible.
<mrvn> and horrible slow.
<mrvn> They must have caught the segfault signal and then told the kernel to execute the next opcode or something.
<sbalmos> MS J++ was the definition of an abomination
Jari-- has joined #osdev
bauen1 has joined #osdev
<geist> J++ I have not thought of this word in some time
the_lanetly_052 has joined #osdev
<sbalmos> geist: it is best forgotten
gog has quit [Ping timeout: 246 seconds]
ripmalware has quit [Remote host closed the connection]
blockhead has joined #osdev
the_lanetly_052 has quit [Ping timeout: 255 seconds]
the_lanetly_052 has joined #osdev
Likorn has joined #osdev
mahmutov has joined #osdev
bauen1 has quit [Ping timeout: 272 seconds]
bauen1 has joined #osdev
heat has quit [Ping timeout: 258 seconds]
<mrvn> Who is with me on patching libstdc++ to change <bits/stdc++.h> to a random name on every build? Make every competitive coding crap site on the internet fail all their code on the next update.
Matt|home has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
sonny has joined #osdev
the_lanetly_052 has quit [Ping timeout: 244 seconds]
dude12312414 has joined #osdev
sonny has quit [Quit: Client closed]
sonny has joined #osdev
eroux has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sonny has quit [Quit: Client closed]
<moon-child> I have no horse in the c++ race, but I fully support this
sonny has joined #osdev
sonny has left #osdev [#osdev]
<zid> I have sudden onset acute narcolepsy for some reason
<zid> slept for 18 hours and wanna go to bed, but I figured out how exactly I broke my syscall at least after an entire 2 minutes of work, misaligned the stack
<GeDaMo> Sleep debugging :|
<mjg_> i recently dehydrated myself, only realized it after getting a headache
<mjg_> 2 days of sleeping 15 hours
<bauen1> mrvn: may i suggest randomly removing lines from the headers ? there's a good chance you'll improve the library
ripmalware has joined #osdev
<mrvn> bauen1: I have a program for that somewhere for gcc ICE. Takes a testcase and randomly deletes lines to find a minimal test case that still causes ICE.
<zid> I'm now doing my third printf implementation in this project.. *copy paste*
<mrvn> with "uint64_t / 10" for the decimal numbers or an optimized divu10?
<moon-child> sounds like creduce
<moon-child> zid: how many line editors have you written though?
<zid> none, thank god
<moon-child> I've had to write ~3 now, from scratch each time
<zid> had to?
<moon-child> well
<moon-child> you gotta edit lines
<moon-child> I mean stuff like readline, not ed
<mjg_> i heard a long time ago that writing a text editor is the standard programmer's rite of passage
<zid> ah
<mjg_> yet i don't know anyone who did this
<zid> line editor
<zid> right
<Griwes> Would you say you know Mr PonyOS?
<zid> copy paste failed, segfault :(
<zid> I blame moon-child
<zid> oh I figured it out, the 'paste' in vmware is cutting off eventually
<zid> so I lost half the body of a function
<mjg_> lol
pretty_dumm_guy has joined #osdev
GeDaMo has quit [Quit: There is as yet insufficient data for a meaningful answer.]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
mahmutov has quit [Ping timeout: 246 seconds]
_73 has quit [Remote host closed the connection]
vdamewood has joined #osdev
theruran has quit [Quit: Connection closed for inactivity]
dude12312414 has quit [Remote host closed the connection]
<zid> moon-child: What do you think I should do with my syscall + clobbers btw, clobber a bunch of shit and tell the constraints, or push/pop everything except rcx/r11?
<zid> I should check what sysv says about argument registers that aren't actually used, like rsi in a func with 1 arg, because I honestly don't remember
<moon-child> callee is always allowed to clobber them
<moon-child> iirc glibc will do a blanket memory clobber, instead of specifying exactly what can be overwritten for every syscall
<zid> yea I will do too, for memory, now I've researched that gcc is VERY precise about what *s means :p
<zid> and that "m" (s) doesn't imply "m" (*s) etc
<zid> I was just thinking how much I gave about about over-clobbering or over-pushpopping regs
<zid> need to figure out how to responds to scratch regs + inlining though still
<zid> i.e f(void) { syscall(); ... }; and it inlines the syscall, does it still consider r8 to be trash, as if it hadn't
<mjg_> clobber everything and consider relaxing only after you no longer have weird crashes
<zid> kek
<moon-child> syscall is expensive anyway. Maybe not worth doing anything fancy
<zid> plus doing something weird like preserving rsi across function calls that don't use rsi probably just bloats the binary more than it helps in perf
<zid> if the optimizer wants to it can just do that bit in userspace
<zid> if it deems it important
<mjg_> cmon man where is your spirit
<mrvn> zid: Your asm("SYSCALL" ....) should mark r8 as clobbered as well as the argument and return registers.
<mrvn> Easier to just have a little syscall.S file that loads the syscall number into r8 and SYSCALLs and declare that as normal function in syscall.h. No inline and the compiler does everything right.
<moon-child> ^
<zid> I ate it
<mrvn> If it inlines your "syscall()" macro it might also reorder the registers and you don't have the argument in the argument registers anymore.
<moon-child> ^
<mrvn> ==> the asm("SYSCALL" ...) has to list all possible input and output registers.
<mrvn> anyone use fpu or simd registers in syscalls?
<moon-child> I hope not
<zid> I am now more powerful than the power of a man with two spirits, but half that
<zid> I should eat other people's
<moon-child> what?
<zid> If you eat your own it turns out you don't turn into Jet Li's the one
sonny has joined #osdev
Likorn has quit [Quit: WeeChat 3.4.1]
Likorn has joined #osdev
<mrvn> Wow, gcc has learned to divide by 10: https://godbolt.org/z/xnMdKrehE
<bslsk05> ​godbolt.org: Compiler Explorer
<mrvn> clang still makes a function call :(
<moon-child> recently I found out gcc will actually divide by a constant if you mark a function as cold
<Ermine> Compilers try hard to not emit div instuction?
<zid> mul is significantly faster
<zid> so you can do tricks to implement * 1/x instead
<moon-child> indeed
<zid> usually ends up looking like multiplying by a huge constant combined with a shift
<moon-child> they don't do it for floating-point though. It's possible, but I guess no one bothered to figure out the math to get the last few digits right
<mrvn> moon-child: even for constants with nice 1/x multiply?
<moon-child> I think they do it for that
<moon-child> but not when 1/x isn't exactly representable
<zid> like, if you wanna divide by 32 that's the same as figuring out what you'd get if you multiplied by 1/32, and to divide a number by 32 you can see how many times it goes into 256 and shift it down, using power of two examples
<mrvn> zid: even better is mul r0:r1, r2 and the shift is 32bit so it just takes r0.
pretty_dumm_guy has quit [Ping timeout: 260 seconds]
<zid> and n*327823943043 and checking how many times it overflows is a very strong approximation
<mrvn> moon-child: there are a ton of numbers with a 1/x costant that works.
<zid> which you can get to less than 1 integer of error by doing it in a bigger type
<zid> qed
<moon-child> mrvn: only powers of two
<mrvn> gcc used to do it a lot more but DIV has become too fast for anything too fancy.
<moon-child> again, talking about floating-point
<moon-child> not ints
<zid> we have hard accelerated 1/x anyway for floats
<zid> hardwre*
<mrvn> moon-child: no. (x * -3689348814741910323) >> 3 is x / 10 for example.
<moon-child> again, talking about floating-point
<mrvn> For floats just multiply by 1/x. The compiler can't do it because it's imprecise but 99% of the time you don't care.
<moon-child> you're missing my point
<zid> he never once cared
<moon-child> tru
<zid> he's basically an alice bot, if you start talking about something with someone, he will respond with similar things
<mrvn> moon-child: I don't think it is possible for float/double to do y * (1/x) and be exactly bit identical to y / x
<moon-child> mrvn: x/2.0 is exactly the same as x*0.5. x/3.0 is not exactly the same as x*0.3333333333333333. But if the compiler did some extra work at compile time, it would be able to do x/3.0 faster than a floating-point divide
<moon-child> obviously, just multiplying by the reciprocal isn't enough
<mrvn> moon-child: excempting the obvioud powers of 2. Those can do (long)y - 1
<zid> is it exactly the same even in funny rounding modes?
<mrvn> moon-child: I don't believe there is a 0.33333333333 double that will do exactly x/3.
<moon-child> yes. You cannot just do a multiply. A single multiply is not sufficient
<mrvn> You might be able to do a float x/3 by using doubles.
* moon-child gives up
<moon-child> zid: afaik yes. Rounding mode only affects what happens when you land on something that's not exactly representable as a floating-point number
<zid> everything then? :P
<mrvn> moon-child: do you have an example how it would look like for x/3 for doubles?
<zid> I consider all floating point values to be intervals
<moon-child> I consider floating point values to be exact, but equipped with inexact operations
<zid> The interval math works, you can just do the 4 way multiply to figure out your bounds
<zid> so 1 to 2 * 4 to 5 = 4*1 to 2*5 = 4 to 10
<zid> or whatever
<zid> What do they call them, FPUs? QPUs?
<zid> quantum precision units
<moon-child> I mean interval math is cool
<mrvn> zid: a / b is harder
<moon-child> and should probably be used more
<zid> I've seen bug reports on x86 because of that, codegen changing and an operation variously going through the fpu or not causing the 80bit format to lower the bounds in the middle of the calc
<moon-child> but I don't think it's appropriate to say that floating-point numbers themselves are intervals, because the error compounds
<zid> so it ends up with differences int he final bit position in the final float
<mrvn> zid: doesn't gcc have a switch for that, rouding everything down to 64bit every step?
<moon-child> ie you can describe the interval that lands on a given floating-point number following a single operation (+/- 1/2 ulp, pretty much), but following n operations, you need numerical analysis to know that, and you need to know what the operations actually were and what the valid range of input values was
<zid> ULP, thank you
<moon-child> the interval isn't part of the value
<zid> I knew it was some TLA
<mrvn> moon-child: you just have to track the borders of the intervals instead of a single float
heat has joined #osdev
<moon-child> yes, you can do that
<moon-child> which is why I say interval math is cool
<zid> hi heat, we're talking about ULPs you might wanna leave
<moon-child> but a floating-point number isn't itself an interval
<heat> youre not my boss
<zid> I didn't put up the caution tape in time
<zid> ofc not, who'd refer to their lover as 'boss' that's weird
<mrvn> it kind of is. It just does't give you the right interval for a+b that covers the whole error range
<heat> oooooooooh kinky
<moon-child> right, so it's not an interval. You can compute an interval. But it's not an interval
<moon-child> it's a floating-point number :P
<zid> It's a pascal string
<zid> someone needs to track the interval in the 4 bytes before the float :P
sonny has quit [Remote host closed the connection]
<mrvn> moon-child: YOur pdf has nothing for doing x/3. That's just the iterative Newton-Raphson method for a generic x/y.
zid` has joined #osdev
<heat> you need jesus in your lives
<zid`> just because my internet blipped? harsh
<mrvn> zid: you can track the error in a float preceeding the double. :)
<moon-child> mrvn: right. Compiler can emit something like that, but with precomputed 1/y. So it's just a couple of fmas, which will be faster than a div
ThinkT510 has quit [Ping timeout: 240 seconds]
zid has quit [Read error: Connection reset by peer]
<heat> now i'm getting tiny bits of macbook keyboard muscle memory and it's messing with me
<zid`> That's why you should refuse to use anything that isn't full ISO
<heat> alt is not command :)
<mrvn> moon-child: I believe the div is faster than that method now with all the required steps. You would only win if you 'y' is some number where you can eliminate some iterations.
<moon-child> mrvn: fma has 10x throughput of div
<mrvn> Does ARM has fma?
<moon-child> probably
<moon-child> even with dependencies, I'm pretty sure you win. And it's definitely a win if there's something else you can do in the mean time
<mrvn> moon-child: You need 8 fma and a bunch of adds and subs.
<mrvn> or something
<moon-child> that's with a low-precision reciprocal
<moon-child> can do better with a high-precision reciprocal
<mrvn> or if 'y' has a nice reciprocal
ThinkT510 has joined #osdev
<mrvn> moon-child: if you can come up with an algorithm for detecting literals with a high-precision reciprocal that needs a minimal number of iterations then I'm sure gcc/clang will love it.
<heat> ok it checks out, my macOS prompts me for perms when apps access certain directories (like ~/Downloads/) for the first time
<heat> i wonder how this fits in the fs stack
<moon-child> mrvn: what do you mean, literals with a high-precision reciprocal?
<mrvn> heat: it checks the security context of the calling process and if it lacks the "has-asked-for-downloads-dir" capability then it asks.
<moon-child> either you throw out a bit from the reciprocal, or you don't. That maybe causes you to throw out another bit from the result of the initial guess
<mrvn> moon-child: like for example 7 might have a reciprocal that only need 2 iterations of the process.
<heat> mrvn, yes but this is done inside open(2) I assume. or at least there's something other catching the exception/perms fail that prompts someone
<heat> i hope there's no file system server messing with UI for this
<mrvn> heat: I would think this is done inside the FS driver
<mrvn> vfs
<heat> right. which is disgusting
<moon-child> the reason you need so many iterations on the itanium is that its reciprocal instruction is giving you (iirc) ~30 good bits and ~20 garbage bits. But you can precalculate ~49 good bits and maybe ~1 garbage bit
<moon-child> that's what's going to make the main difference
<mrvn> heat: only problem I have with it is how the vfs driver has permissions to access my display. How does it know the app doing the FS access is on that display at all? What if you run something via ssh?
<heat> also, boundaries
<heat> your vfs driver shouldn't touch UI. period.
<heat> which makes me believe/hope another system is at play here
<mrvn> heat: I would assume the UI is running some "ask for vfs permissions" server that connects to the vfs layer.
<mrvn> Think dbus :(
<heat> that's just lipstick on a pig :)
<heat> geist: have you looked into this before?
<mrvn> How does this work on Android? You get asked the first time an app wants to use bluetooth and such too.
<mrvn> Maybe open() returns an ENEEDPERM and then the app asks some system service to pop up the dialog?
<heat> android apps prompt you explicitly through the API
<heat> this perm stuff I was talking about triggers on an `ls Downloads/` (and it says the one that's asking for perms is iTerm, the terminal emulator, and not /bin/ls)
<mrvn> heat: probably the owner of the process group
<heat> also triggered for virtualbox's file explorer a few minutes ago
<heat> mrvn: right. this codepath doesn't look too simple
Vercas has quit [Remote host closed the connection]
<heat> now that I think of it, does macOS have open(2)?
<mrvn> I have something like this with fuse. But I specifically start the fuse filesystem app on my display and then it has an UI to interact with me.
<mrvn> heat: It's a unix, isn't it?
<heat> yes, but I mean as a syscall
<heat> since it was based in freebsd
<heat> s/in/on/
<mrvn> hard not to since everything is a file
<heat> otoh, microkernel-ish thing I guess
<heat> also weird fact: you can cat /dev (but *only* /dev) and get the directory entries
<mrvn> when the window pops up can you find out which process it belongs to?
<heat> yeah, it tells you "$PROCESS_NAME is asking for perms to access ..."
<mrvn> COW filesystems don't have cat-able dirs anymore but in-memory filesystems might.
<mrvn> Not the process asking for permissions, the process owning the popup
<heat> no clue
<heat> there might be a way, but i'm a macOS noob
<mrvn> If there is some vfs-ask-permsd running on your UI it might be a pretty clean setup.
Vercas has joined #osdev
<heat> if you call that clean :D
<zid`> hmm, I wonder why only *some* stuff is crashing with illegal ops, ACID2 works, zelda does not
<zid`> I've never had zelda not work in my emu I use it as a test case *ponders*
<mrvn> No worse than the IP stack talking to the arpd
wand has quit [Ping timeout: 240 seconds]
<heat> the IP stack doesn't talk to arpd in a traditional design :)
wand has joined #osdev
<heat> still, it'd be better. ip stack and arpd are both networking stuff, one directly depends on the other
jjuran has quit [Ping timeout: 276 seconds]
<mrvn> try ruinning arpd from NFS and having it try to swap in a page
<mjg_> lol
jjuran has joined #osdev
Burgundy has quit [Ping timeout: 240 seconds]