channel logs for 2004 - 2010 are archived at http://tunes.org/~nef/logs/old/ ·· can't be searched
#osdev2 = #osdev @ Libera from 23may2021 to present
#osdev @ OPN/FreeNode from 3apr2001 to 23may2021
all other channels are on OPN/FreeNode from 2004 to present
http://bespin.org/~qz/search/?view=1&c=osdev2&y=22&m=6&d=8
00:20:00 <zid> morning gog
00:20:00 <gog> mew
00:20:00 * moon-child pets god
00:20:00 * gog prrs
00:20:00 <zid> gog is here too moon-child
00:52:00 * geist pets gog
00:53:00 <geist> Hi the gog
00:56:00 <zid> Hmm where was that nice serial port config doc I had
01:09:00 <zid> whatever I cobbled it together with shit docs, time to add a printf syscall via the serial port
01:09:00 <zid> so I can figure out why my damn game is crashing :P
01:56:00 <geist> You got this
01:57:00 <geist> Just keep at it
01:57:00 <geist> We belive in you zid
02:04:00 <zid> I just need to spend more than 4 consecutive minutes on it
02:04:00 <zid> youtube is SO shiny
02:05:00 <sbalmos> definitely shiny. somehow ended up watching vids of what happens when you shoot the dog in Duck Hunt
02:27:00 <geist> Shiny
02:29:00 <zid> For security, my OS now requires there to be a gap between user and kernel memory a la current canonical addressing
02:29:00 <zid> (I'm too lazy to do bounds checking)
02:33:00 <moon-child> lol
02:46:00 <zid> Check for negative, strcpy forwards, if you hit the 48bit limit that's not my fault and your process crashes
02:46:00 <zid> ez
02:51:00 <zid> my syscall stack has some issues though that -OOH YOUTUBE
02:52:00 <moon-child> what if I forget to check for a null array and I accidentally have a negative index
02:53:00 <zid> why would you walk a string backwards
02:54:00 <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
02:54:00 <zid> why are you letting people give you offsets
02:54:00 <zid> that sounds dangerous
02:54:00 <moon-child> why are you letting users run apps
02:54:00 <moon-child> that sounds dangerous
02:54:00 <\Test_User> use an unsigned integer then?
02:54:00 <zid> good point
02:54:00 <moon-child> put everything in kernelspace
02:55:00 <zid> unsigned doesn't help
02:55:00 <\Test_User> it guarantees no negative
02:55:00 <moon-child> yeah, can still underflow
02:55:00 <zid> it doesn't when you add it
02:55:00 <\Test_User> simply check for a positive range check
02:55:00 <moon-child> x-y, kaboom
02:55:00 <zid> you know, like you might, with an offset
02:55:00 <moon-child> \Test_User: if you can have range checks, then you might as well have bounds checks
02:55:00 <moon-child> but we're lazy, remember?
02:56:00 <zid> puts(const char *s){ if((s64)s < 0) return; while(*s) putchar(s++); }
02:56:00 <\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
02:56:00 <zid> I figure that's secure as long as non-canonical addresses exist
02:56:00 <\Test_User> the bounds check is in the fact of the array existing
02:56:00 <zid> "The solution to no bounds checks is to add bounds checks"
02:56:00 <moon-child> ^
02:56:00 <zid> I'm using the cpu to do the right-hand-side bounds check
02:57:00 <\Test_User> yes, my point is you can do both in one rather than two seperate
02:57:00 <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
05:03:00 <zid> (T/N: A 'score' is a piece of paper filled with tadpoles.)
05:17:00 <user> How do you go about detecting malware on your Linux machine besides network analysis?
05:21:00 <moon-child> very carefully
05:21:00 <moon-child> do you have reason to suspect that your machine is infected with malware?
05:22:00 <zid> Fill the ram with known good values and see if you have less ram than you thought obviously
05:23:00 <zid> I recommend 7s
05:24:00 <user> moon-child: I don't have a reason to suspect but I install and run shitload of packages from npm, cargo, pip, etc.
05:29:00 <psykose> there are av scanners for linux... if you trust the av scanners :p
05:31:00 <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
08:48:00 <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.
08:48:00 <Jari--> bochs-x does not install any special binary
08:48:00 <Jari--> looking for Bochs GUI that works on Ubuntu
08:49:00 <klange> Did you install `bochs`?
08:50:00 <klange> Or just `bochs-x`? You may have the UI plugin and not the actual application.
08:50:00 <Jari--> klange: installed both like Google told me to
08:51:00 <Jari--> and its not at /usr/local/bin /usr/share/bochs
08:51:00 <klange> of course not
08:51:00 <klange> it's in /usr/bin/bochs
08:51:00 <Jari--> klange: I mean the GUI binary executable
08:51:00 <klange> That is the GUI binary.
08:51:00 <Jari--> github has more fresh stuff, so looking there for a GUI for the Bochs
08:51:00 <klange> Are you looking for a GUI _configuration tool_?
08:52:00 <Jari--> klange: yeah producing the configuration I can start up
08:52:00 <klange> You don't do that in a GUI normally. I guess the Windows version has that out of necessity.
08:52:00 <klange> Maybe the wx frontend has a GUI config tool.
08:53:00 <Jari--> klange: I have bochs-bin and bochs... both same executables
08:53:00 <Jari--> bochs[tab]
08:53:00 <klange> The UI frontends are not separate executables.
08:53:00 <klange> They are plugins.
08:53:00 <Jari--> ohh
08:54:00 <Jari--> 386 kernels might be more stable on an ISA virtualized environment
08:54:00 <Jari--> also known as DOS kernels
08:56:00 <klange> The manual suggests the wx UI frontend _does_ have a config tool.
08:57:00 <klange> Though I'm not sure how to get it without writing a config file that specifies it (`config_interface: wx`)
09:04:00 <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 :)
09:06:00 <mrvn> klange: in bochs you can set the IPS
09:06:00 <mrvn> instructions per second
09:06:00 <klange> I am well aware of bochs' options.
09:06:00 <mrvn> and bochs being slow is a feature. how else are you going to play your old games that assume a 16MHz cpu?
09:07:00 <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.
09:09:00 <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.
09:09:00 <mrvn> Does bochs do dynamic translations for 64bit?
09:09:00 <klange> As far as I am aware, bochs does not do dynamic translation _at all_?
09:10:00 <mrvn> thought so.
09:10:00 <mrvn> anyone know how fast qemu is without kvm?
09:11:00 <klange> tcg can be very good
09:11:00 <mrvn> without that too
09:11:00 <mrvn> I have to confess I've never benchmarked qemu, just wondering how it compares
09:12:00 <klange> I don't think you can turn off tcg any more.
09:12:00 <klange> You're either virtualized with KVM/HVF/whatever, or you're using TCG.
09:12:00 <j`ey> what else is there?
09:13:00 <klange> QEMU did, at one point long before TCG, operate like Bochs.
09:13:00 <j`ey> which is just emulating an opcode at a time?
09:13:00 <j`ey> *interpreting
09:14:00 <klange> Yes, good ol' traditional straight-forward emulation.
09:16:00 <mrvn> why has nobody turned qemu into a cross-compiler?
09:16:00 <klange> Because the output of TCG is not really suitable for static usage.
09:19:00 <klange> (fun fact is tcg started as a C compiler backend)
09:19:00 <mrvn> "Live life like you will live forever. You will only be wronf once."
09:31:00 <kingoffrance> there was formerly "kqemu" which IIRC used a "kernel module" (or windows driver). dont recall if guests needed special drivers or whatnot.
09:37:00 <kingoffrance> s/special drivers/a special kernel/
09:38:00 <Mutabah> I think that became libvirtd
09:38:00 <klange> kqemu is a pre-VT approach
09:38:00 <klange> with some help from the host kernel, just run guest code directly and handle faults specially
09:43:00 <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"
09:43:00 <Jari--> This would be nice for databases.
10:43:00 <mrvn> And why would I rent that from them instead of just renting my own AWS systems?
10:45:00 <mrvn> Jari--: you realize that 2PB of storage is just 0.5TB per system, right? That's a jobe.
10:45:00 <mrvn> joke
10:46:00 <mrvn> Under 1GB memory per core isn't going to WOW your DB eigther
10:50:00 <Jari--> mrvn: maybe I should buy the Intel Platinium processor, build a computer
10:54:00 <mrvn> build a nice 512GB ram server
10:54:00 <mrvn> duplicate 3808 times and you have 2PB memory.
14:51:00 <heat> sup noobs
14:51:00 <sbalmos> I'm not even at noob level yet. still stuck in the wistful dreaming stage.
14:54:00 <heat> something interesting I found out about the other day: macOS can ask you for permission when programs are accessing certain directories
14:54:00 <jimbzy> I'm the noobiest noob to walk out of Noobville since Nooby McNoob back in the 1980's.
14:54:00 <heat> i'm very confused since that makes no sense per POSIX (tm)
14:54:00 <FatAlbert> GeDaMo: hey hey hey
14:54:00 <GeDaMo> https://www.youtube.com/watch?v=V7bbdIU95zM
14:55:00 <bslsk05> 'Freewill' by Rush - Topic (00:05:22)
14:55:00 <FatAlbert> im on it
14:55:00 <j`ey> heat: really, ive never seen it ask!
14:56:00 <heat> j`ey, maybe it's the work laptop?
14:56:00 <FatAlbert> a symbol table in compiler context is implemented as a hash table internally ?
14:56:00 <heat> but it seems macOS-ish enough that it's part of the base system
14:56:00 <\Test_User> you expect apple to follow posix in everything?
14:56:00 <heat> i just went into iTerm and started ls'ing home sub-directories (downloads, etc)
14:56:00 <FatAlbert> heat: hi
14:56:00 <FatAlbert> i see you new here
14:56:00 <heat> macOS was at one point SUS certified
14:57:00 <j`ey> heat: interesting
14:57:00 <FatAlbert> guys i have a problem
14:57:00 <FatAlbert> common
14:57:00 <FatAlbert> a symbol table in compiler context is implemented as a hash table internally ?
14:57:00 <heat> j`ey, btw it turns out my macbook isn't arm64 bcuz IT
14:57:00 <sbalmos> heat: what about POSIX ACLs?
14:57:00 <heat> the thing i'm working on supports arm64
14:58:00 <heat> sbalmos, what about them?
14:58:00 <heat> FatAlbert, yes I believe so
14:58:00 <j`ey> heat: lol.. we had to have a trial as well, to sort out arm64 issues :P
14:58:00 <sbalmos> heat: you were saying that asking for permission makes no sense per POSIX
14:58:00 <heat> sbalmos, I get a UI prompt
14:58:00 <sbalmos> oh cute
14:58:00 <heat> unless the file server (is that a thing on macOS? I believe so?) is making it prompt me
14:59:00 <sbalmos> maybe
14:59:00 <heat> j`ey, ironic... le arm sorting out arm64 issues :D
14:59:00 <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
14:59:00 <sbalmos> heat: would be neater if it was text-based "Access requires elevated privileges, please enter your sudo password:"
14:59:00 <j`ey> heat: all the arm64 machines that people use arent usually 'IT' machines, but these macs were
15:00:00 <heat> FatAlbert, idk. computer science context is computer science context
15:00:00 <heat> the logic way to implement one of those is with a dictionary. unordered dictionaries are usually hash tables
15:00:00 <heat> sbalmos, that would defo break POSIX
15:00:00 <heat> I'm not saying this behavior is breaking POSIX, but it's definitely mysterious to me
15:01:00 <sbalmos> heat: how about a filesystem that virtually calculated and followed POSIX u,g,o triples based on your effective ACLs
15:01:00 <FatAlbert> Thanks
15:01:00 <FatAlbert> god
15:01:00 <FatAlbert> i hope one day i will be helpful in #osdev
15:02:00 <FatAlbert> although i don't have much time to practice, i have faith
15:02:00 <mrvn> But you need a unordered_multimap
15:02:00 <heat> sbalmos, wdym?
15:03:00 <mrvn> FatAlbert: You normaly don't have that many symbols that it matters what you use. unless you have c++
15:04:00 <heat> right. I was going to say you can't use a symbol table in a compiler
15:04:00 <heat> I think you always end up walking AST
15:04:00 <heat> defo for a linker though
15:04:00 <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)
15:04:00 <sbalmos> privilieges
15:04:00 <mrvn> heat: why would you walk the ast?
15:05:00 <heat> sbalmos, how can ugo change per-user?
15:05:00 <mrvn> or rather isn't the ast a symbol table on the top level?
15:05:00 <heat> ugo refers to the owner of the file, not the stat() caller
15:05:00 <heat> mrvn: I guess symbol lookup is complicated?
15:06:00 <heat> like, imagine C++ name resolution rules
15:06:00 <j`ey> heat: i think that was kinda the point? that you could do it based on the stat caller?
15:06:00 <sbalmos> j`ey: that's more my point, yes
15:06:00 <mrvn> heat: posix says nothing about what the FS does internally
15:06:00 <heat> but then you're breaking POSIX
15:06:00 <sbalmos> eh screw it. POSIX is meant to be broken nowadays. :D
15:07:00 <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.
15:07:00 <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
15:07:00 <mrvn> heat: C++ name resolution is kind of screwy with the templates and overloads.
15:08:00 <FatAlbert> mrvn: not really thanks to name mangling
15:08:00 <heat> name mangling isn't apart of this
15:08:00 <mrvn> FatAlbert: name mangling is after the compiler has done it's thing.
15:08:00 <mrvn> it's the result of the name lookup
15:08:00 <FatAlbert> im quiting
15:09:00 <FatAlbert> not really ...
15:09:00 <FatAlbert> but i have to go
15:09:00 <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)
15:09:00 <FatAlbert> mrvn: im sure you are right
15:10:00 <mrvn> heat: at least you need a map std::string -> std::some_container<ast thingy>
15:10:00 <mrvn> lots of possibilities for each name
15:10:00 <heat> hm right
15:10:00 <heat> maybe there is a table after all?
15:11:00 <heat> idk screw compilers
15:11:00 <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.
15:11:00 <heat> chad x86 kernel written in assembly >>>>>>>>>>>>>>>> stupid compiler
15:11:00 <j`ey> you mispelt arm64
15:12:00 <heat> you mispelt java bytecode accelerated by jazelle
15:13:00 <j`ey> lol
15:13:00 <heat> hrrrrrrrrrrrrrmmmmmmmmmmm
15:13:00 <heat> what if we designed a CPU that just ran jvm bytecode?
15:13:00 <heat> the ultimate android CPU
15:14:00 <heat> (or Enterprise(tm)(c) CPU)
15:14:00 <GeDaMo> https://en.wikipedia.org/wiki/Jazelle
15:14:00 <bslsk05> en.wikipedia.org: Jazelle - Wikipedia
15:14:00 <heat> well yes, but only jazelle and more complete
15:14:00 <heat> your reset vector is literally JVM bytecode
15:14:00 <\Test_User> then I'd burn it
15:14:00 <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.
15:15:00 <mrvn> heat: yeo mean like ARM with the jvm extension?
15:15:00 <heat> ARM, with the JVM extension, but then without ARM
15:15:00 <heat> ARM + JVM - ARM = JVM
15:15:00 <heat> this sounds like the perfect new raspberry pi coprocessor
15:16:00 <mrvn> I never figured out if the RPi cores actually support jazelle
15:16:00 <heat> broadcom, email me
15:16:00 <GeDaMo> A Java non-virtual machine :P
15:20:00 <Andrew> Eww
15:20:00 <sbalmos> so, like the old native-LISP machines?
15:30:00 <Andrew> Lisp is better than Java IMO
15:30:00 <Andrew> \Test_User:
15:32:00 <\Test_User> might still burn those, having your CPU able to use a variety of languages is generally useful
15:33:00 <Andrew> \Test_User: Well, you can certainlly make C compilers out of Lisp
15:33:00 <Andrew> Lambda Calculus is turing complete
15:33:00 <jimbzy> You can also make C compilers out of C.
15:33:00 <Andrew> \Test_User: But Lisp is much saner than a native language than Java
15:33:00 <\Test_User> I wouldn't be able to sanely write C for that though
15:34:00 <Andrew> jimbzy: Of course
15:34:00 <Andrew> \Test_User: True, as in I can't sanely write Lisp on current hardware either ...
15:34:00 <jimbzy> I have no idea what's going on, btw. I'm just trying to participate.
15:34:00 <jimbzy> ;)
15:35:00 <\Test_User> true but you also can't sanely write java on current hardware :P
15:35:00 <jimbzy> I have been messing with programming for 20+ years and I have never once written a java program.
15:36:00 <\Test_User> read up a little and you'll see why java is here, I haven't either
15:36:00 <\Test_User> ...though I also haven't been programming for 20 years, mostly for lack of existing that long
15:36:00 <mrvn> I have, before it had const
15:36:00 <mrvn> aka final
15:37:00 * Andrew forces \Test_User to exist for the same length as Andrew themselves
15:37:00 <mrvn> And hey, if you get a null pointer exception just keep going, nothing to see.
15:38:00 <\Test_User> Andrew: you also haven't been existing for 20 years
15:38:00 <Andrew> \Test_User: I make you exist for shorter
15:38:00 <\Test_User> yes
15:38:00 <Andrew> ... Uh, what consequences would that have
15:38:00 <\Test_User> I'd be sent back in time to where I was a total noob in computers is likely
15:39:00 <Andrew> Hmm
15:39:00 <Andrew> That means you have a max computer experience of six years
15:39:00 <jimbzy> mrvn, It just never came up. I have nothing against the language, but it seems like I've always found a better solution.
15:39:00 <\Test_User> Andrew: sounds about right
15:40:00 <Andrew> \Test_User: Do you like the Dangerous Bend sign?
15:40:00 <\Test_User> "the what"
15:41:00 <Andrew> Uh, wrong channel
15:45:00 <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
15:46:00 <mrvn> jimbzy: and microsofts java didn't show null pointer exceptions, just keept going silently. That really turned me against java.
15:46:00 <jimbzy> Ugh. That sounds terrible.
15:46:00 <mrvn> and horrible slow.
15:47:00 <mrvn> They must have caught the segfault signal and then told the kernel to execute the next opcode or something.
15:58:00 <sbalmos> MS J++ was the definition of an abomination
16:27:00 <geist> J++ I have not thought of this word in some time
16:37:00 <sbalmos> geist: it is best forgotten
17:34:00 <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.
19:07:00 <moon-child> I have no horse in the c++ race, but I fully support this
19:11:00 <zid> I have sudden onset acute narcolepsy for some reason
19:12:00 <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
19:14:00 <GeDaMo> Sleep debugging :|
19:14:00 <mjg_> i recently dehydrated myself, only realized it after getting a headache
19:15:00 <mjg_> 2 days of sleeping 15 hours
19:15:00 <bauen1> mrvn: may i suggest randomly removing lines from the headers ? there's a good chance you'll improve the library
19:16:00 <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.
19:17:00 <zid> I'm now doing my third printf implementation in this project.. *copy paste*
19:18:00 <mrvn> with "uint64_t / 10" for the decimal numbers or an optimized divu10?
19:19:00 <moon-child> sounds like creduce
19:19:00 <moon-child> zid: how many line editors have you written though?
19:20:00 <zid> none, thank god
19:21:00 <moon-child> I've had to write ~3 now, from scratch each time
19:21:00 <zid> had to?
19:21:00 <moon-child> well
19:21:00 <moon-child> you gotta edit lines
19:21:00 <moon-child> I mean stuff like readline, not ed
19:21:00 <mjg_> i heard a long time ago that writing a text editor is the standard programmer's rite of passage
19:21:00 <zid> ah
19:21:00 <mjg_> yet i don't know anyone who did this
19:21:00 <zid> line editor
19:21:00 <zid> right
19:22:00 <Griwes> Would you say you know Mr PonyOS?
19:25:00 <zid> copy paste failed, segfault :(
19:27:00 <zid> I blame moon-child
19:29:00 <zid> oh I figured it out, the 'paste' in vmware is cutting off eventually
19:29:00 <zid> so I lost half the body of a function
19:32:00 <mjg_> lol
21:34:00 <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?
21:35:00 <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
21:35:00 <moon-child> callee is always allowed to clobber them
21:36:00 <moon-child> iirc glibc will do a blanket memory clobber, instead of specifying exactly what can be overwritten for every syscall
21:39:00 <zid> yea I will do too, for memory, now I've researched that gcc is VERY precise about what *s means :p
21:39:00 <zid> and that "m" (s) doesn't imply "m" (*s) etc
21:39:00 <zid> I was just thinking how much I gave about about over-clobbering or over-pushpopping regs
21:40:00 <zid> need to figure out how to responds to scratch regs + inlining though still
21:41:00 <zid> i.e f(void) { syscall(); ... }; and it inlines the syscall, does it still consider r8 to be trash, as if it hadn't
21:45:00 <mjg_> clobber everything and consider relaxing only after you no longer have weird crashes
21:45:00 <zid> kek
21:55:00 <moon-child> syscall is expensive anyway. Maybe not worth doing anything fancy
21:55:00 <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
21:56:00 <zid> if the optimizer wants to it can just do that bit in userspace
21:56:00 <zid> if it deems it important
21:56:00 <mjg_> cmon man where is your spirit
21:58:00 <mrvn> zid: Your asm("SYSCALL" ....) should mark r8 as clobbered as well as the argument and return registers.
21:59:00 <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.
22:00:00 <moon-child> ^
22:00:00 <zid> I ate it
22:00:00 <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.
22:00:00 <moon-child> ^
22:02:00 <mrvn> ==> the asm("SYSCALL" ...) has to list all possible input and output registers.
22:03:00 <mrvn> anyone use fpu or simd registers in syscalls?
22:04:00 <moon-child> I hope not
22:04:00 <zid> I am now more powerful than the power of a man with two spirits, but half that
22:05:00 <zid> I should eat other people's
22:05:00 <moon-child> what?
22:05:00 <zid> If you eat your own it turns out you don't turn into Jet Li's the one
22:34:00 <mrvn> Wow, gcc has learned to divide by 10: https://godbolt.org/z/xnMdKrehE
22:34:00 <bslsk05> godbolt.org: Compiler Explorer
22:34:00 <mrvn> clang still makes a function call :(
22:40:00 <moon-child> recently I found out gcc will actually divide by a constant if you mark a function as cold
22:41:00 <Ermine> Compilers try hard to not emit div instuction?
22:41:00 <zid> mul is significantly faster
22:41:00 <zid> so you can do tricks to implement * 1/x instead
22:41:00 <moon-child> indeed
22:41:00 <zid> usually ends up looking like multiplying by a huge constant combined with a shift
22:41:00 <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
22:42:00 <mrvn> moon-child: even for constants with nice 1/x multiply?
22:42:00 <moon-child> I think they do it for that
22:42:00 <moon-child> but not when 1/x isn't exactly representable
22:43:00 <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
22:43:00 <mrvn> zid: even better is mul r0:r1, r2 and the shift is 32bit so it just takes r0.
22:43:00 <zid> and n*327823943043 and checking how many times it overflows is a very strong approximation
22:44:00 <mrvn> moon-child: there are a ton of numbers with a 1/x costant that works.
22:44:00 <zid> which you can get to less than 1 integer of error by doing it in a bigger type
22:44:00 <zid> qed
22:44:00 <moon-child> mrvn: only powers of two
22:44:00 <mrvn> gcc used to do it a lot more but DIV has become too fast for anything too fancy.
22:45:00 <moon-child> again, talking about floating-point
22:45:00 <moon-child> not ints
22:45:00 <zid> we have hard accelerated 1/x anyway for floats
22:45:00 <zid> hardwre*
22:45:00 <mrvn> moon-child: no. (x * -3689348814741910323) >> 3 is x / 10 for example.
22:45:00 <moon-child> again, talking about floating-point
22:46:00 <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.
22:47:00 <moon-child> you're missing my point
22:47:00 <zid> he never once cared
22:47:00 <moon-child> tru
22:47:00 <zid> he's basically an alice bot, if you start talking about something with someone, he will respond with similar things
22:48:00 <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
22:48:00 <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
22:49:00 <moon-child> obviously, just multiplying by the reciprocal isn't enough
22:49:00 <mrvn> moon-child: excempting the obvioud powers of 2. Those can do (long)y - 1
22:49:00 <zid> is it exactly the same even in funny rounding modes?
22:50:00 <mrvn> moon-child: I don't believe there is a 0.33333333333 double that will do exactly x/3.
22:50:00 <moon-child> yes. You cannot just do a multiply. A single multiply is not sufficient
22:50:00 <mrvn> You might be able to do a float x/3 by using doubles.
22:51:00 * moon-child gives up
22:51:00 <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
22:51:00 <zid> everything then? :P
22:51:00 <mrvn> moon-child: do you have an example how it would look like for x/3 for doubles?
22:51:00 <zid> I consider all floating point values to be intervals
22:52:00 <moon-child> I consider floating point values to be exact, but equipped with inexact operations
22:53:00 <zid> The interval math works, you can just do the 4 way multiply to figure out your bounds
22:53:00 <zid> so 1 to 2 * 4 to 5 = 4*1 to 2*5 = 4 to 10
22:53:00 <moon-child> mrvn: https://projects.ncsu.edu/wcae//ISCA2004/submissions/cornea.pdf
22:53:00 <zid> or whatever
22:53:00 <zid> What do they call them, FPUs? QPUs?
22:54:00 <zid> quantum precision units
22:54:00 <moon-child> I mean interval math is cool
22:54:00 <mrvn> zid: a / b is harder
22:54:00 <moon-child> and should probably be used more
22:54:00 <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
22:55:00 <moon-child> but I don't think it's appropriate to say that floating-point numbers themselves are intervals, because the error compounds
22:55:00 <zid> so it ends up with differences int he final bit position in the final float
22:55:00 <mrvn> zid: doesn't gcc have a switch for that, rouding everything down to 64bit every step?
22:56:00 <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
22:56:00 <zid> ULP, thank you
22:56:00 <moon-child> the interval isn't part of the value
22:56:00 <zid> I knew it was some TLA
22:57:00 <mrvn> moon-child: you just have to track the borders of the intervals instead of a single float
22:57:00 <moon-child> yes, you can do that
22:58:00 <moon-child> which is why I say interval math is cool
22:58:00 <zid> hi heat, we're talking about ULPs you might wanna leave
22:58:00 <moon-child> but a floating-point number isn't itself an interval
22:58:00 <heat> youre not my boss
22:58:00 <zid> I didn't put up the caution tape in time
22:58:00 <zid> ofc not, who'd refer to their lover as 'boss' that's weird
22:58:00 <mrvn> it kind of is. It just does't give you the right interval for a+b that covers the whole error range
22:59:00 <heat> oooooooooh kinky
22:59:00 <moon-child> right, so it's not an interval. You can compute an interval. But it's not an interval
23:00:00 <moon-child> it's a floating-point number :P
23:00:00 <zid> It's a pascal string
23:00:00 <zid> someone needs to track the interval in the 4 bytes before the float :P
23:02:00 <mrvn> moon-child: YOur pdf has nothing for doing x/3. That's just the iterative Newton-Raphson method for a generic x/y.
23:03:00 <heat> you need jesus in your lives
23:03:00 <zid`> just because my internet blipped? harsh
23:04:00 <mrvn> zid: you can track the error in a float preceeding the double. :)
23:04:00 <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
23:04:00 <heat> now i'm getting tiny bits of macbook keyboard muscle memory and it's messing with me
23:04:00 <zid`> That's why you should refuse to use anything that isn't full ISO
23:04:00 <heat> alt is not command :)
23:04:00 <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.
23:05:00 <moon-child> mrvn: fma has 10x throughput of div
23:05:00 <mrvn> Does ARM has fma?
23:05:00 <moon-child> probably
23:06:00 <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
23:06:00 <mrvn> moon-child: You need 8 fma and a bunch of adds and subs.
23:06:00 <mrvn> or something
23:07:00 <moon-child> that's with a low-precision reciprocal
23:07:00 <moon-child> can do better with a high-precision reciprocal
23:07:00 <mrvn> or if 'y' has a nice reciprocal
23:09:00 <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.
23:10:00 <heat> ok it checks out, my macOS prompts me for perms when apps access certain directories (like ~/Downloads/) for the first time
23:10:00 <heat> i wonder how this fits in the fs stack
23:10:00 <moon-child> mrvn: what do you mean, literals with a high-precision reciprocal?
23:11:00 <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.
23:11:00 <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
23:11:00 <mrvn> moon-child: like for example 7 might have a reciprocal that only need 2 iterations of the process.
23:12:00 <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
23:12:00 <heat> i hope there's no file system server messing with UI for this
23:12:00 <mrvn> heat: I would think this is done inside the FS driver
23:12:00 <mrvn> vfs
23:12:00 <heat> right. which is disgusting
23:12:00 <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
23:12:00 <moon-child> that's what's going to make the main difference
23:13:00 <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?
23:13:00 <heat> also, boundaries
23:13:00 <heat> your vfs driver shouldn't touch UI. period.
23:14:00 <heat> which makes me believe/hope another system is at play here
23:14:00 <mrvn> heat: I would assume the UI is running some "ask for vfs permissions" server that connects to the vfs layer.
23:15:00 <mrvn> Think dbus :(
23:15:00 <heat> that's just lipstick on a pig :)
23:15:00 <heat> geist: have you looked into this before?
23:15:00 <mrvn> How does this work on Android? You get asked the first time an app wants to use bluetooth and such too.
23:16:00 <mrvn> Maybe open() returns an ENEEDPERM and then the app asks some system service to pop up the dialog?
23:17:00 <heat> android apps prompt you explicitly through the API
23:18:00 <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)
23:19:00 <mrvn> heat: probably the owner of the process group
23:19:00 <heat> also triggered for virtualbox's file explorer a few minutes ago
23:19:00 <heat> mrvn: right. this codepath doesn't look too simple
23:20:00 <heat> now that I think of it, does macOS have open(2)?
23:20:00 <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.
23:21:00 <mrvn> heat: It's a unix, isn't it?
23:21:00 <heat> yes, but I mean as a syscall
23:21:00 <heat> since it was based in freebsd
23:21:00 <heat> s/in/on/
23:21:00 <mrvn> hard not to since everything is a file
23:21:00 <heat> otoh, microkernel-ish thing I guess
23:22:00 <heat> also weird fact: you can cat /dev (but *only* /dev) and get the directory entries
23:22:00 <mrvn> when the window pops up can you find out which process it belongs to?
23:22:00 <heat> yeah, it tells you "$PROCESS_NAME is asking for perms to access ..."
23:22:00 <mrvn> COW filesystems don't have cat-able dirs anymore but in-memory filesystems might.
23:23:00 <mrvn> Not the process asking for permissions, the process owning the popup
23:23:00 <heat> no clue
23:23:00 <heat> there might be a way, but i'm a macOS noob
23:23:00 <mrvn> If there is some vfs-ask-permsd running on your UI it might be a pretty clean setup.
23:25:00 <heat> if you call that clean :D
23:28:00 <zid`> hmm, I wonder why only *some* stuff is crashing with illegal ops, ACID2 works, zelda does not
23:28:00 <zid`> I've never had zelda not work in my emu I use it as a test case *ponders*
23:28:00 <mrvn> No worse than the IP stack talking to the arpd
23:30:00 <heat> the IP stack doesn't talk to arpd in a traditional design :)
23:31:00 <heat> still, it'd be better. ip stack and arpd are both networking stuff, one directly depends on the other
23:32:00 <mrvn> try ruinning arpd from NFS and having it try to swap in a page
23:34:00 <mjg_> lol