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
tiggster has joined #osdev
thinkpol has quit [Remote host closed the connection]
<tiggster> I wasnt referring to the manufacturer documentation. but targeting x86 is easier from a development standpoint because there are so many resources third party resources that have accumulated over the last 40 years.
thinkpol has joined #osdev
divine has joined #osdev
nanovad has quit [Ping timeout: 252 seconds]
goliath has quit [Quit: SIGSEGV]
nanovad has joined #osdev
nanovad has quit [Ping timeout: 264 seconds]
nanovad has joined #osdev
wlemuel has quit [Quit: Ping timeout (120 seconds)]
wlemuel has joined #osdev
foudfou has quit [Ping timeout: 240 seconds]
foudfou has joined #osdev
mahk has quit [Ping timeout: 265 seconds]
lav has quit [Ping timeout: 255 seconds]
lav has joined #osdev
wlemuel has quit [Quit: Ping timeout (120 seconds)]
xenos1984 has quit [Read error: Connection reset by peer]
lav has quit [Ping timeout: 240 seconds]
wlemuel has joined #osdev
lav has joined #osdev
<zid> lav are you actually the combined reincarnation of lempel and ziv
<zid> (they died a month apart, earlier this year, kinda weird)
[itchyjunk] has quit [Ping timeout: 260 seconds]
xenos1984 has joined #osdev
[itchyjunk] has joined #osdev
<klange> zid: helping to compress the headlines
<moon-child> lav is clearly maddy from celeste
<moon-child> lrn2read
gxt__ has quit [Remote host closed the connection]
gxt__ has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
gxt__ has quit [Remote host closed the connection]
gxt__ has joined #osdev
wlemuel has quit [Ping timeout: 250 seconds]
MakaAlbarn has joined #osdev
wlemuel has joined #osdev
<MakaAlbarn> quick question, admittadly quite a bit jumping the gun, if you ported in a different c++ library (or were crazy enough to make your own), how do you tell your OS-Specific toolchain to not use GCC's C++ library?
<Mutabah> Update the linker script, and ensure that the headers are in the default search path
Burgundy has joined #osdev
osmten has joined #osdev
DynamiteDan has quit [Excess Flood]
DynamiteDan has joined #osdev
pmaz has joined #osdev
lg has joined #osdev
<heat> i'm not sure if gcc can use any other c++ library
<heat> actually, it seems that it can use libc++
<heat> anyway, for your own sanity, don't?
<sham1> Use of libc++ is consistent with sanity
<sham1> After all, it has saner license for example
<sham1> Ne not being tied to GNU is also a plus
<heat> sooo if this is political why are you using GCC anyway?
<heat> particularly with libc++, a very funny combination that's unlikely to be tested?
<klys> upon realizing this it seems unfair, tho easiest way to grab gcc-4.9 is add this to /etc/apt/sources.list : deb [allow-insecure=yes trusted=yes] http://archive.debian.org/debian jessie main contrib non-free; and then run # apt-get update; apt-get install gcc-4.9 make libncurses5-dev
<bslsk05> ​archive.debian.org: Index of /debian
Jari-- has joined #osdev
mahk has joined #osdev
slidercrank has joined #osdev
Patater- has joined #osdev
arminweigl_ has joined #osdev
Patater has quit [Ping timeout: 255 seconds]
Goodbye_Vincent has quit [Quit: Ping timeout (120 seconds)]
arminweigl has quit [Quit: ZNC - https://znc.in]
arminweigl_ is now known as arminweigl
Jari-- has quit [Remote host closed the connection]
<MakaAlbarn> heat: sanity? what is this 'sanity'? is it something you can eat?
* MakaAlbarn tilts head
heat has quit [Ping timeout: 248 seconds]
* MakaAlbarn shrugs
<MakaAlbarn> anyway, i gotta go. see ya.
MakaAlbarn has left #osdev [#osdev]
Burgundy has quit [Ping timeout: 240 seconds]
bgs has joined #osdev
Jari-- has joined #osdev
crankslider has joined #osdev
Jari-- has quit [Ping timeout: 264 seconds]
slidercrank has quit [Ping timeout: 260 seconds]
bauen1 has quit [Ping timeout: 255 seconds]
crankslider is now known as slidercrank
bgs has quit [Remote host closed the connection]
Brnocrist has quit [Ping timeout: 276 seconds]
Burgundy has joined #osdev
danilogondolfo has joined #osdev
Burgundy has quit [Ping timeout: 255 seconds]
pmaz has quit [Ping timeout: 252 seconds]
osmten has quit [Ping timeout: 245 seconds]
Burgundy has joined #osdev
wlemuel has quit [Ping timeout: 276 seconds]
wlemuel has joined #osdev
gog has quit [Quit: byee]
nyah has joined #osdev
zxrom has quit [Ping timeout: 257 seconds]
GeDaMo has joined #osdev
zxrom has joined #osdev
gog has joined #osdev
<gog> we got like 5cm of snow
<gog> i hate it
<sakasama> Why? It makes funky sounds when you step on it, and makes it really easy to track your victims and hide the bodies.
<zid> only if you wound them, if they're healthy then the increased sound dampening hurts you
<zid> I imagine.
<gog> if you wound them you can follow the blood trail
<sakasama> They'll need to slow down to cover their tracks either way. It's a definite advantage for the hunter.
<zid> Depends on how prepared each side is
<zid> exposure's bad for you too
<sakasama> What kind of amateur hunter isn't prepared? ... and here zid's been trying to pretend he's a professional. Pfft!
<mjg> gog: were u liv @
<GeDaMo> Up North :|
<zid> oop norf
<zid> sakasama: sometimes I am naked
* sakasama peruses local murder statistics on previously viking-inhabited islands.
<sakasama> zid: A true furry is never naked. I expected more from you.
<gog> mjg: reykjavík
<mjg> since when is the snow?
<mjg> is it last 2-3 days tops?
Halofreak1990 has joined #osdev
<FireFly> it's def at the point of the year where I don't want any more snow now :p
<gog> last night
<FireFly> I guess fortunately for me we're basically in full spring (well april) mode
<gog> it snowed a lot
<FireFly> now if only the temperature wouldn't fluctuate between like 2 and 18
<Ermine> gog: may I pet you
<gog> yes
* Ermine pets gog
<zid> sakasama: Call me a furry again and I'll shit in your bed.
<sakasama> zid: Does that mean you don't want to turn yourself into an eldritch beast? or do you just like things messy?
<zid> I mean you should live with the consequences of your actions.
<sakasama> That's not particularly clarifying. :/
<zid> Treat me like a dog person and I will act like one?
<sakasama> I must have misinterpreted one of our previous conversations. I apologise if I've offended you and would rather not continue with wherever this is going.
<zid> No this conversation very definitely happened over the past 10 minutes
bauen1 has joined #osdev
<geist> well.
<mjg> zid: what's the english slang for 'furry'
<zid> pardon
* zid assumed we were speaking english
<mjg> zid: hello there old chap
<mjg> zid: i mean British
<zid> furry does not infact, have any associated slang, in any sense
<zid> the sexual deviant thing is an american phenomena, the 'having fur' sense doesn't need slang
<mjg> bloody yanks
<mjg> (yankies?)
<mjg> how would you express it
<zid> yankies is the sportsball team
<klange> that'd be "yankees" with two e's
<mjg> look mate, i'm just trying to shit on americans in a british way
<mjg> help a brother out
<zid> You're not trying very hard then, you just said 'brother'
<mjg> for the cause is just
<sakasama> Is "brother" a common term for the Aussies?
<zid> no it's a term black americans use
<zid> like comrade, but for being black, rather than a communist
<sakasama> They wouldn't say "mate" though.
<zid> There was a good post on british reddit yesterday that was "I am a woman, everybody keeps calling me mate, is this normal?"
<mjg> lol
<mjg> is it though?
<zid> she answered her own question
<Ermine> Ok comrades
<zid> note, the question wasn't "One person called me mate, was it acceptable?" :P
<mjg> maybe she has a funny first name and people can't be arsed to pronounce
<zid> "literally everybody I meet does this thing repeatedly, is this typical?"
<kazinsal> i'm partial to "what's good my fellow honkies" because it gets attention
<zid> like, maybe try a dictionary before reddit love
<mjg> > love
<mjg> it is british, i know this
<zid> > pet
<zid> petal
<mjg> ok chav
<mjg> brilliant
<zid> my lover
<kazinsal> m8
<zid> duck
<mjg> i pegged you as a "pal" person
<zid> our kid
<bslsk05> ​'Peep Show - Mate/Pal Scene' by librogil (00:00:47)
<zid> pal is american af
<kazinsal> one of the fun parts about being a canadian is getting to seamlessly integrate american and english slang in a single sentence
<zid> I can't even read that without the american 'a'
goliath has joined #osdev
<mjg> see the video chaps
<zid> mucker, skip
<mjg> > skip
<mjg> is fucking great
<mjg> innit right, champ
<zid> You could also affect 'american tourist' dialect and call people sir
<zid> (also works for indian immigrant, but you need to not be visible for that to work)
<mjg> hello friends
<gog> we say "buddy" where i'm from
<mjg> we say "kurwa" where i'm from
<Ermine> hello comrade mjg
<zid> "my friend" is very eastern european
<zid> that must be what kurwa translates to
<GeDaMo> "pal" is kind of Scottish too :P
<zid> GeDaMo: ah yea!
<zid> scottish isn't english though
<sakasama> Here, everyone is "dude".
<mjg> no true scottsman
<zid> They want that hill, they can die on it
<sakasama> I guess "bro" is pretty common too, regardless of gender.
<zid> is "here" cali
<mjg> > dawg
<mjg> i would the wire but that would be pretty racist
<zid> You forgot 'g'
<mjg> quote*
<sakasama> Yes, also known as marijuana central.
<zid> I don't think it is
<zid> I think it's mainly known as cali
<zid> sakasama so silly
<sakasama> You clearly haven't been to the northern parts.
<zid> I haven't been to any of the parts
<zid> that's how I can give an objective view of what that state is known as to outsiders, qed
<mjg> ChatQED
<sakasama> I'm not sure objectivity is possible here anyways.
<zid> I'm going to make chatqed, it's just chatgpt but I strcat "qed" onto the end of everything, $10/mo
<mjg> zid: i'm gonna do the same but charge $20 and name it ChatQEDEnterprise
<Ermine> let's strcat 'Carthago delenda est' instead
<mjg> guess who will get more business
* sakasama notes that both of you are operating at a deficit already and flees from the business idea.
<mjg> sakasama: what deficint. i got an infinite supply of interns
<sakasama> I am really sucking at programming right now. :/
<mjg> i just remembered the russian "pal" equivalent
<mjg> cyka
<mjg> how come nobody mentioned it
<zid> because this is a pro-ukraine environment
<Ermine> we say 'bratan'
<nortti> < mjg> cyka ← it's interesting how this has become best known in its volapuk form
vismie has joined #osdev
dennisschagt has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
dennisschagt has joined #osdev
bnchs has joined #osdev
pmaz has joined #osdev
lanodan has quit [Ping timeout: 256 seconds]
lanodan has joined #osdev
bnchs has quit [Read error: Connection reset by peer]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
bauen1 has quit [Ping timeout: 256 seconds]
terrorjack has joined #osdev
bauen1 has joined #osdev
<Ermine> perkele
<nortti> toivon, että porot uhraavat sinut perkeleelle
bauen1 has quit [Ping timeout: 240 seconds]
<Ermine> google translate says: "I hope the reindeer sacrifice you to the devil"
pmaz has quit [Quit: Konversation terminated!]
bauen1 has joined #osdev
<nortti> more or less
<Ermine> /o\
<zid> poro and perkele are 80% of the finnish language afterall
<sakasama> Better to be sacrificed to Santa. The devil is pretty unstable these days. At least with Santa you can expect that after an old-fashioned lashing and flaying, you'll be gently turned into tender and juicy confit.
<Ermine> Will Santa accept the sacrifice?
<sakasama> It probably depends on whether they've been naughty or nice.
<zid> Readily, Ermine
<zid> have you SEEN the size of his machine guns
vin has joined #osdev
<sakasama> Rare Exports is a heartwarming Christmas movie.
asarandi has quit [Quit: WeeChat 3.8]
asarandi has joined #osdev
Burgundy has quit [Ping timeout: 260 seconds]
Left_Turn has joined #osdev
heat has joined #osdev
<heat> gcc
<nortti> gcc: fatal error: no input files
<nortti> compilation terminated.
<heat> i want to mention that gcc 13.1 removed STABS support and we should all be sad about it
<heat> what's the point of a compiler if it can't target i386-svr4
<vin> So I have been thinking about building a heatmap of a given process virtual address space. This is an attempt to identify hot/cold addresses in a process. My current plan is to use Intel PinTools but I am wondering if there is a better way to do this
<nikolar> heat: :(
Brnocrist has joined #osdev
<immibis> luckily it is open source so you are welcome to try and forward-port that from the last supported version
<mrvn> vin: patch qemu to record a heat map while emulating?
<mrvn> I would wager a guess that there is one big hot spot in the heat map when you are done: the stack.
Brnocrist has quit [Ping timeout: 255 seconds]
bauen1 has quit [Ping timeout: 250 seconds]
awita has joined #osdev
Brnocrist has joined #osdev
Brnocrist has quit [Ping timeout: 250 seconds]
<heat> i'm not touching gcc source :^)
<heat> i've been meaning to see what's up with ld.gold though. apparently it has a bunch of flaws and doesn't even support riscv, which is a shame because bfd sucks so ld.lld as the only linker is kind of sad
<heat> I extensively use GNU gold for Onyx and it works pretty well for me, though
<ThinkT510> what aboult mold?
<ThinkT510> about
<zid> ld -> universal, bad gold -> x86 only, also bad
<heat> mold is interesting but it's not a proper system-level linker
<zid> there, no more research needed
<heat> gold is not x86 only, and it's miles better than bfd
<zid> but still bad
<heat> re: mold, it doesn't support linker scripts at all
<zid> elf only* it's x86/arm/ppc/tilegx
<heat> as a design thing
<zid> It's also dead
<heat> yes, it's elf only, and I'm fine with that
<zid> I'd like to write my own linker
bauen1 has joined #osdev
<heat> lld also has completely separate code for ELF/PE/mach-o/whatever
<heat> if you abstract things too much you end up slow and complex like bfd
Brnocrist has joined #osdev
<heat> i'd like to improve gold because competition is nice and currently lld has none, barring mold which, again, doesn't fit the system-level thing
<zid> I could get away with a very simple linker 'script' tbh, just a mapping from phdrs to section names, and a load address for the phdrs
<immibis> wdym system-level?
<zid> but I don't need application level crap
<heat> immibis, doesn't support linker scripts (as a design constraint)
<zid> like, `code "rx" 0xFFFFFFFF80000000: .text .rodata; data "rw" next_avail: .data .bss; other: any noload .*;` is all the info I ever actually write into a linker script
<heat> IIRC they tried proposing some new ld options to help link bare-metal apps but honestly, given how much garbage and warcrimes exist in linker scripts, it's not really going to happen
<zid> ld's defaults are all over the place and it's a pain tracking them all down and reverting them
<vin> mrvn: I aggree, stack will be most lit in the map. I am also wondering some part of the kerneral-space will also be a hot spot
<zid> it's a bit like css in that regard
<vin> mrvn: I meant the kernel stack
<zid> heat: write me a linker that takes basically that format, kthx
<heat> i'll consider it
<awita> Hello, I have a question. I have my physical memory manager that uses a bitmap. On initialization I mark all frames from 0x0 to 0x00100000 (1M) as used. I also have my kernel stack going from 0x00106000 down to 0x00104000 (as set in my boot.asm file). I also mark all frames from 0x00100000 to 0x00106000 as used.
<awita> My question is: I have global static variables and things above address 0x00106000. How do I map those frames? Like how do I know how much it is safe to map?
<immibis> surely you should map every page that your kernel is using
<heat> oh my god, a loop!
<heat> you need to use a linker script
<zid> read your own ELF
<bslsk05> ​github.com: Onyx/linker.ld at master · heatd/Onyx · GitHub
<zid> or use symbols from your linker script
<awita> immibis: and how do I know how much is my kernel using?
<zid> to tell you how big your kernel is
<zid> <zid> read your own ELF <zid> or use symbols from your linker script
<heat> see the kernel_start and kernel_end/kernel_phys_end
<heat> if you then do (in C/C++) extern char[] kernel_start; extern char[] kernel_end; &kernel_start will be the start of the kernel in memory, &kernel_end will be the end
<awita> Oh thank you! I'm using basically the same linker script given in the Bran's tutorial
<zid> _bss_start = .; * (.bss); _bss_end = .; is fairly common so that you can zero your bss in _start etc
<zid> just extend that
<zid> I use SIZEOF though because lepadding
<awita> I thought the linker used symbols from the code, not the other way around
<zid> well, code doesn't have any values in it until runtime, so that'd be hard
Brnocrist has quit [Ping timeout: 255 seconds]
<heat> gcc will compile your .c and note that kernel_start and kernel_end are undefined
<heat> the linker then processes the linker script, provides those symbols (because you defined it like that, in the linker script, with those values) and boom everything links
<zid> they're just identical to "int blah;" in a different TU, linker's job is to invent an address for those, and fill that address in in the code.
<zid> but you skip the part where you actually do the declaration in the .c, you declare it in the linker script instead
<awita> I see now. I haven't studied much about the linking process yet :(
<immibis> awita: both - the linker's job is to decide how all the stuff in your program gets arranged in memory - it decides the address of everything. Then it fills in all the placeholders in the code with the actual addresses that it decided.
<immibis> with the linker script variables you're telling it to fill in a few more addresses that aren't "stuff" but are the start and end of sections
<awita> Thank you!
<gog> hi
<jimbzy> Sup gog?
<gog> just slacking off a bit at work :P
Brnocrist has joined #osdev
<gog> how you?
<jimbzy> Piddling with my receiver project.
<awita> jimbzy: radio receiver?
<jimbzy> Yea
<jimbzy> 40m regen
<jimbzy> I'm the worst operator ever because I never operate. The main reason I got licensed was so I could mess with these circuits without worrying about someone fox hunting me. XD
<gog> XD
<gog> gotta watch out for white vans
<gog> esp if they look like they're from a flower delivery service but have racks of RF equipment in the back
<gog> or have tinted windows
<jimbzy> Right?
<immibis> plenty of people have ham licenses and don't transmit all the time (or ever). It's not a requirement
<jimbzy> It's pretty fun listening.
<immibis> i am told it's quite easy to get one if you learn a little bit but I still haven't bothered
<immibis> plus i'd have to do the test in german
<jimbzy> Yeah, it's super easy.
<GeDaMo> Do you still have to know Morse?
<jimbzy> Nope
Brnocrist has quit [Ping timeout: 240 seconds]
<jimbzy> I'm learning it anyways, though.
<immibis> "of morse not"
<immibis> do you feel remorse?
<GeDaMo> dit
<jimbzy> As a matter of fact, today is Morse Code Day.
<immibis> it's not -- --- .-. ... . / -.-. --- -.. . / -.. .- -.-- ?
<immibis> (i used some online tool)
Brnocrist has joined #osdev
<jimbzy> I'm pretty sure Morse was born on April 27th
<jimbzy> 1781 or 1791?
<jimbzy> Right on.
<jimbzy> I nerd out on "the old ways"
xenos1984 has quit [Read error: Connection reset by peer]
Brnocrist has quit [Ping timeout: 255 seconds]
Brnocrist has joined #osdev
<gog> bsd-games has the 'morse' command
<gog> ppt is also fun too
<gog> i reimplemented them both in python as a learning exercise a long time ago
<jimbzy> Nice
Turn_Left has joined #osdev
<selfsigned> Hi! I'm trying to read eax from the stack frame returned by gcc in an ISR that's defined with attribute((interrupt)) to no avail. Am I missing something obvious or will I have to hack something up with some inline ASM instead (which I'd rather avoid)? Thanks :) https://gist.github.com/selfsigned/3c48bdfa5e51f4898017a92865853d1a
<bslsk05> ​gist.github.com: syscall.c · GitHub
Turn_Left has quit [Max SendQ exceeded]
xenos1984 has joined #osdev
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 252 seconds]
<gog> selfsigned: using __attribute__((interrupt)) is not advisible
<heat> yes, please use assembly
<gog> best bet is to use ISR stubs that will normalize the stack frame and then pass the pointer to the stack frame as a parameter to a handler
goliath has quit [Quit: SIGSEGV]
<bslsk05> ​github.com: sophia/exceptions.h at main · adachristine/sophia · GitHub
<bslsk05> ​github.com: sophia/exceptions.S at main · adachristine/sophia · GitHub
<bslsk05> ​github.com: sophia/interrupt.h at main · adachristine/sophia · GitHub
<gog> this is roughly similar if you're using x86 SYSV abi
<selfsigned> clean! Thanks!
<gog> this is for x86_64 though
<selfsigned> https://github.com/l-aurelie/kfs Yeah mine is in x86, I'll figure something out with the wiki
<bslsk05> ​l-aurelie/kfs - x86 bare metal programming for 42's Kernel programming track (0 forks/1 stargazers/MIT)
<selfsigned> Bit of a shame that gcc strictly sticks to the frame in intel's manual
<heat> you don't need the wiki here
<heat> just push every register and pass a pointer to the stack
<heat> this is standard practice for every arch
<selfsigned> in a stub right?
<heat> in assembly, yes
<selfsigned> Yeah sounds like bad things would happen doing that in inline ASM
<heat> x86 has the peculiarity of needing assembly stubs for every ISR, so you get to know what vector just interrupted you. you also want to know if the ISR pushes an error code, or if you want to push a dummy one
<zid> (attribute interrupt works okay on amd64)
<zid> It's not *useful* because it doesn't understand the error code stuff, but it's nicer than naked for "please push every reg in this function"
<zid> having to do naked + manual pushes
bauen1 has quit [Ping timeout: 248 seconds]
<heat> with that in mind, an isr0 will probably look like "push $0 /* isr number */; push $0 /* dummy error code */; jmp interrupt_common"
<selfsigned> attribute interrupt works okay for me, it's just that it doesn't push anything beyond the error code (optionally)
<zid> I use it for IRQ entry
<zid> cus there's no error code there
<heat> where interrupt_common pushes everything and passes a pointer to the stack to C
<selfsigned> It works fine for my keyboard IRQ yeah
<zid> actually that's a lie, I use it for syscalls
<zid> actually that's also a lie
<zid> I use it somewhere but I 100% do not remember where
<gog> it's not going to work for ISRs where the interrupt pushes an error code
<zid> yea it's not an exception handler
<zid> it's strictly interrupt handler
<selfsigned> https://github.com/l-aurelie/kfs/blob/main/src/hardware/interrupts/idt.c Well it does provide support for an optional error code argument
<bslsk05> ​github.com: kfs/idt.c at main · l-aurelie/kfs · GitHub
<selfsigned> (Ugly code sorry :p)
<zid> it's not optional
<zid> An interrupt handler must be declared with a mandatory pointer argument
<heat> WARN_MSG("Div by 0 exception handled\n\t->eip:%p cs:%p eflags:%p sp:%p ss:%p",
<heat> frame->eip, frame->cs, frame->eflags, frame->sp, frame->ss);
<heat> frame->eip++; // go to next instruction
<zid> oh the code itself is
<zid> right
<heat> are u fukin with me
<zid> f (struct interrupt_frame *frame, uword_t error_code)
<zid> you must define struct interrupt_frame as described in the processor’s manual.
<heat> why do your functions start with _ dawg
<zid> gcc is cleverer than heat gives it credit for
awita has quit [Ping timeout: 252 seconds]
<bslsk05> ​gcc.gnu.org: x86 Function Attributes (Using the GNU Compiler Collection (GCC))
<selfsigned> p-probably shouldn't have linked my code h-haha
<heat> no, you should have, because now you can fix it
<heat> it's the wonder of software development
<heat> in any case, that interrupt_frame sucks
<heat> it's just the true interrupt frame isn't it? no pushad?
<selfsigned> Yeah I don't think it does pusha
<zid> but it knows it's an interrupt, it will preserve regs across itself
<selfsigned> I've added the generated assembly in the gist
<heat> ok, so lets fix it
<selfsigned> I think it only pushes what's used actually
<heat> step 1: get a struct registers or something that looks like this: https://github.com/heatd/Onyx/blob/master/kernel/include/onyx/registers.h#L21
<bslsk05> ​github.com: Onyx/registers.h at master · heatd/Onyx · GitHub
<heat> then push the registers in the reverse order, except for the int frame ofc
<heat> step 3: pass a pointer to the stack (for the regs you just pushed) to C
<heat> step 4: fuckin profit
pharonix71 has joined #osdev
<heat> so your interrupt_common will be something like "push <everything in reverse> mov $KERNEL_DS, %ax; mov %ax, %{d,e,f,g}s; /* we must load the kernel ds/es/fs/gs, only cs and ss have been handled so far */ push %esp; call c_handler_stuff; <pop segment registers back>; pop <everything>; iretd"
<zid> I'm not sure frame->eip++; does what you want it to do, generally
* zid finally clicked it
<heat> yep
<heat> you'll keep executing the div/idiv imm which is, funny?
<zid> or half of it
<zid> idiv ebx -> sti -> fault :D
<heat> ok but seriously division by 0 is not a recoverable situation, please don't
<zid> (f7 fb is idiv ebx, sti is fb)
<heat> unless you want to emulate arm64 behavior and do eax = 0 on fault, eip += 2; but I'm not sure you don't get a #DE on other instructions, so that could take some instruction decoding code
<heat> TL;DR stahp
<zid> pretend divide exception is sys_exit
<zid> until you have some kind of plan worked out for it to mean anything else
<zid> hard for me though, I don't have sys_exit :p
<heat> yeah or just panic for the kernel
Burgundy has joined #osdev
<selfsigned> https://godbolt.org/z/1fvaqa6r1 seems like gcc tries to be clever and only push/pop registers as needed?
<bslsk05> ​godbolt.org: Compiler Explorer
<zid> yep
<zid> > but it knows it's an interrupt, it will preserve regs across itself
<zid> the amd64 interrupt handler is seriously good
<selfsigned> welp that cleverness worked against me
<zid> it's actually useful for a whole bunch of random things, shame it needs -mgeneral-regs-only
<zid> how useful it is for actual interrupts I am not sold on
<zid> but for random reverse engineered hotpatches and stuff it's great :P
<heat> you can't get a whole interrupt frame with pushed registers, etc
<heat> which sucks major ass
<zid> what pushed regs
<selfsigned> it does yeah
<zid> x86 doesn't push regs on exceptions
<selfsigned> thought I'd be clever and now I have to scramble before my self-imposed tomorrow due date haha
<heat> x86 doesn't, but you must
<zid> Mine manually preserves the scratch regs
<heat> having a stable pointer to registers you can use to look at and change state is useful
<zid> but it does the caller saved sysv ones by itself, for obvious reasons
<zid> yea if you actually support task switching
<zid> kinda handy to have the reg-save already dealt with
<selfsigned> frame-eip++; just works™
<zid> now do idiv ebx
<zid> oh is this pmode?
<zid> wait that doesn't matter
<zid> I always forget that amd64 encodes with e regs by default still
<heat> yes, that sure as heck doesn't work
<heat> you're executing whatever garbage is the div's second byte
bauen1 has joined #osdev
<selfsigned> uh oh
<zid> seems there isn't a 1 byte div at all
<zid> it's f6 /7 and f7 /7 depending on div/idiv
<mrvn> The gcc interrupt handler only makes sense for interrupts, not for syscalls or exceptions. Why should the interrupt try to access the user register?
<zid> but ebx is the fun one because that makes the second byte 'sti'
<heat> f7 f1 look at this one, it could icebp accidentally
<zid> sick, icebp!
<mrvn> Note: If you save all regs on interrupt entry in the task struct and restore them all on exit from the task struct then all you need to do for multitasking is "current_task = next_task;"
<heat> heatbp when intel??
<mrvn> i.e. update the pointer to which task to restore
<zid> If you join valve you might be able to get a steambp
<selfsigned> free icebp noice
<mrvn> ARGS, now the sun is shining on my display again.
<selfsigned> I have to say, while being fun and formative this has been a good primer on why I should never be allowed next to a C compiler ever again.
<zid> You did okay on the C compiler part
<zid> it was the computer part
<selfsigned> True, it's harder to mess the computer part when you're never ring0 :p
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
wlemuel has quit [Ping timeout: 254 seconds]
<mrvn> one ring to rule them all and in the darkness break them, or something like that.
wlemuel has joined #osdev
<zid> heat: https://www.youtube.com/watch?v=meOYaYv9DsY This is the most portugal looking man I've ever seen
<bslsk05> ​'Cycling Across Europe Alone' by Bernardo Bacalhau (00:41:17)
nvmd has joined #osdev
slidercrank has quit [Ping timeout: 276 seconds]
<heat> naw
<heat> sure as hell sounds very portuguese, but doesn't look like one really
<zid> sure he does, swarthy france
<zid> = portugal
<selfsigned> Could be both in all fairness
<heat> portuguese people aren't really swarthy
<heat> not as much as this guy at least
<zid> he's swarthy
qubasa has quit [Remote host closed the connection]
<heat> hmm actually upon further inspection your guy is also similarly swarthy
<heat> seems like I just jumped to a shitty angle in the vid
<heat> in any case the rest of his features do not match up with portuguese
<zid> yea he's much too handsome
<heat> portugal the woman
<gog> i bet she's hot
* lav hears hot woman
<heat> where i s hot woma
<zid> heat uses hot women to bait his footballer traps, presumably
gog has quit [Quit: Konversation terminated!]
CalculusCats has quit [Quit: Meow Meow Meow Meow Meow Meow Meow...]
CalculusCats has joined #osdev
qubasa has joined #osdev
danilogondolfo has quit [Quit: Leaving]
bauen1 has quit [Ping timeout: 276 seconds]
<sakasama> So they're a country and they don't even care which one it is? Portugal must be so proud.
<zid> who's a country?
wootehfoot has joined #osdev
<mjg> you were nicer forlk before puberty
awita has joined #osdev
<sakasama> zid: It's the band's explanation for their name.
awita has quit [Remote host closed the connection]
<zid> portugal is top of my list to be fair
<zid> of countries I think I stood a fair chance of me stealing their name and having everybody else go "yea okay then"
bauen1 has joined #osdev
slidercrank has joined #osdev
<bslsk05> ​i.imgur.com <no title>
<netbsduser```> finally xeyes on my os
<netbsduser```> this is what i have been waiting for
<jimbzy> You have arrived.
<sham1> It's all that's needed
wootehfoot has quit [Read error: Connection reset by peer]
<mjg> nice!
<mjg> it is the endgame innit
dude12312414 has joined #osdev
dude12312414 has quit [Client Quit]
<zid> You can't fool me, that's linux
<netbsduser```> mjg: endgame is CDE
gog has joined #osdev
<selfsigned> whoah, how long have you been working on your OS?
<netbsduser```> selfsigned: january
<netbsduser```> though i inherited some components from a previous effort which lasted from may til august last year
<nortti> where can one get an image / the sources to test it out?
<selfsigned> :O I've been working on basic stuff for two months
<netbsduser```> https://github.com/Keyronex/Keyronex no guarantees it builds, i think it should
<bslsk05> ​Keyronex/Keyronex - The Keyronex Operating System (0 forks/24 stargazers)
<selfsigned> nice
<netbsduser```> it is certainly not a paragon of excellence in most respects, lately i became quite obsessed with xorg and fired out the most minimal, hacky implementations of what it depended on to get it to work. i need to spend a while to clean up everything related to that
<netbsduser```> on the other hands, the parts i carefully planned out from the getgo have proven quite robust
<zid> what graphics driver are you using btw
<netbsduser```> xf86-video-fbdev, since it is so trivial
<zid> no I mean
<zid> in qemu
<zid> what hw is it emulating
<netbsduser```> oh, it's just the default framebuffer that limine retrieves through vbe/gop
<zid> qemuvideodxe I think then
<zid> the 'vga' backend
<zid> that's the default if you don't change it afaik
<nortti> hm, do I need to run some step before the make default target? xbstrap complains about missing bootstrap.link
<netbsduser```> nortti: make all should depend on make build/ which should set up xbstrap by mkdir'ing build and running xbstrap init .. in there
<nortti> ah, nvm, a previous unsuccesful attempt had created an empty build/ and it was failing on that
<netbsduser```> zid: i will look into virtio-graphics or whatever it's called some day i think
<netbsduser```> i like virtio
<zid> I don't like any of the graphcis options qemu provides :(
<zid> there's no sync on any of them as far as I can tell
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
linearcannon has joined #osdev
flx- has joined #osdev
Left_Turn has joined #osdev
flx-- has quit [Remote host closed the connection]
linear_cannon has quit [Read error: Connection reset by peer]
puck has quit [Excess Flood]
puck has joined #osdev
Turn_Left has quit [Ping timeout: 248 seconds]
<nortti> netbsduser```: https://p.ahti.space/81ddb3.html
<bslsk05> ​p.ahti.space <no title>
<netbsduser```> nortti: did your checkout include all submodules?
<netbsduser```> `git submodule update --init` or something like that
<nortti> oh, I just ran `git submodule init`, not really done much with projects that use submodules
xenos1984 has quit [Read error: Connection reset by peer]
<netbsduser```> the gnu smalltalk recipe will also probably fail later, it can be commented out
<netbsduser```> i had to hack its makefiles up quite considerably to get it cross-compileable and i doubt it will reproduce
Gooberpatrol66 has joined #osdev
<heat> just got new glasses
<heat> feels like i'm drunk, my vision feels so fucky
<heat> nortti, fyi git clone --recursive saves you from doing git submodule init
<nortti> ah, thanks
<heat> i'd like to try rust on Onyx but that would mean a dependency on LLVM :/
<heat> why do gccrs and rust_codegen_gcc still suck
<nortti> not really been looking into latter, what're the issues with that atm?
<heat> iirc at least it requires patches to gcc
xenos1984 has joined #osdev
dude12312414 has joined #osdev
innegatives has joined #osdev
<innegatives> Check out my 8086 emulator WIP, now it supports all kinds of INC insn: https://github.com/jafarlihi/core86/blob/master/src/main.rs
<bslsk05> ​github.com: core86/main.rs at master · jafarlihi/core86 · GitHub
pharonix71 has quit [Remote host closed the connection]
pharonix71 has joined #osdev
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
goliath has joined #osdev
bauen1 has quit [Ping timeout: 256 seconds]
<nortti> netbsduser```: https://p.ahti.space/7efe9f.html
<bslsk05> ​p.ahti.space <no title>
<heat> binary literals were a mistake
<FireFly> why? :o
<FireFly> ah the .rs file
<heat> yes
<heat> hot take: hex literals were also a mistake
<heat> decimal and octal, plenty of choices there
<heat> a classic of early C
<heat> heck even decimal is a bit of a stretch. octal >>>
<nortti> I think the only octal literal I've ever used intentionally is `0`
<heat> have you never used unix permissions :D
<nortti> from C code? I don't think I have
<heat> although I do like the classic "hmm these numbers look off, let me align this one with 0s"
<heat> smh
<heat> do you use the sys/stat.h constants?
<heat> or do you just not really mess with that in C
<Griwes> those are indeed heat takes
* Griwes is not sorry
<nortti> heat: constants
<nortti> though it is something that's rare for me to do from C code, yeah
<heat> Griwes, that joke was so dead that i'm grieving for it
* heat is not sorry
<Griwes> I don't think I got the memo that we're having a necromancer convention today
<heat> nortti, i hate how verbose those are :/
<heat> so between using Well Known unix permissions and S_IXUHFSUEHF | S_IOGRPSD
<heat> i prefer the Well Known magic numbas
bauen1 has joined #osdev
<Brain___> lastlog Brain
<gog> hi
<Brain___> uh... whered my slash go
<Brain___> hi gog
<Brain___> mrvn: i havent decided yet
<Brain___> re BEG,IN/END nested IF/ELSE
gog has quit [Remote host closed the connection]
Halofreak1990 has quit [Quit: Konversation terminated!]
nvmd has quit [Quit: WeeChat 3.8]
<heat> aw fuck this
<heat> randstruct is only available in C
<mjg> lmao
<heat> did you do this mjg
<heat> did you sway llvm devs to not implement this for C++ so Onyx doesn't get pessimized
<mjg> i was liek "hey bjarne, u kno wat wud b funny"
<mjg> then i told him how to fuck you over and bam
<mjg> done
<mjg> i did not thing he would go through with it
<mjg> think
<heat> you time travelled back to the 80s and said "yo bjarne, here's some of that berkeley stuff, you know what would be funny? object oriented programming in C" which set off this whole chain of events
innegatives has quit [Quit: WeeChat 3.8]
<mjg> i only passed the joint
<heat> in the alternative timeline everything is written in either lisp, perl or php
<mjg> what he did under influence is his responsibility
<mjg> maybe i should not have spiked it so much tho
<mjg> my bad
Burgundy has quit [Ping timeout: 276 seconds]
plarke has joined #osdev
<heat> Griwes, any insight on the randstruct thing on C++? is it due to the order of initialization?
<Griwes> heat, context?
<heat> LLVM supports randstruct (randomizes the layout of structs) for C, not for C++
<Griwes> order of initialization is lexical, not driven by layout
<heat> in theory I assume that you could totally shuffle the memory layout of structs without messing that up yeah
<heat> but the patches seem to have fucked around in clang/AST
<Griwes> I think the issue is that C++ allows compilers to reorder public/protected/private sections, but not members within them? I'd need to check but I think it was this way around
<heat> yeah but erm, in theory C doesn't allow for reordering either AFAIK
<heat> s/in theory//
<Griwes> there's been some papers to relax that, because some people wanted to add an attribute that'd say "respect alignments in this type, but pack its members the best you can to minimize padding"
<moon-child> huh strange
<heat> this is opt-in btw, you slap __attribute__((randomize_struct)) to a struct and that's it
<moon-child> could you get around that by saying public: T x; private: public: T y;
<moon-child> instead of public: T x; T y
<moon-child> ?
<heat> why do you come up with the depressingest ideas
<heat> profile-based randomization, now this?
<heat> smh
<moon-child> it's not me, it's c++
<moon-child> blame mjg
<bslsk05> ​reviews.llvm.org: ⚙ D59254 [RFC] Implementation of Clang randstruct
<heat> ok, so they just didn't bother + linuks kernal
<Griwes> blame JF for pointing out the larger number of things that would need to be supported for C++ :P
<heat> i was blaming mjg but now i'm going to blame jf
<heat> i'm mildly annoyed that my fcheck-new patch still hasn't been merged although I kind of pissed off for almost a year
<kof123> so how bout 'reviving cfront, then it would work? <stick figure running away>
<heat> lol
<Griwes> do not speak of such heresies
<heat> trivia:
<heat> given "Check that the pointer returned by operator new is non-null before attempting to modify the storage allocated. This check is normally unnecessary because the C++ standard specifies that operator new only returns 0 if it is declared throw(), in which case the compiler always checks the return value even without this option. In all other cases, when operator new has a non-empty exception specification, memory exhaustion is signalled by throwing
<heat> std::bad_alloc. See also ‘new (nothrow)’."
<heat> what do you think this option does?
<Griwes> treats all operator new overloads as noexcept?
<Griwes> you are asking the question, so I assume it does something insane
<heat> oh wow you got it right
<heat> listen, this option's description is batshit insane
<Griwes> lmao
<heat> it tries to imply that the compiler checks for null?
<heat> it does NOT
gog has joined #osdev
<heat> in fact, how the fuck would it even do that? if (ptr == nullptr) cry();?
* gog cries
<nortti> if (ptr == nullptr) __builtin_undefined();
* moon-child pets gog
* gog prr
<Griwes> I mean, if (ptr == nullptr) return nullptr; :V
<gog> ptr?
* Ermine ptrs gog
<gog> ptr? ?? return null;
* moon-child dereferences Ermine
<gog> actually i don't think you can do that in c sharp idk
<heat> severe rust vibes gog
* Ermine crashes and burns with EPERM
<heat> which I actually LIKE because Result works super well with that
<gog> std::optional
<heat> maybe we'll get this for C++30
<heat> we're getting std::expected
<gog> std::nullable<T>
<Ermine> std::expected is expected::std
<heat> expected is super nice but I have to admit that doing if (ex.has_error()) return unexpected<E>{ex.error}; is kind of tedious
<heat> hence the rust magic with the ?
<gog> c#
<moon-child> if err != nil { return nil, err }
<moon-child> ...or something idk go
<zid> Ok()
<Griwes> heat, just make it awaitable :)
<zid> (That is the dumbest thing ever, thanks rust)
<zid> Rust why can't you just be normal :(
<Griwes> (ab)using coroutines for things like optional and expected is a thing of beauty
<heat> oh I honestly have little idea on how coroutines work
<heat> I hear "heap allocated locals" and run
<Griwes> they're pretty nifty
<zid> the putty author has a nice article about coroutines
<bslsk05> ​www.chiark.greenend.org.uk: Coroutines in C
<Griwes> the heap alloc can be optimized out for synchronous cases like optional
<moon-child> zid: oh yea i saw that
<heat> does it know it's synchronous?
<zid> That's the only time I've ever wanted to write one, to keep state in a parser while it returns characters
<Griwes> but then IDK if clang finally fixed their 10-versions-old bug where they failed to optimize out most dynamic allocs
<moon-child> heat: see, you should really be blaming sgtatham
<moon-child> not me
<moon-child> for coming up with depressinging ideas
<zid> simon did nothing wrong
<heat> damn you sgtatham
<moon-child> except for that horrid coroutine hack
<Griwes> okay, it wasn't in the trunk for quite that long
<Griwes> and apparently they fixed it last year
<Griwes> yeah, so for cases like optional and expected you should see everything inlined and allocated on the stack
<Griwes> if you don't, file compiler bugs
<heat> btw the monadic stuff looks interesting though
<heat> wait, how does co_await help you here?
<Griwes> it's annoying, because a paper I'm ostensibly an author on gives a more generic way to do stuff like that (p2300, senders)
<Griwes> we're special casing the monadic optional/expected things with bad names
<heat> i'm all for simplified versions of things honestly
<Griwes> heat, https://github.com/toby-allsopp/coroutine_monad I think this is the most complete thing for co_awaiting those things?
<bslsk05> ​toby-allsopp/coroutine_monad - Using coroutines as sugar for composing monadic operations (5 forks/66 stargazers/MIT)
<heat> hmm
<heat> interesting
<Griwes> you can effectively get _almost_ rust's ?, except with the wrong precedence
<Griwes> I need to nudge a few people to write a paper to try to get a postfix co_await
<heat> I hate that I hate the co_ prefix
<heat> like, erm, just use await?
<Griwes> I used to hate it, now it's just fine
<Griwes> heat, the problem is yield, there's a function in the stdlib called yield
<Griwes> and it's not feasible to make these context sensitive
<Griwes> the committee really went through a massive number of attempts to get rid of the prefix
<Griwes> they all broke something
<heat> i think I would rather have await and co_yield than co_await and co_yield
<Griwes> I used to hate the prefix, but I have now achieved coroutine zen
<heat> yeah I erm, find them confusing honestly
<heat> kernel programming hasn't given me many attempts to use async stuff and coroutines
<Griwes> I dislike the word 'await' itself more than I dislike the prefix, I think
<heat> oh I like await, it's consistent with other languages
<Griwes> can't have that
<Griwes> but my problem with it is that it implies a stronger tie to asynchrony than actually exists
<Griwes> it feels very weird to 'await' on an optional
<heat> sorry, can't hear you, here's an entirely new programming paradigm :^
<Griwes> anyway, I'm planning to use probably coroutines in the async layers of my high level IPC library
<heat> but yes await on an optional is weird
<Griwes> very possible that it'll turn into using senders and not just plain coroutines, but since senders are awaitable and awaitables are senders, it doesn't really matter all that much
<heat> it's not like it's anything that entirely fucked to parse given the rest of C++
<Griwes> yeah, adding a new postfix operator shouldn't be that hard
<Griwes> especially when it'd literally just be sugar for co_await I guess, not its whole new thing
<heat> oh no not that
<heat> just make it do stuff like implicitly return from the current func with the result of T::operator?
<heat> and then expected would have like "unexpected<E> operator?() const {return error;}"
<heat> this would be the painlessless way to do things IMO
<heat> hmm no, maybe make it conditionally return?
<Griwes> that'd need a lot more than just one thing, it'd need "do I return?" "what's the error?" and "what's the value", and would also not help in the general coroutine cases, where we definitely need a postfix operator, and it needs to be able to suspend the coroutine
<Griwes> anyway, coroutines are nice :P
<heat> i dont like coroutines very much, sorry
<heat> the hidden heap allocations spook me
<heat> i'd be totally fine if this was all compiler magic as well, C++ needs more compiler magic
<heat> say "? only works with std::expected and std::optional" and i'm ok with that
<Griwes> that'd still end up being implemented as hooks for the stdlib, and people would just look at the hooks for those and hijack them for their own types ;p
[itchyjunk] has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<heat> like the horribly automagical __builtin_source_location or whatever you called it?
<heat> (which I should try to abuse one of these days)
<Griwes> oh, source location is beautifully abusable
<Griwes> especially with coroutines xD
<Griwes> all co_awaits check for an await_transform function in the promise
Left_Turn has quit [Read error: Connection reset by peer]
<Griwes> and that can take defaulted arguments... including source location, so you can track exactly where you co_awaited things
<Griwes> it's great
<Griwes> but yeah, compilers generally just provide low level hooks and let the stdlib wrap that
<Brain___> there, thats this evenings mini project done
<bslsk05> ​github.com: Home · brainboxdotcc/retro-rocket Wiki · GitHub
<Brain___> PUSH/POP instructions. i had a whole load of FOR X = 0 to N : ARR(N) = ARR(N+1) : NEXT in my basic code, didnt make sense to be doing this in basic when i can offer a close-to-native performance opration on the array
<Brain___> its made the irc program's scrollback much faster
<Brain___> and the code shorter, too
<gog> shorter code is better
<gog> deleting code is good
<zid> That's why I never produce any code, I am a master programmer
<zid> who has transcended writing any code at all
<zid> it gets deleted before I write it and is therefore perfect
<gog> his argument is flawless
<gog> QED
<Griwes> shorter code is better? *APL has entered the chat*
<gog> column-wise shorter
<gog> variable names are single letters
<gog> if you need two letters you need to refactor
<zid> tbh if you have more than 26 variables in-scope
<zid> you fucked up
<gog> i can name several methods in the code base i work on that are fucked up in this way
<gog> i've chopped a few of them up
<zid> web stuff uses fucked up languages where the entire universe is in scope at all times though
innegatives has joined #osdev
<gog> web stuff is just fucked up
<zid> yea it follows
<innegatives> Aux carry flag is defined as carry or borrow out of the 3rd bit of the result, does this basically mean it's set if 3rd bit changed from 0 to 1 or from 1 to 0?
<zid> "lots of things in scope is bad" "web languages force everything into scope" QED
<zid> web is bad
<innegatives> all you need to update flags of 8086, is just a function that takes in value before the instruction and after the instruction, right? you don't need any other input to determine all of the flags results?
<kof123> 8086 aux? "This flag is used in BCD" "if a carry is generated out of the Lower Nibble" that sounds like bit 3 (the 4th bit, numbering starting @ bit 0)
<kof123> <guessing> 7654>>>3<<<210 BCD digit for each 4 bits
<innegatives> can you determine all of the instruction-affected flag values given just the operand value and the result value? i mean, instruction itself doesn't change how flag values behave right? it's all uniform?
<innegatives> hmm guess not, because to determine overflow you need to know if you were increasing the value or decreasing
<innegatives> but that's the only exception, right?
<Brain___> hmmmm
<Brain___> should i split my docs page into multiple pages? its getting a bit bloaty
<Brain___> it started off short like the readme, and now its a 700 line epic
<Brain___> and once you get a page or so down, you lose sight of the markdown TOC
<kof123> you sure its not necromancer day <j/k>
<Brain___> neuromancer day? oh wait...
slidercrank has quit [Ping timeout: 256 seconds]
innegatives has quit [Quit: WeeChat 3.8]