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
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
<Ermine> why would catalonia be relevant to heat
<zid> because it's a joke implying that he is merely discount spanish
<heat> i mean i was spanish like 4-5 generations ago
<zid> reality*
<Ermine> Oh, I was German back then
<heat> ooh thats far
<heat> german poland?
<zid> Ermine a proud kaliningrad
<heat> konigsberg
<zid> heat is czech news
<zid> On the plus side, my sorc is now level 56
<Ermine> Volga Germans
night has quit [Remote host closed the connection]
night has joined #osdev
navi has quit [Ping timeout: 256 seconds]
netbsduser has quit [Ping timeout: 272 seconds]
<geist> PDP-11
* geist just says that to get things back on topic
<zid> Your pdp is only level 11? You should power level it
Matt|home has quit [Quit: Leaving]
<Ermine> pdp-12!
<geist> well, mine is at level 53
<Ermine> like cortex a53
<geist> yeah actually. huh
<geist> think i'm gonna write a ticket lock spinlock implementation tonight
<Ermine> gl
edr has quit [Quit: Leaving]
mavhq has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
mavhq has joined #osdev
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
Arthuria has quit [Ping timeout: 268 seconds]
<heat> geist, sweet
<heat> try_lock is weird
<geist> try lock of a ticket lock? doesn't seem too weird, just have to see if the current ticket == current acquired
<heat> it is a little weird
<heat> i remember being a bit weirded out a few weeks back when i prototyped that a bit
<heat> basically you need to cmpxchg the whole struct
<heat> also, union gens slightly better code than __atomic_compare_exchange on a struct
<heat> and then you have other questions such as "should you loop or do you tolerate spurious failure on the try_lock"
<geist> i'd just do what linux does and store the two counts as 16 bit vals in a 32bit word
<heat> yeah but you need a union for that
<heat> wait, maybe you don't
<heat> yeah. that is weird but you can add either 1 or 1 << 16
<geist> yah just do some work with << 16
<geist> right, atomic_add(lock, 1<<16)
<heat> iirc some random architectures out there don't work out too well when you do atomic ops of different sizes on the same data
<heat> so i guess thats why
<geist> right, that's why you always do a 32bit that way, yeah
<Ermine> I guess you need to add 1 + (1 << 16)
<geist> and if you put the next ticket in the top of the word then when i wraps it'll nicely wrap to 0
<heat> no, not + (1 << 16)
<heat> 1 + (1 << 16) would be a simultaneous lock + unlock
<geist> right, you want to grab the ticket, then go to a CAS loop to try to acquire it
<geist> (if yo udidn't grab it)
srjek has quit [Ping timeout: 272 seconds]
<geist> i think re: trylock you always have to be able to deal with spurious failures anyway, since by definition it's a TOCTOU thing
<geist> liek if it happened to be locked the nanosecond you tried then you fail
<heat> have you tried mcs locks?
<geist> i have not. i wrote up a prototype in pseudocode years ago but decided its too expensive for my sort of tasks
<geist> like, itseems like it should only really kick in on fairly large machines
<heat> the naive implementation shuffles a lot of pointers back and forth and requires you to keep a struct on the stack (e.g NT queued spinlocks do this)
<geist> yah i'd put the struct in a per cpu structure on its own cache line, but yeah
<heat> the linux implementation compacts it all into like two uint16s with some bits ued for other tasks
<heat> those uint16s are then basically a linked list of cpus
<geist> yah
<geist> and with the structs in the per cpu structure, the pointers make sense
<geist> only downside there is you can only grab so many spinlosk at a time, and you have to be able to disambituate it
<heat> and because spinlocks require no preempt or no irq or no softirq or whatever, you have a limited number of contexts so yeah, pretty much pcpu storage on that
<heat> nope, no limit
<geist> hmmm, have to grok that
<geist> oooh because when you hold the spinlock you dont need the struct?
<heat> basically imagine you're locking on the irqsafe context. you disable irqs, now no one else can grab an irqsafe lock
<heat> yes that too
<geist> right, okay so yeah one per cpu, since you can only be spinning on one at a time
<bslsk05> ​elixir.bootlin.com: qspinlock_types.h - include/asm-generic/qspinlock_types.h - Linux source code (v6.9) - Bootlin
Arthuria has joined #osdev
<geist> yep
<heat> the usual approach is wack and kind of limiting, even though usually reasonable
<heat> where you keep it on the stack and pass it in
<heat> wait, hmmm, now i'm not sure if you actually need to keep the mcs thingy
<geist> yah dunno, i'd do it per cpu so haven't really considered the alternative
Arthuria has quit [Ping timeout: 260 seconds]
Arthuria has joined #osdev
foudfou has quit [Remote host closed the connection]
gog has quit [Quit: byee]
Arthuria has quit [Ping timeout: 268 seconds]
foudfou has joined #osdev
PublicWiFi has quit [Ping timeout: 268 seconds]
smeso has quit [Quit: smeso]
<heat> ooh i got an awful basic lru
<heat> that survives the basic test of scanning a file larger than RMA
<heat> RAM
smeso has joined #osdev
eddof13 has joined #osdev
theruran has quit [Quit: Connection closed for inactivity]
eddof13 has quit [Client Quit]
pebble has joined #osdev
heat has quit [Ping timeout: 240 seconds]
pebble has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
pebble has joined #osdev
pebble has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
pebble has joined #osdev
pebble has quit [Client Quit]
stolen has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
Affliction has quit [Server closed connection]
Affliction has joined #osdev
goliath has joined #osdev
MrCryo has joined #osdev
dumbledoor has joined #osdev
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
gbowne1 has quit [Remote host closed the connection]
susbase has quit [Quit: Leaving]
bauen1_ has quit [Ping timeout: 256 seconds]
zxrom_ has joined #osdev
<sortie> boom
<sortie> Your screenshot has been approved.
zxrom has quit [Ping timeout: 272 seconds]
dumbledoor has left #osdev [Konversation terminated!]
zxrom_ is now known as zxrom
<nikolar> Nice heh
gimli has joined #osdev
seasharp has quit [Ping timeout: 246 seconds]
<nikolar> Very nice, I think bunnix deserves 0.0.1
<nikolar> Or at least r1 at this point
<ddevault> not yet
<ddevault> I have a few goals I want to reach before it's "done"
gog has joined #osdev
<nikolar> Heh
<nikolar> Fair
<bslsk05> ​paste.sr.ht: paste.txt — paste.sr.ht
<ddevault> here are my notes
<nikolar> Seems reasonable
<nikolar> At the current rate, you'll be done in a month :)
<ddevault> I think there's good odds on getting everything on this list in under 30 days
<ddevault> today is day 23
<nikolar> Sounds ambitious but good luck
<nikolar> Not sure how much you're missing for most stuff so it's probably not as bad as it looks
<ddevault> sbase, lok, and make all build and work correctly, just a matter of integrating them into the system proper
gog has quit [Client Quit]
<ddevault> binutils, tcc, qbe, hare: same
<ddevault> libarchive works too
<ddevault> hardest thing here is probably fleshing out the vt
<ddevault> and implementing /dev/fb for doom
<nikolar> /dev/fb is probably the easier of the two
<ddevault> yeah, I reckon so
<nikolar> The core of it is just mmap the framebuffer
<ddevault> but I do have to implement some kind of elegant hand-off from the kernel vt to a userspace consumer of /dev/fb (same with /dev/kbd)
<nikolar> Yeah it's the stuff around the mmap that requires consideration
<ddevault> which I intend to implement as "so long as someone has /dev/fb open, the kernel vt is disabled, and when they close it, the kernel vt is restored"
<nikolar> Simple enough
<ddevault> oh, and clock_gettime is going to be really fucking annoying
<ddevault> I hate time
<nikolar> Yeah it sucks
<ddevault> gotta bang my head against the cmos and tsc until I can get unix ts + nanos
<nikolar> Just do CLOCK_MONOTONIC :)
<ddevault> need a real implementation for make to work, at least
<nikolar> Ought to be enough for everyone
<nikolar> Aha right yeah
navi has joined #osdev
bauen1 has joined #osdev
gog has joined #osdev
vikn has quit [Excess Flood]
netbsduser has joined #osdev
<bslsk05> ​git.sr.ht: ~sircmpwn/bunnix (master): lib/libc/src/process/system.c - sourcehut git
vikn has joined #osdev
GeDaMo has joined #osdev
<kazinsal> gaaaaaaaaaah I have a craving for shake shack and the nearest one is 115 miles and one international border away
<kazinsal> so sad
<GeDaMo> What's a "shake shack"? :|
<kazinsal> fast casual restaurant from the east coast of the US that eventually migrated over to the west coast
<kazinsal> but has not yet migrated north of the 49th
<GeDaMo> Ah, rapid repasts :P
<sortie> ddevault: I mean you're welcome but isn't that code like super suspicious like it's 2013 sortie and it's full of typos
<ddevault> I mean whatever
<ddevault> I read over it and it does what it says on the tin
<sortie> ddevault: https://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html ← I mean extra credit you can contribute back the missing features here
<bslsk05> ​pubs.opengroup.org: system
<kazinsal> I should probably work on my OS at some point
<kazinsal> one of many
<ddevault> sortie: if and when I rewrite this I will! special GPL exception just for you
<sortie> ddevault: Fun fact Sortix used to be GPLv3+
<kazinsal> I'd love a well known copyleft license that isn't GPL
deriamis has quit [Quit: ZNC - https://znc.in]
<kazinsal> BSD3 Plus No You Can't Just Make Bajillions Off It For Free
deriamis has joined #osdev
<ddevault> kanzure: EUPL
<GreaseMonkey> looking up how stuff works for the NEC PC-98 for a bootloader and, uhh, let's just say that the BIOS straight up has a flag which allows you to make it auto-retry reads
<GreaseMonkey> also there's a "multitrack" flag which might make multi-sector reads easier?
<GreaseMonkey> a notable quirk of the PC-98 BIOS is i think you have to explicitly denote whether a disk is MFM or FM
leg7 has joined #osdev
qubasa has quit [Ping timeout: 240 seconds]
qubasa has joined #osdev
teroshan8 has joined #osdev
teroshan has quit [Read error: Connection reset by peer]
teroshan8 is now known as teroshan
ghostbuster has quit [Ping timeout: 256 seconds]
ghostbuster has joined #osdev
<leg7> Hey can someone help me find out why my exceptions with error code don't work?
<leg7> Whenever I get an interrupt that is supposed to push an error code instead of returning to the main code it loops into exceptions 13
<leg7> GP
<leg7> I've rewritten my IDT code 3 times and it still does the same thing
<bslsk05> ​github.com: LigmaOS/src/kernel/architecture/x86/32 at 8042 · leg7/LigmaOS · GitHub
<leg7> all other interrupts work fine
<leg7> It's just the ones where the cpu is supposed to push an error code that don't work
<bslsk05> ​github.com: LigmaOS/src/kernel/architecture/x86/32/isr.nasm32.asm at 8042 · leg7/LigmaOS · GitHub
<kazinsal> I did a git clone of your source tree and even after patching the CC= line in your makefile it won't run, because it's trying to reference <stdio.h>
bauen1 has quit [Ping timeout: 256 seconds]
<leg7> I don't have any issues can you share the log?
<bslsk05> ​IRCCloud pastebin | Raw link: https://irccloud.com/pastebin/raw/4X7pulKe
<leg7> I'm on the branch 8042
<leg7> Maybe that one doesn't have issues for you?
<leg7> I remember I talked about that compiler bug with someone here
<leg7> if you add `-I $(SRC_DIR)/libc/libk/stdio` to CFLAGS it should work
<leg7> for some reason my cross compiler doesn't care about `-nostdlib` and `-ffresstanding` and uses system headers to check if they are available or not
<kazinsal> your toolchain is insanely broken
<bslsk05> ​github.com: LigmaOS/Makefile at 8042 · leg7/LigmaOS · GitHub
<leg7> I put a comment about it
<leg7> It's just the compiler being strange
<kazinsal> https://github.com/travisg/toolchains go here, check this out, and run the appropriate arguments to /.doit
<bslsk05> ​travisg/toolchains - Shell script to build gcc for various architectures (33 forks/72 stargazers/MIT)
<kazinsal> your toolchain is incredibly fucked up. go fix it.
<leg7> I'm using nix and it works in the nix shell
<leg7> it's very low priority
<kazinsal> excellent. your shit works for the 0.01% of people who use linux.
<leg7> nix runs on every linux system
<kazinsal> the other 99.99% of us cannot recreate your problem
<kazinsal> because our systems don't work in that kind of fucked up way.
<leg7> I can try and fix the makefile for you if you want
navi has quit [Read error: Connection reset by peer]
<kazinsal> I did that myself. I pointed a fresh working i386 cross-toolchain at it and it gave me the same thing.
<kazinsal> your toolchain is fucked and your assumptions about what it provides are equally fucked.
<kazinsal> no freestanding toolchain will give you <stdio.h>, and no freestanding toolchain will guess an include path for your own includes.
<kazinsal> whatever your system is claiming to be freestanding isn't.
<leg7> I pushed something that should fix it
navi has joined #osdev
<leg7> on 8042
<leg7> you can try it if you want
<geist> kazinsal: you must let nix into your heart
<kazinsal> no
<kazinsal> I refuse
<leg7> You don't have to use nix
<geist> honestly i've never even looked at it. clever goes on about it all the time
<kazinsal> you will not ever convince me that a linux distribution should work on the same principles as fucking python modules
<nikolar> kek
<leg7> Can you try if the fix worked on your system?
<kazinsal> first recommendation: use ?= instead of = for things like CC
<kazinsal> = overrides environments. ?= replaces nonexistent environments
<leg7> ok
<kazinsal> so if I have CC=i386-elf-gcc, and you do CC?=i686-elf-gcc, my CC won't be overidden by yours
<kazinsal> but if my CC is undefined, it'll defulat to i686-elf-gcc
<kazinsal> default*
<nikolapdp> kazinsal: a caveat, that's non posix
<leg7> should I do that for other vars?
<kazinsal> nikolapdp: we're working on gnu make here, so posix-portability is kinda meh io
xenos1984 has quit [Read error: Connection reset by peer]
<kazinsal> imo
<kazinsal> leg7: mostly important for commands
<kazinsal> CC, AS, LD, etc
<kazinsal> where you're defining what specific important command to run
<kazinsal> anyways after fixing all that I get this: "src/kernel/kernel.c:6:2: error: #error "This needs to be compiled with an ix86-elf compiler""
<kazinsal> my otherwise any-86 compiler does not meet the __i686__ requirements
<kazinsal> probably on account of it being a valid compiler for i386 as well
<leg7> Should I remove that guard?
<kazinsal> you should probably have a more generic guard for 32-bit x86 -- lemme see what works best for that
<kazinsal> probably #if !defined(__x86_64__)
<kazinsal> or I guess #if defined(__x86_64__) for something you want to trip on 64-bit x86
<leg7> yeah I didn't find __x86_32__
<kazinsal> yeah, there isn't really a specific 32-bit x86 symbol in gcc
<kazinsal> you just need to exclude 64-bit
<kazinsal> weird "it works for me" environments make it hard for others to figure out your issue
<kazinsal> the unfortunate part is for some compiler level stuff it's not well documented on our end to make it easy to figure out
<kazinsal> I wish we had a good "HEY READ THIS FIRST" for how to set up a good, reliable environment
<kazinsal> maybe I'll put it on my long ADHD-ridden to-do list.
<leg7> Well I found that bug with someone here but it's so strange and I had other things to do I just said I'll do it later
<kazinsal> yeah, the "do it later" trap is an enticing one
<kazinsal> but it makes it hard to get help from others as a result
<leg7> are those guards better?
<nikolapdp> kazinsal: HOW TO GET GOOD RELIABLIE ENV: ./doit
<kazinsal> if I could build your whole OS in one quick enter smash we could be doing some debugging now but instead we're doing compiler debugging
<kazinsal> nikolapdp: yeah, that's why I just do that lol
<nikolapdp> lol works greak
<nikolapdp> great
<kazinsal> BACK IN MAH DAY we used to have to set up a bunch of arcane defines to make a reproducible build of the whole toolchain
<nikolapdp> yeah i don't have the patience for that :)
<kazinsal> getting my old sparc32 machine to compile for x86
<nikolapdp> so thanks geist for doit
<kazinsal> now I set up a ./doit and go get a coffee and build four arches in the time it takes the percolator to do its job and me to take a squat
<nikolapdp> also i recently got a beefy cpu and building a toolchain takes like 5 minuts
<nikolapdp> with gdb
<kazinsal> in the beginning of my osdev journey I cross-compiled from sparc32 to i386, and that was PAINFUL
<kof673> gcc -dM -E - < /dev/null | grep -i i386 #define __i386 1 #define __i386__ 1 #define i386 1 i thought gcc will do that for i386+
<kof673> __i386__ in particular
<kazinsal> one of these days I'll get back onto working on my "main" OS
<kazinsal> the fantastic networking one
<nikolapdp> which one is that again
<kazinsal> the fun thing in the meantime is a 1980s grade unix reimplementation
<leg7> I pushed another change to make the debugger easier to change with a ?= var
<kazinsal> my main OS is a full line rate capable router
<kazinsal> forwarding, route-mapping, firewalling, dynamic route stuff, the whole lot of it
<kazinsal> on account of my professional background originally being eg. BGP, OSPF, IS-IS, EIGRP
<kazinsal> nowadays professionally I just make sure a university doesn't fall apart
xenos1984 has joined #osdev
<nikolapdp> oh fancy
<nikolapdp> as in you're professional sysadmin?
<kazinsal> yep
<nikolapdp> is it a chill kind of sysadmin or nervwrecking kind
<nikolapdp> also code? > 1980s grade unix reimplementation
<kazinsal> last 8 years I was in the nervewracking business
bauen1 has joined #osdev
<kazinsal> everything from simple small datacenter rebuilds to "hey we need to you scope out 12 floors of magic network bullshit and replace it"
<leg7> 12 floors
<leg7> sounds fun
<kazinsal> so I've rebuilt everything from a 15-person office to a 5000-student private university held together with spit and duct tape
<leg7> kazinsal: did you manage to build the os?
jack has joined #osdev
<kazinsal> but then I quit that garbage and now I work for a 20,000-student public university where all the IT staff are unionized
<kazinsal> and everyone loves it here and my colleagues are all 25
<nikolapdp> heh nice
<nikolapdp> are you the oldest
<kazinsal> 25+ years older thane me
<kazinsal> they're all retirement age lol
<nikolapdp> ah right
<kazinsal> and I'm the youngest at 29
<nikolapdp> that's why you're there
<nikolapdp> to pick up the slack :)
<kazinsal> but in 30 years I can retire with full pay as a pension, so, y'know
<nikolapdp> not bad, retiring at 59 or so
stolen has quit [Quit: Connection closed for inactivity]
<kazinsal> and our collective agreement rules, so many bits added into it
<kazinsal> coverage past what our medical extended benefits do
<kazinsal> our extended does full dental and optical etc but doesn't do eg. gender affirmation
<nikolapdp> makes sense
<kazinsal> but our union collective agreement has full coverage for gender affirming care
<kazinsal> so any gender-affirming medical expenses just get billed to the union and get reimbursed immediately
<nikolapdp> > 1980s grade unix reimplementation
<nikolapdp> code or didn't happen
<kazinsal> workin' on it
<kazinsal> I'm gonna do a full at least version 4 implementation for the PC/XT as a starter
<GeDaMo> Does it work without MMU? :P
<GeDaMo> In < 640K
<nikolapdp> i kind of wanna write an os for the pdp
<kazinsal> PC-DOS 2.1 could do resident code fuckery in 128 KB
<kazinsal> I can do a unix in as much
<GeDaMo> I think the first 8086s I used had 256K but that was with DOS
<kazinsal> give me a time machine back to 1982 and Linux won't exist, I'll make sure that we can have a full open source non-AT&T derived unix on the 8088
jack has quit [Quit: Leaving]
<kazinsal> USL v. everyone ain't got shit on me
<nikolapdp> kek
<nikolapdp> many things would go down differently if there were time machines around but alas
* kof673 points at conway's law
<kazinsal> andy tanenbaum fucked up because he wanted to be a cutting edge man teaching a non realistic plan
<kazinsal> minix-86 was great for mid 80s OS courses
<kazinsal> in practice? the 8086/88 was not fast enough to do microkernel stuff while also not being smart enough to be a good process-isolating unix system.
srjek has joined #osdev
<nikolapdp> heh
* kof673 points at amoeba
<kof673> it claims to be "Microkernel" anyways
<kazinsal> ameoba's last stable release year started with a 1
<kof673> (did not mean to imply 8088, just noone ever mentions)
<kazinsal> might as well call NT/Alpha current at that point
<kof673> i'm still in 89 :D
<kazinsal> a lot of the problem of trying to write systems in 2024 for the 8088 is meh tooling -- gcc doesn't want to touch that shit, for many often good reasons
<kazinsal> so the best you have is OpenWatcom, which has a lot of caveats
<nikolapdp> what options even are there
<nikolapdp> ancient compilers/toolchains?
<kazinsal> I'm going to write a proper article on how to get a good openwatcom build chain for 8088
<kazinsal> because it's a mess
<nikolapdp> that sounds interesting
<kazinsal> openwatcom has four different compiler frontends, all of which emulate different compilers
<kazinsal> one for gcc (fails at that in many ways)
<kazinsal> one for intel cc (fails massively)
<kazinsal> one for microsoft cl (good for 386+)
<nikolapdp> kek
<kazinsal> and one for classic watcom (good for 8086+ but not for kernel level stuff)
<kazinsal> basically you need to mix and match compiler and linker frontends if you want to be able to put together a binary that runs with a simple memory model
<kof673> there is a stack overflow with list of 16-bit compilers, but do not have it handy
<kof673> the dos source...contained msc i believe...and the github says "mit licensed" (but no source of course) so possibly that too ...
<kof673> *recently-released dos source...dos 4 IIRC
<kof673> there is also a q of some compilers e.g. needs 32-bit -- can output 16-bit, but not run there
<kazinsal> `set WCLFLAGS=-c -0 -q -mt -s -zl -zld -ecc -st`
<kazinsal> that's what I had to pass to watcom's CL interface to compile 8086/88 compatible kernel code
<nikolapdp> magic incantation
<kazinsal> `wcl %1.c -fo=%1.obj %WCLFLAGS% || goto fail`
<bslsk05> ​www.emsps.com: Microsoft C and QuickC Version Information
<kof673> > Microsoft's licensing spokesperson "Rich H." told me, on 2-8-00, that anyone with a valid license to use any recent version of Visual C++ is also licensed to use any older version of Microsoft C/C++ products. I haven't heard this before, so you should confirm this for yourself. Previously, Microsoft representatives had stated that you could downgrade only two version levels.
<kazinsal> at the end of the day there was a bunch of More Magic needed to make all this output a bunch of binaries that would boot on a 5150
<kof673> i mean that seems totally credible
srjek has quit [Ping timeout: 268 seconds]
<leg7> So when I treat exceptions that push an error code as if they didn't push anything it works
<bslsk05> ​github.com: LigmaOS/src/kernel/architecture/x86/32/isr.nasm32.asm at 8042 · leg7/LigmaOS · GitHub
<bslsk05> ​github.com: LigmaOS/src/kernel/architecture/x86/32/isr.nasm32.asm at 8042-fix · leg7/LigmaOS · GitHub
<leg7> Is this a qemu bug?
<kazinsal> unlikely -- qemu TCG bugs haven't been A Thing for ages
<kazinsal> KVM bugs are also similarly improbable
<kof673> i hope to use naked functions for some stuff, so i believe watcom does support that :D
<kazinsal> openwatcom's a fun compiler to use for 16-bit x86 stuff
<kazinsal> you should not use it for anything else
<kazinsal> with the right invocations it knows how to compile for small memory systems
<kazinsal> but it is not a good general 80x86 compiler
<kazinsal> if you use it for 80386 or more I will personally disown you
<kazinsal> and you will never get support from this IRC or associated websites for doing so
<leg7> I don't really see any other explanation
<leg7> When I step through the interrupt 10 for example the error code is random stuff in memory
<leg7> interrupt 8*
<leg7> error code should be 0
<kof673> well, i would never stick to one, it just may be an option lol
<kof673> gcc and msc do naked functions too IIRC
edr has joined #osdev
MrCryo has quit [Ping timeout: 272 seconds]
MrCryo has joined #osdev
heat has joined #osdev
xFCFFDFFFFEFFFAF has joined #osdev
gsekulski has joined #osdev
MrCryo has quit [Ping timeout: 256 seconds]
<bslsk05> ​forum.osdev.org: OSDev.org • View topic - Exception handler: #GP when the exception has an error code
<leg7> I guess I was right and the error code is not being pushed
m257 has joined #osdev
<leg7> Maybe that should be mentioned in the wiki
<heat> what?
xFCFFDFFFFEFFFAF has quit [Read error: Connection reset by peer]
<heat> yeah no shit, int isn't magical
<heat> it does not know what a #GP is
<leg7> I still get the same bug even with real interrupts though
<leg7> ogm
<leg7> this is so bad
<heat> what bug?
m257 has quit [Quit: Client closed]
<leg7> When an exception that is supposed to push an error code gets triggered instead of handling it and returning to code execution it loops into #GP forever
<heat> show code pls
<leg7> So I generate ISRs like this
<leg7> if it's an exception that pushes an error code I don't push anything otherwise I push a dummy error code 0
<leg7> however when an exception that pushes an error code gets triggered instead of returning to the code it loops into exception 13 (#GP) forever
<leg7> The only way I've found to fix this is to push a dummy error code for everything
m257 has joined #osdev
<leg7> like this
<leg7> branch 8042 and 8042-fix if you want to clone
<heat> is iret the appropriate length here?
<heat> i remember there being some fuckyness when it came to iret vs iretd vs iretw
<leg7> I can try iretd if you want
<leg7> didn't fix anything
<heat> in any case i don't see anything immediately awful
<leg7> me neither
<heat> i'd check if the stack is exactly the same at the start of the isr and at the end
<leg7> ok
MrCryo has joined #osdev
bauen1 has quit [Ping timeout: 268 seconds]
bliminse has quit [Quit: leaving]
<leg7> well esp is fine until iret
<leg7> iret goes back to ISR 13 for some reason
bliminse has joined #osdev
bauen1 has joined #osdev
MrCryo has quit [Remote host closed the connection]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
<leg7> I think I'll just have to ignore error codes and give up
<heat> no
<heat> you're definitely doing something wrong somewhere
<heat> hth
PublicWiFi has joined #osdev
<leg7> it's ok I can get error codes from qemu
<heat> that's great until you need them in the kernel
<heat> unless you want to type those in!
shan has quit [Quit: Ping timeout (120 seconds)]
shan has joined #osdev
edr has quit [Ping timeout: 268 seconds]
MrCryo has joined #osdev
<ddevault> https://files.catbox.moe/ppjsof.png rigging up libvterm
<ddevault> kind of hating how it's turning out, might abandon it if I can't get the bugs ironed out fairly quickly
<heat> what init is that, custom?
<bslsk05> ​git.sr.ht: ~sircmpwn/bunnix (master): etc/rc - sourcehut git
<ddevault> oh unless you mean /bin/init, which is...
<bslsk05> ​git.sr.ht: ~sircmpwn/bunnix (master): bin/init/main.ha - sourcehut git
<ddevault> very plain
* kazinsal screams in rc scripts
MrCryo has quit [Remote host closed the connection]
<ddevault> the 24-bit true color rainbow banner is kind of fucking dope, though, maybe I should finish this
edr has joined #osdev
foudfou has quit [Remote host closed the connection]
gsekulski has quit [Ping timeout: 256 seconds]
Arthuria has joined #osdev
<GeDaMo> «In testing the algorithm, Thompson realized, "I was three weeks from an operating system." He broke down his work into three units—an editor, an assembler, and a kernel—and wrote one per week. And about that time, Bonnie took their son to visit Ken's parents in California, so Thompson had those three weeks to work undisturbed.»
<bslsk05> ​opensource.com: Origin stories about Unix | Opensource.com
<heat> ddevault, huh cool
<mjg> time estimate for a softwar project which worked out?
foudfou has joined #osdev
<heat> btw your /dev/tty* thing is wrong, you need to skip /dev/tty
<mjg> i take "bullshit stories for $100"
<dostoyevsky2> GeDaMo: Ken Thompson wrote an OpenSource Unix?
<mjg> ken thompson stole the idea for unix from vms
<kazinsal> basically don't believe finnish college students in 1991
<heat> ken thompson wrote linux yeah
<mjg> only the vfs layer
<GeDaMo> dostoyevsky2: that's the original :P
<heat> he was like "oh man this bsd shit is so crap, i'll write a better one myself"
<kazinsal> if I had a time machine I'd write a unix-like in 1982 to save us all from this bullshit
<heat> and changed his name to some made up crap like linux, wrote one in 91
<heat> linus*
<mjg> i blame ken thompson for solaris namecache though
<ddevault> heat: thanks, I don't have /dev/tty though so no problem for now
<dostoyevsky2> kazinsal: I think they tried to do this with BSD at the time but then got sued
<heat> bsd isn't a unix-like, it's a unix
<heat> or was
<dostoyevsky2> And it took until the 90s to get it cleared by the courts
<heat> mjg, solaris namecache <- svr4 namecache <- bsd namecache
<heat> it's always bsd's fault
<dostoyevsky2> heat: I think it was AT&T's fault for suing
<heat> maybe the bsd people were just really asking for it
<mjg> if only the at&t lawyers were also high
bl4ckb0ne has quit [Read error: Connection reset by peer]
bl4ckb0ne has joined #osdev
Arthuria has quit [Ping timeout: 260 seconds]
<netbsduser> what's the deal with solaris' namecache
<netbsduser> i like dragonfly's and i ended up copying it (it has pleasing characteristics for things like nullfs)
* mjg checks if the g-man is lurking
<mjg> it's the usual old unix shitery
<mjg> instead of being a first-class citizen it got bolted onto vfs
<mjg> and indeed, things like nullfs need to be a fs because of it
voidah has quit [Ping timeout: 255 seconds]
<mjg> which is turbo slow
<netbsduser> does solaris have a nullfs?
<netbsduser> the old BSD one (which is still used everywhere but DragonFly i think) i dislike
<mjg> ye, but i don't remmber how they call it
<netbsduser> a tedious pile of moving parts
<mjg> this is what you get for layering vnodes
<heat> i remember you were all shitting on inodes and praising vnodes a long while ago
<heat> oooh inode super_block so silly
<mjg> ?
<netbsduser> they are stupid names in full fairness
<mjg> there is plenty to shit on linux for
<mjg> but not making the namecache a first class citizen
<netbsduser> the namecache (or linux dentry) distinction from vnodes and addition as a layer that superimposes on vnode access is a definite good thing from linux land
<heat> encapsulating shit in 50 layers of "generic" is the classic 80s/90s UNIX vibes
<mjg> even from user pov it's a win
<mjg> because it is guaranteed *reliable*
<heat> vnodes are too encapsulated, vm_objects are too incapsulated
<heat> incap encap idk
<heat> you get it
<netbsduser> when i copied dragonfly (which probably copied linux, either that or matt dillon is very clever) i was blown away by how trivial and efficient nullfs could be
<mjg> that is part of the selling point
<mjg> and ye, it is very linux-esque
PublicWiFi has quit [Read error: Connection reset by peer]
<netbsduser> the funny part is i don't believe linux had it originally
<netbsduser> i'm sure i read somewhere it came in - perhaps linux 2.2?
<mjg> i don't know
<netbsduser> so it is not even old but i think it's clearly a step forward in unix filesystem design
<kof673> > time estimate well some of them had worked on multics at least :D
<heat> most linux things are steps forward which is why it's the leader in everything and all the other unices are ded
<mjg> that's not how it works mon
<mjg> it's non-tech people which made things happen on this front
<heat> it is not an exact science but it is reality
vdamewood has joined #osdev
<netbsduser> well there's things about how linux does filesystems i am less keen on
<mjg> the reality is the quality of tech has nothing to do with its adoption
<heat> i think there's some truth to that statement but it's not entirely true
<dostoyevsky2> netbsduser: Shouldn't a nullfs always be trivial to implement? Just ignoring everything
<netbsduser> the file ops vector in BSD was a stain on the more elegant sun VFS, the product of a failure to integrate, and i dislike that linux seems to embrace it
<heat> if it's wank, it's wank. e.g no one uses windows for big metal servers
<mjg> bro
<mjg> php was so fucking wank
<netbsduser> by god, if i have a vnode, i should be able to read or write it and not generate some other object to represent its openness
<mjg> and it was synonymous with webpages
<heat> oh, that bit makes SOOOOOOOOOOOOOOO much more sense
gsekulski has joined #osdev
<netbsduser> dostoyevsky2: no, i cannot think of a way to do it in with the BSD VFS without pain
<heat> when i read that bit on the svr4 book about how they needed a special filesystem for device files
<heat> i had an aneurism
<netbsduser> the one that's used in all BSDs other than XNU (has none) and DragonFly (has a proper namecache) had to be written by rocket scientists and is part of some big general vnode layering framework
<mjg> it did not work
<dostoyevsky2> netbsduser: I wanted to check how they implemented nullfs on OpenBSD, turns out the deleted it... like TMPFS
<mjg> openbsd gave up on trying to make it work
<mjg> netbsd has lul patches and it probably deadlocks
<mjg> freebsd beaten it to good enough shape that it mostly works
<heat> linux acknowledges files and "reading them" has nothing to do with an inode
<mjg> and by that i mean the system does nto fall over
<heat> and neither do most ops
MrCryo has joined #osdev
<netbsduser> heat: what, pray, has it got to do with if not an inode? (or vnode)
PublicWiFi has joined #osdev
<dostoyevsky2> hmmm... someone wrote an OS in Go: https://github.com/SanseroGames/LetsGo-OS
<bslsk05> ​SanseroGames/LetsGo-OS - An operating system written in Go (8 forks/89 stargazers/MIT)
<heat> netbsduser, when you write to a block device what are you writing to?
<heat> how about a character device? and a fifo? and a unix socket?
MrCryo_ has joined #osdev
<netbsduser> heat: to a block device, to a character device, to a fifo, or to a socket, through the vnode representing the same, and existing in the specfs, specfs, fifofs, or sockfs pseudo-filesystems respectively
<heat> >specfs
<heat> see, unix brain damage
<mjg> VNODE ALIASING MOTHERFUCKER
<netbsduser> i ended up updating from this approach to a devfs
<netbsduser> and now arbitary device files created elsewhere are meaningless
MrCryo has quit [Ping timeout: 256 seconds]
<netbsduser> (but i've since trimmed out almost unix from my kernel to redo in a different way now that i have had the chance to make more mistakes, so that can change)
<nikolapdp> dostoyevsky2 huh first time i've heard of someone actually trying
<heat> there's a whole MIT research kernel where they wrote a whole UNIX in go
<heat> it worked fine although with dubious memory reclaim
<netbsduser> dostoyevsky2: the mit pdos wrote their own https://github.com/mit-pdos/biscuit
<bslsk05> ​mit-pdos/biscuit - Biscuit research OS (177 forks/2411 stargazers/BSD-3-Clause)
<nikolapdp> that's actually kind of neat
<netbsduser> unfortunately named lab
<dostoyevsky2> nikolapdp: https://github.com/SanseroGames/LetsGo-OS/blob/master/syscall.go#L261 <- that syscall handler written in Go looks nice
<bslsk05> ​github.com: LetsGo-OS/syscall.go at master · SanseroGames/LetsGo-OS · GitHub
<heat> for any special file on an e.g ext2 fs: stat hits ext2, chmod hits ext2, the inode is an ext2 inode, but then read/write/mmap/ioctl/fcntl/etc all hit the special file
<heat> how can one look at this and think "how we need to duplicate vnodes on a special filesystem and somehow implement all of these semantics there, over and over again"
<heat> s/how we/oh we/
<nikolapdp> heh
MrCryo_ has quit [Ping timeout: 256 seconds]
<netbsduser> they're not duplicated, the vnode ops vector is different when a vnode is instantiated representing a VBLK/VCHR/VFIFO/VSOCK
<heat> so you craft a new vnode ops dynamically and use that?
MrCryo has joined #osdev
MrCryo has quit [Remote host closed the connection]
<netbsduser> there are static ones e.g. ext2_vnops ext2_spec_vnops ext2_fifo_vnops
MrCryo has joined #osdev
<heat> ew
<heat> that's a huge layering violation
<heat> now your ext2 driver knows about device files and fifos and sockets
<dostoyevsky2> netbsduser: That biscuit OS is also in Go. Interesting, but it's a bit large with 60M codesize, hard to read
<mjg> netbsduser: found it, nullfs is lofs in solaris
srjek has joined #osdev
<heat> what's nullfs, bind mounts?
<mjg> ye, but worse
<heat> lovely
bauen1 has quit [Ping timeout: 272 seconds]
<netbsduser> dostoyevsky2: it's a nice idea and when i was younger i was all for dissing all the actually-existing kernels in favour of modern garbage collected things
<dostoyevsky2> also in Biscuit OS it seems they've implemented their own standard library, I guess that's what one have to do to make work... but in LetsGoOS they didn't
<netbsduser> but with experience you are disabused of these childish notions that you can go and build something better trivially
<heat> discord switched a bunch of microservices from go to rust and basically eliminated long tail latency
<bslsk05> ​discord.com: Why Discord is switching from Go to Rust
<Ermine> RUUUUUUUUUUUUUST
<heat> rost
<Ermine> roasted
<mjg> rusted
<Ermine> Ig because garbage collector is no more?
<dostoyevsky2> heat: they could've just done it the mmap way, like rsc did for codesearch: https://github.com/google/codesearch/
<bslsk05> ​google/codesearch - Fast, indexed regexp search over large file trees (372 forks/3496 stargazers/BSD-3-Clause)
<heat> what?
<Ermine> Discord rust client when
<Mutabah> serenity?
<Mutabah> altough that's not official
<netbsduser> discord has a strict ban on custom clients
<heat> Ermine, yeah no gc no latency
<netbsduser> even though they appropriate the culture and hallmarks of IRC they are very much a deeply proprietary platform
<dostoyevsky2> Seems in LetsGoOS they also wrote their own allocators, so they are not using the GC.. seems reasonable, just not sure how they can still use strings (which might be GCed sometimes)
<heat> 99% of discord users don't know what irc is
<Mutabah> netbsduser: strict is a strong word
<dostoyevsky2> Any OSes written in Rust you guys can recommend to look at?
<netbsduser> Mutabah: it's not strong enough
<Mutabah> technically yes... but they don't seem to be too ban happy on well-behaved custom clients
<Ermine> Time for a joke: most keyboards in f-droid are libre
<netbsduser> they are explicitly forbidden by their terms of service - you have no recourse
<Mutabah> dostoyevsky2: redox is the famous one, but I've written one :)
<bslsk05> ​thepowersgang/rust_os - An OS kernel written in rust. Non POSIX (45 forks/703 stargazers/NOASSERTION)
<heat> Ermine, okay so given your keyboard doesn't work, how do you type?
<netbsduser> now i should couch my words here somewhat
<netbsduser> i actually like discord
<netbsduser> it is the better of IRC in a lot of respects and if IRC had the userbase that discord had, it would be a full-time job for a large team to moderate channels
<netbsduser> i was once invited to a matrix server to discuss something and it was unusable - full of porno bots and scam bots. discord to its credit has none of this
<Ermine> heat: typing works, but it either sucks because of poor layout, or there are crippling bugs, or lack of features like clipboard management
<netbsduser> on the other hand i detest the client's inflexibility, and especially the new android one is dreck - but there's no recourse, custom clients are strictly forbidden by ToS so you are inviting a permanent ban by using one
m257 has quit [Ping timeout: 250 seconds]
<dostoyevsky2> Mutabah: rust_os is a great project. I like the smaller OS projects as it's usually easier to figure out what's going on in the code
<kof673> eh...i have no idea of things, but that would seemingly allow selective enforcement...even if that is not the intention
<Ermine> I reckon that nice gui framework for rust is yet to be done
<heat> that's where c++ shines
<dostoyevsky2> Also, odd I can't find any syscall handler in https://github.com/froggey/Mezzano ... Maybe the OS doesn't target amd64
<bslsk05> ​froggey/Mezzano - An operating system written in Common Lisp (185 forks/3493 stargazers/MIT)
<netbsduser> guis are inherently object oriented and the languages that prioritise that end up doing a much better job at them
<netbsduser> in my opinion there is no reason to write a GUI in rust
<netbsduser> (less yet in C)
<froggey> dostoyevsky2: there's no syscall handler because there aren't any syscalls
<dostoyevsky2> froggey: an OS without syscalls?
<froggey> correct
<netbsduser> why torture yourself with a language designed to provide for fearless concurrency and memory safety without tracing GC when these are absolutely irrelevant to an interface? business logic maybe, but the user interface doesn't need it
<Ermine> Though I'd write core of a gui framework in C
<Ermine> For interop purposes
* kof673 makes hand gestures "EM-VEE-CEE"
<dostoyevsky2> Ermine: I guess when they eventually fulfill Rust's original intention to be used as a language for writing Firefox code we might also get some UI lib
<kof673> or, that would imply each of those are loosely-coupled enough to allow them to differ
<dostoyevsky2> froggey: I also had this idea of writing a minimal OS like: Just a normal program that loads an ELF binary and then runs it ... But the syscalls I'd need to convert into something that calls my code... I guess somethig like that has been done in gVisor and firecracker
<Ermine> Actuallty, MFC MFC MFC
pebble has joined #osdev
<kof673> well, just meant it is/was a thing to deliberately allow such separation of concerns
<kof673> vaguely like x "mechanism, not policy" somewhat
eddof13 has joined #osdev
<ddevault> okay, I've had my fun with libvterm
<ddevault> this code is a mess
<ddevault> need to separate the framebuffer code, and the early and late framebuffer consoles, then maybe I can try againb
<ddevault> but on to bigger and better things
<dostoyevsky2> ddevault: vterm does ecma-48 processing?
<ddevault> yeah
<dostoyevsky2> I also just got a gnu screen clone running, using some term lib
<ddevault> it does not help that libvterm has no docs at all
<nikolar> nice
<ddevault> perhaps I should try again with libtsm
foudfou has quit [Remote host closed the connection]
<ghostbuster> anyone got tips for reverse engineering a 32-bit arm kernel image in qemu? trying to figure out whether gdb can load a zimage or if i need to extract it first etc
foudfou has joined #osdev
<dostoyevsky2> ghostbuster: Unpack the zimage and try loading it into Ghidra? Chances are that there will also be some ghidra python libs for 32bit arm for your usecase
Left_Turn has joined #osdev
foudfou has quit [Remote host closed the connection]
<clever> ghostbuster: a zImage is a self-extracting binary
<bslsk05> ​github.com: linux/arch/arm/boot/compressed/head.S at rpi-6.6.y · raspberrypi/linux · GitHub
<clever> ghostbuster: this file forms the bulk of the naked assembly in a zImage, it will do some safety checks to ensure it doesnt overwrite itself, apply relocation patching to decompress.c, and then call decompress_kernel to unpack the real kernel
<clever> if you just load the zImage directly into ghidra, and cross-reference to this file, you should be able to figure out the offset+length of the compressed blob, extract it, and uncompress it
<clever> there may exist tooling to do that already
m257 has joined #osdev
<clever> and __enter_kernel will jump to whatever physical address it unpacked itself to
<zid> binwalk, clever
<clever> 28404 0x6EF4 gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)
m257 has quit [Client Quit]
<clever> zid: oh, yeah, that did find something
eddof13 has quit [Quit: eddof13]
<clever> not a purpose designed tool for unpacking a zImage, but good enough
<zid> wouldn't it be easier to just.. give it to grub though?
<clever> zid: i wasnt aware that grub could unpack this
<zid> unpack?
<zid> It can run it!
<clever> yeah, but when do you get something you can shove into ghidra?
<zid> why do you need to ghidra it, he said he wanted gdb to load it for some reason, just run it in grub + qemu then attach
<zid> or extract, then gdb it
<clever> ah, mixed up the follow up question from dostoyevsky2
<clever> in that case its simple, just tell qemu to boot the kernel, and stop on the first clock cycle, to await gdb
foudfou has joined #osdev
<zid> can qemu do the linux boot proto?
<clever> yes
<zid> I know grub can, which is why I suggested interposing grub, didn't know qemu could, til
<clever> if you pass qemu a flat binary, it will just run it from some arbitrary address
<clever> if you pass qemu an elf file, it will respect the LOAD headers, and entry point, and run it from the "proper" address
<clever> and i believe it can auto-detect a linux kernel, load it to some arbitrary address, and setup the args/dtb as needed
<clever> it probably does the dtb stuff in every case
<clever> the linux-arm boot proto is pretty simple, just set a certain register to point to the atags/dtb, and jump to byte 0 of the kernel
<netbsduser> they do a dead simple thing for -kernel on qemu-system-m68k -M virt
bauen1 has joined #osdev
<bslsk05> ​github.com: linux/arch/arm/boot/compressed/head.S at rpi-6.6.y · raspberrypi/linux · GitHub
<zid> thanks?
<clever> zid: this is the first few opcodes of an arm kernel, 7 or 8 NOP'
<zid> I didn't ask
foudfou has quit [Remote host closed the connection]
<clever> s and then a pc-relative jump over the header
foudfou has joined #osdev
<heat> yeah qemu can do the linux boot protocol
<heat> it has a really obtuse logic to find out what boot protocol it's supposed to use and how to run it
<heat> that IIRC is arch-dependent too
xenos1984 has quit [Read error: Connection reset by peer]
<zid> yea I've looked at that bit of code a couple of times
<zid> to see why the fuck it spits out "OVH header corrupt" if you give it an invalid image :P
<heat> yeah if you give it an ELF without a mb header it thinks its a xen thing
<zid> It's just last in the checks
<dostoyevsky2> is there a minimal qemu-like implementation somewhere that's easier to understand than trying to read qemu code?
<zid> any random hypervisor?
<heat> bochs i guess
<zid> bochs is an emulator isn't it
<heat> yeah
<heat> but it is qemu like and *probably* simpler
<zid> Depends what he's after
<zid> if he wants a hypervisor then it's nothing alike
<heat> yeah
<heat> even in qemu, tcg is a mess but the device bits are wayyyyy simpler and more readable
goliath has quit [Quit: SIGSEGV]
<heat> i take a look when i need to and it's relatively easy to understand
eddof13 has joined #osdev
<ghostbuster> clever: thanks for that link
m257 has joined #osdev
<ghostbuster> right now i don't have a bigger goal than just "see if i can boot this firmware and maybe get a kernel log"
<zid> qemu -kernel zImage
<ghostbuster> it doesn't error but doesn't produce any output
<ghostbuster> so that was when i tried to attach gdb
<zid> -s -S
<ghostbuster> yeah
xenos1984 has joined #osdev
<ghostbuster> but gdb doesn't recognize zImage as an executable
<zid> gdb
<ghostbuster> ?
<zid> set target remote localhost:1234
<zid> run
<ghostbuster> yeah
<dostoyevsky2> ghostbuster: doesn't qemu's monitor have the ability to start a gdbserver: https://www.qemu.org/docs/master/system/monitor.html
<bslsk05> ​www.qemu.org: QEMU Monitor — QEMU documentation
<zid> if you want *symbols* you'll need to dd the file from offset 2882323 or whatever binwalk said, then gunzip it, then file the kernel binary
<zid> to import that file's symbols
<ghostbuster> dostoyevsky2: yeah that's what -s -S dose
<ghostbuster> zid: for some reason binwalk says it starts at 0x0
<zid> gunzip it then?
<ghostbuster> gzip says it's not a valid archive lol
gsekulski has quit [Ping timeout: 255 seconds]
<dostoyevsky2> ghostbuster: but when you want to attach to it you still have to have a binary?
<zid> binwalk's a little weird if you don't have all the tools it uses installed
<zid> gives the wrong answers instead of errors
<ghostbuster> interesting
<ghostbuster> also i discovered unblob today
<dostoyevsky2> ghostbuster: run the zimage through: https://github.com/marin-m/vmlinux-to-elf
<bslsk05> ​marin-m/vmlinux-to-elf - A tool to recover a fully analyzable .ELF from a raw kernel, through extracting the kernel symbol table (kallsyms) (122 forks/1224 stargazers/GPL-3.0)
<ghostbuster> it's like binwalk 2.0
<ghostbuster> bslsk05: that sounds perfect, thanks
<ghostbuster> can i ask a more general question - does anyone use macOS as their host for qemu? or is it just easier to always use linux
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
<zid> I used linux in a vm from windows :P
<zid> windows -> vmware -> qemu -> my os -> my gameboy emulator
<clever> zid: you monster! :D
<zid> good software stack
<ghostbuster> vm-ception
<clever> i was recently messing with an rv32 emulator (running linux and doom), it gets about 30fps under linux
<clever> i then cross-compiled it to windows, and ran it under wine, on the same linux, now it gets 3fps!
<clever> need to dig into why
<dostoyevsky2> ghostbuster: Linux is usually better supported by qemu... I am not even sure if qemu can run on m2 macs these days... and if you are using gdb on a mac it could be Xcode's lldb so then it might not be able to attach to qemu's gdbserver... better also try it on linux
<ghostbuster> i ask because i'm much more comfortable as a developer on linux but i've been interested in emulating some apple stuff recently, which can only run on mac host, so it got me wondering how limiting it would be to use a mac host for everything
<clever> ghostbuster: at my work, we have mac-mini's running linux, with darwin under qemu
eddof13 has quit [Quit: eddof13]
<clever> the disk image for darwin gets rolled back on every reboot of the guest
<ghostbuster> interesting
<clever> so we can do darwin things with a linux host
<ghostbuster> is that a licensing requirement though? or can you actually pass through to hardware more efficiently with darwin on apple hardware, even with linux in between
<clever> the licensing requirement just says that darwin must be running on apple hardware
<clever> hence why we are using mac-mini's
<ghostbuster> gotcha
<clever> but i tested everything on a random laptop i have at home
<ghostbuster> how much of the macOS userspace does darwin include? it's more than just xnu i guess?
<dostoyevsky2> clever: ah, so like installing linux on the mac mini and then starting the macos versions via https://github.com/foxlet/macOS-Simple-KVM
<bslsk05> ​foxlet/macOS-Simple-KVM - Tools to set up a quick macOS VM in QEMU, accelerated by KVM. (1138 forks/13501 stargazers)
<clever> dostoyevsky2: exactly
illis has joined #osdev
<clever> dostoyevsky2: the biggest problem we ran into, is the nvme is on the apple security chip, for transparent encryption, and they didnt implement nvme properly
<clever> so linux was unable to see the nvme drive
<ghostbuster> this is x86 I take it?
<clever> yep
<dostoyevsky2> clever: I tried doing this on old macbook pro 2012s ... alas, Linux didn't really support the cpu fans well enough, so some macbooks overheated and died
xFCFFDFFFFEFFFAF has joined #osdev
<illis> Hello, this is my first time on IRC, glad to see an active community here.
<ghostbuster> i dumped the boot rom off an old iphone, wanted to see if i could boot it
<ghostbuster> *in qemu
<bslsk05> ​github.com: nixpkgs/pkgs/os-specific/linux/kernel/mac-nvme-t2.patch at 13d5fc4232b00dd9f86007e52d400102915ef3e1 · NixOS/nixpkgs · GitHub
<clever> this patch was required to access nvme on the mac-mini
<clever> its missing in nixpkgs master, might be upstream'd now
illis has quit [Client Quit]
<ghostbuster> i hope he had a good first IRC experience
<nikolapdp> kek
<zid> nikolapdp when is terry
<nikolapdp> when do you want terry
<zid> now?
MrCryo has quit [Quit: MrCryo]
MrCryo has joined #osdev
<nikolapdp> no
eddof13 has joined #osdev
<zid> not entirely sure why you asked me then :p
<dostoyevsky2> ghostbuster: best thing about macos running inside qemu is it has 9p support... so you can easily mount the linux host's folders... it's not that easy these days to get macos use custom drivers
<ghostbuster> neat
m257 has quit [Ping timeout: 250 seconds]
joe9 has joined #osdev
Turn_Left has joined #osdev
gsekulski has joined #osdev
Left_Turn has quit [Ping timeout: 246 seconds]
<dostoyevsky2> I was looking at http://localhost:4017/eatonphil/go-amd64-emulator and thought it might not be that difficult to get sectorlisp or sectorc running in there, but then I realized that those still use x86 asm, not amd64...
<bslsk05> ​eatonphil/go-amd64-emulator - Userland linux/amd64emulator in Go (5 forks/19 stargazers)
pebble|2 has joined #osdev
pebble|2 has quit [Remote host closed the connection]
pebble|2 has joined #osdev
pebble has quit [Ping timeout: 272 seconds]
pebble|2 has quit [Read error: Connection reset by peer]
osdev199 has joined #osdev
<heat> linking localhost is a megabrain move
<heat> quick everyone try out my website file://etc/shadow
<zid> firefox seems to strip it? weird
<heat> strip it?
<heat> how?
<zid> removes etc/
<heat> my chrome says invalid_url because of the EACCES
<heat> yeah firefox strips etc, weird
<heat> oh, file:///etc/shadow
<osdev199> Hello, the `wrmsr` instruction is hanging in my lapic timer driver code while setting the initial count for one-shot or periodic mode. I have no exception handlers set up atm. Earlier it was working when I didn't introduce the code for the same when the mode is tsc-deadline. Any idea? Thanks.
<zid> wrmsr can hang?
<zid> bug lockup?
<zid> bus*
<heat> i mean, probably
<heat> lots of things can hang on x86 in byzantine ways
<heat> osdev199, ok so: is this real hardware, under a hypervisor, emulator? how does the code look?
<heat> what chip?
xenos1984 has quit [Ping timeout: 268 seconds]
<osdev199> heat: It's the real hardware having a 64-bit intel cpu. Code: https://github.com/robstat7/Raam/blob/master/timer.c#L208
<bslsk05> ​github.com: Raam/timer.c at master · robstat7/Raam · GitHub
<zid> X2APIC_INIT_COUNT
<heat> all your assembly is wrong
<heat> and i don't know if you have an X2APIC, you didn't tell me the actual chip
<zid> but yea, these are all broken as fuck
<bslsk05> ​github.com: Raam/timer.c at 15606c82e1564c131be82add7c85a64bd2c3e4fd · robstat7/Raam · GitHub
<zid> they clobber a bunch of regs and don't tell the compiler
<heat> ooh {d} is a fun new way of doing printk
<zid> so you could be doing mov rcx, count; mov ecx, 0x838; mov rax, ecx; wrmsr
<zid> for example
<zid> rax, rcx*
<heat> yeah basically what zid said, you can't be touching random registers without telling the compiler. the compiler can't read your mind nor your inline asm
<dostoyevsky2> heat: I am actually wondering what bslsk05 has to say about cloud init urls
<osdev199> heat: I don't know the actual chip. From the init code, I know I have lapic enabled in x2APIC mode.
vikn has quit [Excess Flood]
<heat> also you're doing too much in asm that you should be doing in C (e.g shifts and masks and checking if stuff is avail).
<heat> like, basically use inline asm (or normal asm) for the bare minimum, everything else should be C
<heat> "cpuid" isn't issuable in ISO standard C, so you need inline asm for that, but gathering the results and if'ing on that, that should all be C
<zid> (and make your inline assembly actually correct, and then actually objdump it to verify it produced what you wanted)
<zid> gcc has cpuid
<zid> it's very robust and has a nice api, it's pretty cool
<bslsk05> ​github.com: gcc/gcc/config/i386/cpuid.h at master · gcc-mirror/gcc · GitHub
<heat> that is true, but i recently saw a weird failure that i'm not sure is gcc-cpuid-related
<heat> it seems to be doing the wrong thing in ermine's CPU, where it sees AVX and XSAVE in the normal cpuid leaves, but then when it comes to getting xsave-specific leaves it tells me there isn't any
<zid> errata woo
<heat> yeah but... cpuid(1) does the right thing so?
<zid> a bug *in* cpuid is hard to search errata for
<zid> given cpuid appears 894389 times
vikn has joined #osdev
<heat> i couldnt even find errata for his cpu
<heat> it was an ivy bridge
xFCFFDFFFFEFFFAF has quit [Read error: Connection reset by peer]
<osdev199> heat: Yea. Doing it in C is simpler. But if I want to make this inline assembly work, should I tell gcc about the clobbered regs? I'm new to inline asm.
<heat> of course
<zid> CPUID Extended Topology Enumeration Leaf May Indicate an Incorrect Number of Logical Processors
<zid> closest I've found so far
<zid> osdev199: yes, and I gave you an example of why
xenos1984 has joined #osdev
<osdev199> Thanks.
<osdev199> let me try that first!
<heat> you'll also quickly realize most of what you wrote should be helper functions instead
<heat> wrmsr? nah, write it once and put it in a static inline void wrmsr(u64 msr, u64 val)
<heat> er, u32 msr I think?
<zid> yea
<zid> they're all either very low or 0x80000000 | low for some reason though
<zid> I wonder if that's an internal status bit
<zid> and it just shifts it down by 20 or whatever before it indexes it into some table
<heat> there are also a bunch of 0xC0000000
<zid> oh right yea C is what I meant anyway
<heat> if i were to guess, 0xC.... is what AMD took for itself
<heat> out of all the MSRs on my msr.h, the 0xC ones are all AMD
<heat> EFER, GS base, syscall/sysret instruction
<heat> then later stuff like the TSC_DEADLINE msr are back in the low numbers (intel feature)
<zid> I assume the iastar and shit is the 0x800 ones right? cus they're intel only? amd64 spec was the shitty sysenter thing?
<gog> larger number better
<gog> no AMD always had syscall/sysret
<zid> oh intel was the shitty sysenter?
<gog> intel's fast sytem call was sysenter/sysexit
<heat> yeah
<zid> forgor
<gog> i never used sysenter so idk how it compares to syscall
<zid> afaik it's shitty, I looked at both
<zid> but chose syscall
<heat> bad move
<gog> syscall is p easy
<zid> syscall is also shitty
<zid> WHEN FRED
<heat> wait, is boros 32-bit?
<zid> no
osdev199 has quit [Remote host closed the connection]
<zid> I'm losing my mind though
<zid> which one is fucking which
<heat> ohhh apparently intel still implements sysenter for some reason
<heat> intel is sysenter/exit, amd is syscall/ret
<zid> which one is the iastar nonsense
<gog> syscall
<zid> yea I do syscall
<heat> the STAR stuff is syscall yeah
<gog> STAR, LSTAR and CSTAR
<heat> both intel and amd implement syscall in 64-bit mode, intel implements sysenter in 32-bit and 64, amd implements syscall in 32-bit and 64
<zid> https://github.com/zid/boros/blob/gameboy/syscall.c#L39 My FULL SYSCALL IMPLEMENTATION
<bslsk05> ​github.com: boros/syscall.c at gameboy · zid/boros · GitHub
<zid> It's incredibly complicated and over-engineered I know
<heat> whats that uh
<heat> syscall handler
<zid> perfect, is what it is
<heat> where are the clobbers
<gog> it's naked
<zid> what clobbers
<gog> you don't need clobbers, it's naked. gcc/clang doesn't generate anything
<heat> and? naked just means no entry/exit AFAIK
<zid> It could be more robust than it is, but it's perfectly cromulent
<heat> but it'll still codegen
gsekulski has quit [Ping timeout: 252 seconds]
<zid> I forced out the syscall_c as no-inline so the body of the function is literally "swapgs;, mov [gs:8... call syscall_c pop rcx ..."
<zid> exactly as written
<heat> that's all very sussy if i do say so myself
<zid> good good
<zid> also the volatiles are overkill
<bslsk05> ​github.com: boros/wrmsr.c at gameboy · zid/boros · GitHub
<heat> okay so instead of adding structs for your network headers
<heat> you write them a byte at a time using uchar arrays
<zid> I wrote that all inline from referencing an example packet
<zid> no refactor has been done
<zid> refactor happens when TWO types of packet get supported :P
<zid> also that's UB
m257 has joined #osdev
pebble has joined #osdev
<Ermine> woo, quirky processor
gog has quit [Quit: Konversation terminated!]
<Ermine> Maybe linux has a way to detect cpu quirks?
pebble has quit [Remote host closed the connection]
<heat> i don't think it's a quirk, from that utility's output
xenos1984 has quit [Ping timeout: 256 seconds]
gsekulski has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
<bslsk05> ​godbolt.org: Compiler Explorer
xenos1984 has joined #osdev
<dostoyevsky2> Ermine: isn't that when compilers e.g. generate rep ret for amd cpus?
<zid> heat: what are you moaning about?
<heat> why does returning values for void functions compile?
<zid> it produces a warning, even with warnings off
<zid> that's how warningy it is
<heat> sure, thank you compiler, why does it compile though? why is this valid C?
<zid> -Werror
<zid> there, now it doesn't
<zid> We haven't had a spec update since 1989 heat
<zid> blame the shitty commitee, reasonable people don't use "comittee C"
<zid> we use warnings
<heat> there was one last year
<mjg> is void main even legal?
<heat> anyway clang errors on this with this beautiful message
<heat> <source>:3:5: error: void function 'main' should not return a value [-Wreturn-type]
<zid> good for it, afaik that's not allowed
<zid> by the standard
<heat> error on a warning?
<zid> warnings are proscribed
<zid> everything else is valid
<zid> you can add extra warnings
<zid> but you can't turn warnings into compile errors if they're listed
<bslsk05> ​en.cppreference.com: Main function - cppreference.com
<dostoyevsky2> heat: might be a traditional thing and normally one would compiler with -Werror -Wextra
gsekulski has quit [Ping timeout: 260 seconds]
<heat> "normally"
<heat> i can find you N projects that do $(CC) and that's it
<zid> I assume it's from the 80s yea, to stop broken code not working
<GeDaMo> "/* another implementation-defined signature */ (since C99)"
<zid> yes we're in a shitty situation, no we can't fix it officially
<zid> no that doesn't make it a problem in reality, if you're aware
<dostoyevsky2> heat: I personally prefer B to C... in B variables have no types at all
<heat> you'll notice i criticized C and not gcc
<heat> gcc is great and the warnings make the language palatable
<zid> I think gcc is the most critizable part here
<zid> the C89 standard is just fucking old and noody knew what they were doing
<heat> this isn't C89
<zid> by 1994 we should have fixed a whole bunch of stuff
<dostoyevsky2> heat: I read it's about templates when `T = void' and then you can still `return T()' ... but C doesn't have templates, only C++
<zid> it does have broken ass pre-ansi code that they made an effort to support, and fucky macros, though
<Ermine> Well, that's how people survive while writing C
<zid> We could have made like, a D, from the things we learned from C89, in 1994, and it'd be a super legit language
<Ermine> Warnings, not doing MAX(a++, b++) in macro, do {} while (0) and so on
<zid> instead we sort of mold C with warnings instead
<zid> mould*
frkzoid has quit [Read error: Connection reset by peer]
<heat> b004f492596894e9cecd5aac2128d719
<heat> here's the md5 for the 'D' lang you're thinking about
<heat> if you crack it you get a cookie
<heat> (include the \n, as through md5sum)
<Ermine> c++
<Ermine> Am i cryptoanalyst now
<zid> If you think that's what I was talking about heat, you've got no fucking clue what I'm talking about
<heat> Ermine, genius
<Ermine> I started with rust though
<zid> One of the *main* complaints the C++ people concede is that it's too heavily based on C
<zid> "oh yea that's just baggage from C, can't do anything about it" --C++ apologizes
<zid> apologists*
<zid> And then there's the fact C++ fixed nothing and just added 400 layers of *more* broken shit on top
<zid> so no, C++ is not "better C"
<zid> it's *more* C
<heat> ehhhh it's a solid upgrade
<heat> the only downgrade i can think of is that union type punning is technically not allowed
frkazoid333 has joined #osdev
<heat> like, the language itself. most of the standard library is a trashfire
<heat> but templates, RAII, lambdas are all super powerful and tiny additions on the base C language
<zid> Ah yes, the famously non-trashfire language, C++
<zid> where everything makes sense and co-operates nicely
<zid> you're a shit troll heat
<heat> you're thinking about the standard library zid
<zid> you're a shit troll heat
<heat> <heat> you're thinking about the standard library zid
<Ermine> I found today on stackoverflow: "prior to c++17 std::vector couldn't be implemented exactly as standard demands"
<zid> you're a shit troll heat
<heat> <heat> you're thinking about the standard library zid
<zid> you're a shit troll heat
<Ermine> Imo templates are powerful, but they are to be used wisely
<heat> ofc
<zid> literally disagreeing with himself, within SECONDS
<heat> HOW
<zid> can't even manage to keep his shitty trolling up for more than that
<Ermine> If you do this carelessly you end up with BLOAT
<heat> how did i disagree with myself
<zid> Like I'd fall for bait that pathetic
<heat> do you think templates are part of the standard library??
<zid> and that's just bizarre
<dostoyevsky2> Ermine: I actually haven't seen an OS that would heavily rely on C++ templates... Not sure why
<zid> I think you can join mjg for a while
<Ermine> zid u r poor troll
<heat> dostoyevsky2, fuchsia/zircon is one
<heat> managarm has a bunch of C++-y stuff too, serenity too
<dostoyevsky2> heat: ah, interesting
<heat> mine varies between "C in a .cpp" and "kinda C++-y"
<bslsk05> ​lore.kernel.org: [RFC PATCH v2 00/30] Rust abstractions for VFS
<heat> and i am happy-ish for the way it turned out although... the lack of consistency is a bit weird
<heat> >rust-ext2
<heat> i'm going to literally die
<heat> >fs/rust-ext2
<heat> >+# Makefile for the linux tarfs filesystem routines.
<mjg> Changes in v2:
<mjg> - Fixed data race when reading inode->i_state
<mjg> :X
<Ermine> Alviro is cc'd
<mjg> + // SAFETY: This is a new inode, so it's safe to manipulate it mutably.
<mjg> + let inode = unsafe { self.0.as_mut() };
<heat> plonk
<mjg> something tells me rust typin' is fuckin primitive
<mjg> why on earth this requires fuckery
<Ermine> it's linear!
<dostoyevsky2> mjg: tarfs?
<mjg> question marks that way -> linux-fsdevel
<heat> tarfs is their demo thing
<heat> i don't like how they keep inventing new types instead of wrapping the old ones
<heat> in any case for a RO driver it looks alright
<Ermine> heat: did you learn rust?
<heat> i tried to some years back
<heat> i can read and write it very very primitively
<heat> the ? operator is so sex though, look at that
<mjg> lol.unwrap().collect().in_arse_or_else
<heat> no gotos, no if (err) return err;
<heat> just vibes
<mjg> dude the ? thing is a massive problem
<heat> why?
<dostoyevsky2> didn't rust now also add the ?? operator, or did I confuse it with another language?
<Ermine> ???
<mjg> because as i already ranted rust lets garbage stay outside of the program
<mjg> you grab yourself a new child with Command::new
<mjg> do some lulcall()?;
<mjg> and bam, you leaked the child
<heat> oh ??? should be the unsafe keyword
<heat> mjg, sounds like an API problem on the command stuff's end
<mjg> no
<mjg> it's a design issue in the language
<mjg> which claims to be so safe bro
<mjg> that it allows things like this to happen, instead of erroring out at compilation time
<nikolar> dostoyevsky2: sounds like typescript
<heat> no?
<mjg> no what
<heat> sounds like a code problem on the command's end
<nikolar> No, it's a language design issue
<heat> i can write something trivially equal and bad in C and C++
<mjg> what do you expect that t odo
<heat> but with more code instead of ?
m257 has quit [Ping timeout: 250 seconds]
<nikolar> Which they want acknowledge because leaks are "safe"
<mjg> does either c or c++ claim there is great error handling
<heat> yeah c++ does
<mjg> lol
<nikolar> mjg I'm sure c++ does
<mjg> fuck 'em then
<mjg> c defo does not
<mjg> anyhow, this is a problem which does not need to exist
<heat> ? means: if this is err, propagate err back to the caller. else, the expr's result is the Result's value
<heat> this has nothing to do with leaking children or whatever the heck you're trying to talk about
<heat> i can literally write this in *any* language
<dostoyevsky2> nikolar: Yeah, there are a bunch of languages using ?? as an operator, including JavaScript... but Rust doesn't have it (yet?)
<mjg> it has everything to do with the fucking language claiming to have great cleanup you don't have to worry about
<heat> ? is just a neat shortcut for result types
<mjg> ... while not having it
<mjg> children being an example
<nikolar> Not that I am aware of, no
<nikolar> Maybe they are talking about adding it
<heat> <heat> mjg, sounds like an API problem on the command stuff's end
<mjg> what do you expect that thing to do
<mjg> here
<heat> if err return err else value
<mjg> what
<heat> what what
<mjg> let fucking_genz = Command::new("crap").spawn.whatever();
<mjg> let bar = foo()?;
<zid> Does it mean what it means in chess
<mjg> foo failed, fucking_genz is leaked
<zid> "wtf is this shit?"
<zid> f()??; /* !? The fuck*/
<nikolar> a ?? b is short for a ? a : b
<mjg> the ? operator facilitates fucking up like that and the language does nothing to stop it, while it could
<heat> mjg, yes so the problem is in the Command's code, where the dtor doesn't handle waiting safely
<zid> That's kind of handy
<dostoyevsky2> nikolar: Oh, slightly different context
<mjg> so you expect dtor to just wait?
<heat> maybe
<nikolar> Sure is, I wished I've had it on several occasions while writing in c
<mjg> tht's not workable
<heat> again, not my call and not the point
<nikolar> After encountering it at work in typescript
<mjg> the polint i'm making 20:27 < mjg> the ? operator facilitates fucking up like that and the language does nothing to stop it, while it could
<bslsk05> ​github.com: Onyx/kernel/kernel/mm/amap.cpp at 1a1561bf09c8d7997ff966e471ff4c4837b9b10e · heatd/Onyx · GitHub
<Ermine> Oh no, another rust shitstorm
<heat> the ? would reduce all that to a ?
<heat> i would kill for something like this in C++
<nikolar> How would it replace all that if it doesn't call the destructor
<heat> it does
<heat> mjg's problem here is that the Command dtor doesn't wait
<mjg> no
<heat> but that's not a ? problem, it's a Command problem
<zid> nikolar: Can I have !? operator that lets me have different types on each side
<mjg> it's a general problem that a handle can get out of scope
<mjg> with external state the language does not know what to do with
<mjg> another example is files
<nikolar> zid how would that work
<zid> printf(FLAG ? "%d" : "%s", FLAG !? 12 : "NaN");
<heat> files just... close the file
<mjg> no
<mjg> what if i *created* a file
<mjg> ?-out of there
<Ermine> rust can't know about processes
<mjg> and now the language closes the fd for me, which is nice 'n all, but the file itself remained while on error should have been unlinked
<nikolar> zid I'm pretty sure that would require some runtime type stuff
<heat> i feel like you're trying to blame problems you're making up on the language itself
<mjg> and rust own docs have this very bug
<mjg> which part of 20:27 < mjg> the ? operator facilitates fucking up like that and the language does nothing to stop it, while it could
<mjg> you don't understand
<heat> i don't think it facilitates
<heat> resource leaking in C is also very easy and it's way more verbosey
<zid> good job that C does runtime type stuff all the time then
<Ermine> hare hare hare hare hare
<heat> and if you screw up a goto, you're mega screwed
<dostoyevsky2> https://github.com/tathougies/hos <- seems like every programming language has it's OS these days... but I am not going to look for one written in PHP
<bslsk05> ​tathougies/hos - The functional Haskell kernel (9 forks/125 stargazers)
<mjg> of course erorr handling in c is shite
<mjg> and error handling in rust when you have external state to clean up is even worse
<heat> you could of course have handling for this with some sort of "created_file" type
<Ermine> hare hare hare hare hare
<Ermine> to change the discourse
<heat> or temp_file or whatever
<dostoyevsky2> I kind of like the error handling in shell scripts... print out an error message and just try to continue doing what you were doing
<heat> you're basically arguing language-level RAII can't guess what you're doing so we should do error handling manually
<heat> like, no, that's not what it means, just create better RAII types
<mjg> i am arguing the language should fail to compile
<mjg> if the programmer did not specify what to do
<dostoyevsky2> mjg: One should write an OS in lean4
<heat> i don't see what you mean
<mjg> whatever, i have to split().unwrap()
<heat> if you could exemplify your desired thingy, it'd be great
<heat> basically my PoV is that if i'm writing a type with a dtor (telling the language how it should be released), and i'm wrong, it's my fault, not the language's
<nikolapdp> Ermine have you tried hare
<Ermine> nikolapdp: I've started the tutorial but I still didn't finish it. But I find hare very interesting
<dostoyevsky2> Hare looks like Lua with pattern matching
srjek has quit [Ping timeout: 252 seconds]
<nikolapdp> Hare is supposed to be the c++ that never was
<nikolapdp> just slight improvements all over tha place
<nikolapdp> instead of a complete change of paradigm
<Ermine> wrong
<heat> i've just disabled Wstring-plus-int temporarily for a macro
<heat> where do i turn myself in
<nikolapdp> Ermine what is
<nikolapdp> heat what kind of macro are you writing
<Ermine> At least I don't think c++ was created to fix C
<bslsk05> ​gist.github.com: awful.c · GitHub
<nikolapdp> Ermine the name itself implies improvement no?
<nikolapdp> i didn't say it was meant to fix c
<nikolapdp> heat why the +10, is it so bad to have the PAGE_FLAG prefix
<heat> it's too verbose
<heat> PAGE_FLAG_ is implied in this context
<Ermine> nikolapdp: C++ was invented as a high level language with access to low level stuff for efficiency
<heat> i could try and do it at runtime, but that's also annoying. so + 10 seems like the more elegant solution, even if i need the silly pragma there
<nikolapdp> Ermine that counts as an (attempted) improvement in my book
<nikolapdp> heat: silly
<Ermine> I've saw that kind of macro somewhere
<Ermine> nikolapdp: fix your book then
<nikolapdp> why use c as the base if not to improve it?
<nikolapdp> either way, hare is c+bunch of language design improvements in the recent times
<Ermine> Because Stroustrup had a phd thesis on that topic
<Ermine> And I guess he had limited time
<dostoyevsky2> nikolapdp: isn't pattern matching an enormous difference between Hare and C++?
<nikolapdp> what do you mean
<dostoyevsky2> nikolapdp: pattern matching is often an ingredient for enabling monads in a language, so it really changes everything substantially, so I cannot see it as C++ that isn't trying to be that different from it
<nikolapdp> oh i am not saying you should look at it as c++ at all
<dostoyevsky2> I guess if you have monads like in Haskell you don't need templates or the like, you can just wrap it all in monads
<nikolapdp> eh what exactly do you consider monads
<dostoyevsky2> nikolapdp: like you can have an iteration monad that works similar to how iteration with templates would work in C++
<dostoyevsky2> But I guess the C++ version would all the specialized to the instantiations of the templates, and not sure if monads would ever get to that level, I guess it'd depend on the compiler
<nikolapdp> eh i meant, can you describe what you need to implement for something to be called a monad
<dostoyevsky2> > iterateM f mx n = sequence . take n . iterate (>>= f) $ mx
<dostoyevsky2> that's similar to how you'd specify an iteration in C++ for a template, no?
<nikolapdp> guess so
voidah has joined #osdev
<nikolapdp> hare doesn't have generics/templates though
<FreeFull> https://programatica.cs.pdx.edu/House/ There's an OS written in Haskell
<bslsk05> ​programatica.cs.pdx.edu: House
<FreeFull> With GUI and stuff, but.. It just doesn't feel that good
<FreeFull> I'd definitely stick with lower level languages like C, Pascal or Rust
<heat> >pascal
<dostoyevsky2> FreeFull: I was looking at hos...
MrCryo has quit [Remote host closed the connection]
<dostoyevsky2> FreeFull: The had to a lot of stuff in C...
<Ermine> pascal doesn't have a lot of stuff, so it's more lower level than higher level
<heat> quick: heat's a dumbass today edition: https://gist.github.com/heatd/98fad1a97cf7039837e733c1b6adad4f
<bslsk05> ​gist.github.com: page_lru.c · GitHub
<heat> find the boog
voidah has quit [Ping timeout: 252 seconds]
<Ermine> what's DCHECK though
<heat> debug check
<heat> it's a regular assert but theoretically debug-only
* geist sees the boog!
<geist> boog find!
<dostoyevsky2> FreeFull: House looks interesting... so many Monads everywhere
gbowne1 has joined #osdev
<dostoyevsky2> heat: have you considered using https://www.cprover.org/cbmc/ ?
<bslsk05> ​www.cprover.org: CBMC: Bounded Model Checking for Software
<heat> dunno what that is
<dostoyevsky2> Turns your C code + asserts into models that can be run by e.g. z3 or other SMT solvers
<nikolapdp> how useful that is actually
<nikolapdp> espececially on larger codebases
<heat> i highly doubt you can sanely run a model on 200KLOC
<bslsk05> ​'From Z3 to Lean, Efficient Verification - Dr Leonardo de Moura' by The Alan Turing Institute (00:26:02)
<dostoyevsky2> heat: it's expensive... as it's a NP hard domain but they do it a lot am Microsoft if that Moura guy is to be believed
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
<gorgonical> what's up everyone. do any kernal development today
<Ermine> I wonder why windows tried to launch c# compiler on boot
<heat> i found an awful boog where a remove added to the list
<gorgonical> that's interesting
<Ermine> ahh
<gorgonical> a typo bug or like a "oops that's just the wrong thing"
<Ermine> 27 ?
<heat> 27
<heat> i don't remember if it was a copypasta bug or if i was in autopilot super late
<dostoyevsky2> heat: that regehr guy has a godbolt instance somewhere that runs proposed llvm/gcc optimizations through an SMT solvers
<Ermine> happens
<bslsk05> ​'Locknote: How Badly Do We Want Correct Compilers? - John Regehr - NDC TechTown 2023' by NDC Conferences (00:53:08)
eddof13 has quit [Ping timeout: 268 seconds]
<dostoyevsky2> heat: https://alive2.llvm.org/ce/
<bslsk05> ​alive2.llvm.org: Compiler Explorer
<nikolapdp> llvm have their compiler explorer?
<dostoyevsky2> nikolapdp: For automatic verification of LLVM optimizations
<dostoyevsky2> So not a normal Compiler Explorer
<nikolapdp> ah right
<dostoyevsky2> Based on this research project: https://blog.regehr.org/archives/1722
<bslsk05> ​blog.regehr.org: Alive2 Part 1: Introduction – Embedded in Academia
<dostoyevsky2> Also, transforming code into an SMT solver (like cprover does) isn't that hard, e.g. `a / 2 * 2 = a, a > 0' looks like that in z3: https://termbin.com/nhgg
<mjg> huh
<mjg> weirdest fucking video i got recommended
<bslsk05> ​'Mastering Memory: Allocation Techniques in C, C++, and ARM Assembly' by LaurieWired (00:17:05)
<heat> oooh mjg is that your gf
<heat> but yeah i had seen one of this girl's vids before
<heat> it's weird how she keeps changing video angles
<geist> why... would you want to write aseembly versions of ARM code to call a syscall?
<gorgonical> dynamic programming
<heat> learning
<mjg> weird shit
<mjg> maybe some college is doing an asm course like that(????)
<heat> doing a full asm program printing hello world using int 0x80 is textbook stuff
<Ermine> in old macos window
<dostoyevsky2> mjg: there seems to be a wave of youtube videos recently letting pretty girls explain nerdy programming topics
<geist> yeah maybe so. i guess that's not a terrible idea i guess to introduce folks to asm, since they dont need a bare metal thing or whatnot
<geist> dostoyevsky2: THE ALGORITHM
<gorgonical> oh yeah man this angle changing this is classic programming youtuber i feel
<geist> i has decided
<Ermine> I've proceeded to the next video, "making simple windows driver in c
<gorgonical> also why armv7 though? so ancient
<mjg> armv7 is what suggests a college course
<mjg> way out of date is the way
<gorgonical> agreed
<gorgonical> i mean then why not like mips asm like the good old days
<mjg> anyhow, specifics of arm aside, what's up with c++ and c memory alloc (shite c example btw)
joe9 has quit [Quit: leaving]
<mjg> liek someone who needs to learn about malloc will be totally lost looking at mmap
<Ermine> armv7 is ok actually
<mjg> as i said, fuckin' weird
<heat> what's with the C++ example?
<heat> it looks... fine
<mjg> i had no comments on the c++ example
<mjg> the c one is shite
<heat> the C one looks fine except for the cast
<dostoyevsky2> gorgonical: chatgpt tends to favor old knowledge
<mjg> the cast is a major fucker
<mjg> beginners like to miss stdlib.h
<geist> hmm?
<mjg> besdies the idiom is to sizeof(*lulptr);
<Ermine> given that v7e-l i've met at work
<mjg> instead of repeating the type
<mjg> let's ask chatgpt how to malloc
<heat> some people do sizeof(*ptr), others don't
<mjg> these others suck
<Ermine> > writing windows driver in gvim
<geist> yeah looks fine to me. the cast is fine too
<heat> Ermine, somewhat related but i was on ted tso's web page and he recommended GNU emacs and perl for windows as a "way to make windows usable"
<mjg> you are just writing c++ mofos
<mjg> anyway chatgpt repeats that
<mjg> int *ptr;
<mjg> // Allocate memory for one integer
<mjg> ptr = (int *)malloc(sizeof(int));
<mjg> oooh hahaha
<heat> yeah i wouldn't cast, that's bad practice
<mjg> it literally shows the same code she did, except with some printfs
<mjg> now i wonder where that's from
<nikolar> we had to add threading support for dos (ntvdm) for the os class
<nikolar> naturally, i did it in gvim
<heat> >dos for the OS class
<heat> >threading support for DOS
<nikolar> yes heat
<Ermine> heat: who's ted tso
<heat> not sure what's worse
<nikolar> it was borland c++ 3.1 if i am not mistaken
<heat> Ermine, ext2/3/4 guy
<nikolar> from 1993
<mjg> wdym threading in that context
<Ermine> heh
<Ermine> re dos for the os class
<nikolar> mjg: literall preemptive threads
<nikolar> we had the interrupt handler and and scheduler and context switching
<mjg> ????
<mjg> wtf
<Ermine> Most asm textbooks in russian do stuff in dos
<nikolar> they've since switched to riscv xv6
<nikolar> the year after i was done wit hti
<nikolar> with it
<mjg> heh i did not know xv6 is on riscv now
<nikolapdp> it's been on rv for a while now
<mjg> call me old
<nikolapdp> the old x86 stuff is completely unmaintained and i'm not sure it even builds still
<Ermine> So I guess CS faculty on my uni have stop using dos not so far ago
<nikolapdp> see
<nikolapdp> so i naturally used gvim and raw nmake to write it
<nikolapdp> instead of the bloody eclipse
<nikolapdp> they wanted us to use
<bslsk05> ​'Making Simple Windows Driver in C' by Nir Lichtman (00:07:25)
<heat> eclipse is great
<mjg> is that i3-esque wm on windows?
<heat> where's the eclipse stan guy we have around
<heat> yep that's windows
<kof673> >why use c as the base if not to improve it? you will have to look it up but c++ surely was meant to be interoperable and ease 'porting C' IIRC
* kof673 marketing person handwave "market share"
<Ermine> I still didn't learn nmake
<bslsk05> ​i.imgur.com <no title>
<heat> i heard we're all about screenshots these days
<mjg> :O
<mjg> noice
<nikolapdp> heat: sure it might be
<nikolapdp> i just don't want to touch it
<nikolapdp> Ermine: neither did i :)
<mjg> heat: #achtsually can you dd if=largefile of=hehecopy ?
<nikolapdp> barely figured out how to make it work
<nikolapdp> and never touched it again other than adding object files
<heat> no, can't deal with dirty pages yet
<mjg> i take this back: 22:18 < mjg> noice
<mjg> i knew you are pulling a fast one here
<heat> this is the fastest of ones
<heat> i'm not even CLOCKing yet
<heat> nonetheless dirty writeback really doesn't have a place in memory reclaim
<heat> linuz just throttles you if it thinks you're dirtying too much
<heat> they're considering removing ->writepage and that whole codepath from page reclaim
GeDaMo has quit [Quit: 0wt 0f v0w3ls.]
<bslsk05> ​retrocomputing.stackexchange.com: ms dos - Most modern C compilers targeting DOS 8086, running on DOS 8086 (16-bit) - Retrocomputing Stack Exchange
<kof673> that implies dos i guess but...
<nikolapdp> ha no, borland c++ 3.1 bitch
<nikolapdp> that's all you get
<kof673> no i mean convo yesterday about such things
<Ermine> Oh wow, some companies provide risc-v vpsen
<kof673> some of those borland 4 or 5 or so are "freeware"
<nikolapdp> yeah i got it
<nikolapdp> i am jokin about my uni
<kof673> my community college first programming class was qbasic
<nikolapdp> oh ours was pascal
<nikolapdp> until the year after me
<bslsk05> ​labs.scaleway.com: Elastic Metal RV1 | Scaleway Labs
<Ermine> It's not free though
<nikolapdp> that sounds handy for testing software on rv
<nikolapdp> if you care about that sort of thing that is
<heat> reminds me i should try the oracle thing
<Ermine> yeah, that's what i'm talking about
zxrom has quit [Remote host closed the connection]
zxrom has joined #osdev
<xenos1984> geist: I managed compiling / installing a freestanding libstdc++ with --disable-hosted-libstdcxx now and it works like a charm, without a C library or OS, but only a bare metal target. It gives me the freestanding headers required by C++23. Looks like C++26 headers are not yet supported (GCC 14.1.0). In case you would like to add this to your toolchains - this is my build script: https://github.com/xenos1984/cross-t
<xenos1984> urce-compile/toolchain.sh#L51-L55
gsekulski has joined #osdev
<Ermine> 2026 will only start in 1.5 years
<nikolapdp> why are you doing that Ermine
<Ermine> what
<nikolapdp> making everyone here feel old
gsekulski has quit [Ping timeout: 255 seconds]
<Ermine> I also see everyone is piling NPUs in their SoCs, no matter how shite is CPU
<heat> a large portion of riscv boards are just AI hype crap
<geist> xenos1984: oh very cool!
<heat> yo geist can i get a very cool too
<heat> mjg is a meanie
<geist> now i'm torn, if i start using it in LK then it puts a hard requirement on it, which is probably untenable to lots of folks downstream
<nikolapdp> Ermine, you don't get it
<nikolapdp> everyone needs to do ai
spareproject has joined #osdev
* dostoyevsky runs nikolapdp throught the Not Hotdog app
<nikolapdp> i don't even know what that means
<Ermine> And are these npus any good against like cuda
<nikolapdp> honestly, doubt it
<nikolapdp> they are probably very specialized for specific kind of matrix multiplication and that's it
illis has joined #osdev
illis has quit [Client Quit]
srjek has joined #osdev
Matt|home has joined #osdev
<bslsk05> ​'Jian Yang: hotdog identifying app' by viet anh le (00:03:08)
<childlikempress> gonna make an app called hot dog identifying app or not hot dog identifying app?
* kof673 inserts koan about recursion
<FireFly> childlikempress: "hot dog or not dog"
<FireFly> (the app that lets you classify pictures into "sausage" and "not a canis")
<childlikempress> !! untapped market opportunity
childlikempress is now known as Mondenkind
<gorgonical> I am getting really trolled by doubly-linked lists today and I have had it
<Mondenkind> just use rust
<Mondenkind> and you won't be able to write any doubly-linked lists
<zid> disregard linked lists, acquire zidlists
<gorgonical> I have no fucking idea how these list entries are getting out of order and causing this loop but I have instead decided to use an indexed array
<zid> ah yes, you have learned the zidlist's pwoer
<heat> you're missing a lock
<zid> a zidlist is where you make a linked list, but you allocate it out of an indexed array, so you can qsort the array to sort the list
<heat> or double inserting
<gorgonical> There's only one core heat
<zid> then just relink 1 to 0, 2 to 1, etc
<heat> you're double inserting
<gorgonical> The behavior I observe is that somehow after enough list_add_tail()s instead of pointing to the head list_struct the last one points to the first element, list->next
<gorgonical> And then list_del() of course begins doing the wrong thing
<zid> make sure you handle the empty list case correctly is all I can guess
<zid> I'm constantly fucking that up when I allow tail insertion
<gorgonical> I think it's probably something like that
<gorgonical> But after realizing I don't actually *need* a linked list I decided not to use one
<zid> I always forget I need to reinitialize it if I pop the final element of a list
<zid> it doesn't seem like you'd *need* to do it, but you do, idk why
<gorgonical> if you have just one element, then shouldn't prev,next point to itself after deleting the last element?
<zid> The list pointer should be null
<heat> no
<heat> if you have one element, it'll point to the list head
<heat> if you have 0 elements, the list head points to itself
<gorgonical> right
<gorgonical> so then last element deletion has no special-case right
<zid> the first thing you add should be prev == next == this
<zid> rather than nulls
<gorgonical> yes
<zid> which is the weird case for the double
<gorgonical> How? head.next = n1. head.prev also = n1. n1.prev,next = head
<heat> how what?
<zid> that's correct
<gorgonical> how's that a weird case then?
<heat> what?
<kof673> my terminology: array list (for zidlist) singly, doubly circular singly, circular doubly
<zid> n1.prev,next = n1 would be, rather
<zid> wtf is head
<Mondenkind> zid: wtf is the point of a zidlist
<nikolapdp> random indexing i imagine
<kof673> ^^^ it doesn't need malloc for one but lol
<kof673> contiguous
<kof673> maybe "wins" on locality
<gorgonical> Oh I did leave out that these are circular
<zid> struct list **head; *head = n1; n1->prev = n1; n1->next = n1;
<heat> it was pretty implicit that these are circular linux-style lists
<gorgonical> Or I suppose it depends what is meant exactly by circular
<zid> next = head shouldn't be a compatible type even
<gorgonical> yes
<kof673> and array list you can relocate it i believe too
<kof673> not saying these are useful lol
<gorgonical> zid: just in pointer vs value
<gorgonical> should be
<gorgonical> struct list_head list; but struct list_head* next;
<gorgonical> Anyway an indexed array worked immediately, as expected
DoubleJ has quit [Quit: Not all those who wander are lost]
DoubleJ has joined #osdev
Matt|home has quit [Quit: Leaving]
Turn_Left has quit [Read error: Connection reset by peer]
leg7 has quit [Remote host closed the connection]
<dostoyevsky2> https://www.youtube.com/watch?v=CDSgJE5mPJM <- an OS built on a SQL database, seems very unique
<bslsk05> ​'[001] IBM i (AS/400): Databases all the way down...' by Mainframes & More with Matthew (00:08:02)
<kof673> not the same perhaps, but i believe "the database is the app/userland" was common in the 1960s
<nikolapdp> heh that's very interesting
gog has joined #osdev
<dostoyevsky2> I guess one could write a simple io -> memory driver for sqlite and then embed it in the kernel and then you could design all your kernels data structures in SQL... Might have some problems with multi-threading though ;)
<heat> that will land you in jail once i become president of the world
<nikolapdp> sqlite actually handles many accesses at once just fine
<nikolapdp> might be slow though but it will be correct :P
<dostoyevsky2> You could mount a file system and if someone wants to unmount you could just rollback the transaction
<heat> i would use mongodb because it's web scale
<Ermine> for scale you use cassandra
<dostoyevsky2> nikolapdp: one could popup a modal blinking dialog while the database is vacuuming
<nikolapdp> you could use cockroachdb for distributed computing :P
<heat> >Programming language: Java
<heat> no i'll stick with mongodb
<dostoyevsky2> cockroachdb is written in Go, no?
<Ermine> surprisingly enough, highload people use cassandra
<heat> i checked cassandra
<dostoyevsky2> If Cockroach University ever did teach me anything
<Ermine> including discord
<heat> cockroach uni sounds like a homeless thing
<nikolapdp> has anyone tried using sqlite database as a filesystem
<heat> yeah java is perfectly fine and high performance if you're a good java programmer and know the jvm in and out
<heat> uhhh, surely someone, check fuse
<nikolapdp> by that i mean using a raw block device as a backing storagwe
<bslsk05> ​'Cockroach University: Intro to Getting Started with CockroachDB' by CockroachDB (00:03:10)
<heat> fwiw i should check if onyx can run mongodb
<heat> and set up a nice little cute WEBSCALE stack
<dostoyevsky2> I guess the teachers are nicknamed Cockroachies or the like
<dostoyevsky2> heat: Does mongodb even have transactions?
<heat> surely
<nikolapdp> i think it does
<Ermine> it has compare-and-set afaik
<Ermine> in a book on hft i have there's a chapter on using java for hft
<heat> gosh i would *not* use java for hft
<heat> the gang hits a gc pause
<Mondenkind> there's realtime gc
<Ermine> i'd not too
<nikolapdp> there is yeah
<Mondenkind> though i think more usually they just avoid allocating
<nikolapdp> and it's apparently good
<Ermine> But apparently it is possible to use java
<heat> how do you avoid allocating in java?
<heat> everything that's not a primitive type needs a new
<Ermine> idk
<Mondenkind> well there's escape analysis
<Mondenkind> but other than that you preallocate
<heat> they do that?
<Ermine> i didn't read that chapter
<heat> if escape analysis can move your new's to the stack, that's pretty sweet and makes me feel severely less bad about using java from time to time
<Mondenkind> the gc also makes allocation faster than it would be with say malloc/free
<Mondenkind> but yeah they can stack allocate stuff
<dostoyevsky2> heat: For HFT they just minimize heap allocations... e.g. custom string types or the like... the other thing is you can just turn off the GC and then restart during the night... or run the GC once every 24h... And you can easily have like 10TB of ram these days
<Mondenkind> your cache might not be very happy with you if you leak everything
<dostoyevsky2> heat: Does Java use the stack for object storage? I thought they only store on the heap, so no escape analysis... but Go they use Escape anaylysis if you pass around by value ... but Java also only can pass by reference
<heat> yes apparently they can perform escape analysis to avoid the heap
<dostoyevsky2> https://youtu.be/XB53N2eIAig?t=2380 <- mongodb is the running gag in the CMU database lectures
<bslsk05> ​'26 - Systems Potpourri (Facebook Scuba, MongoDB, CockroachDB) (CMU Databases Systems / Fall 2019)' by CMU Database Group (01:11:32)
<Ermine> btw writing jvm which doesn't gc unless told to do so is probably possible
<dostoyevsky2> Ermine: I think turning off GC is a standard feature these days, first introduced by Azul
<nikolapdp> also wasn't there a correctnes analysis on mongodb that found all sorts of bugs that mongo just never acknowledged
<nikolapdp> what was a whole thing
<Mondenkind> probably
<Ermine> ... but at this point writing the actual stuff in c++ is much easier