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
<mcrod> chaos is coming
<mcrod> don't worry
<heat> geist: O0 is funny. for clang it basically makes it into a braindead compiler
<heat> gcc is less stupid but still bad codegen overall
<heat> but for clang you can have something like "int foo(){int a = 10; return 20;}" and it'll create a stack frame, store 10, undo the stack frame, return 20
<geist> yah that's why i say just having a simple pass to get the basics is pretty useful
<heat> wow okay even gcc is doing it in this case
<geist> that was pretty much my experience, i just didnt feel like arguing a while ago
<Mondenkind> can't you tell llvm to specifically run some passes?
<heat> probably
<Mondenkind> mem2reg would do what you want here i think
<heat> not sure, the variable is unused
<heat> you don't need a mega-optimizer to look at this and say "oh wow this is not used at all"
<Mondenkind> mmm yeah but it would at least get rid of the memory accesses
<geist> right just simple dead code removal and expression collapsing
<Mondenkind> which are gonna probably be most of what kills you most of the time
cydox has quit [Ping timeout: 268 seconds]
<Mondenkind> probably most code isn't dead until you do other optimisations
<heat> i would probably need to run opt with mem2reg
<Mondenkind> so i doubt _just_ dce would buy you much for most code
<geist> i think the idea of assigning everyhting a stack slot and load/storing it is so that simple debuggers always have a reference to the variable
<geist> its here, on the stack, at slot X
<heat> what are these "simple debuggers" and are they in the room with us tonight
<Mondenkind> in llvm's case it's just because clang intentionally emits braindead code for simplicity knowing it will be cleaned up later
<Mondenkind> which is reasonable engineering wise, tbh
cydox has joined #osdev
netbsduser has quit [Ping timeout: 260 seconds]
<heat> well yes it is llvm's fault
<heat> llvm O0 is drastically clunky
<heat> what really annoys me is that cc defaults to O0
<heat> you can't do $(CC) *.c -o prog without adding a bunch of reasonable compile flags
<heat> because reasonable defaults are unreasonable
<geist> well, sure you can, and in a lot of cases prog works fine
<geist> it's just PESSIMAL
<geist> which most people dont care
<geist> so default to the fastest compile, with most debuggability
<heat> it's probably minimally pessimal because CPUs are maximally great at everything
<heat> except not having large chunks of microarchitectural state leak. they're not great at that
zxrom has quit [Quit: Leaving]
heat has quit [Ping timeout: 250 seconds]
valerius_ has joined #osdev
netbsduser has joined #osdev
<bslsk05> ​wiki.osdev.org: Emulator Comparison - OSDev Wiki
<chiselfuse> if we were to add Simics to this table, what would it have under the "Method" field?
<chiselfuse> i wonder why it's not listed
<bslsk05> ​www.cs.cmu.edu: 15-410 Documentation For The Enthusiast
<chiselfuse> i found this mentioning:
<chiselfuse> > QEMU obtains better performance than single-instruction intepreters such as Bochs or sub-instruction simulators such as Simics...
<chiselfuse> but i'm not sure what this means
netbsduser has quit [Ping timeout: 252 seconds]
air has quit [Quit: Client killed by user]
edr has quit [Quit: Leaving]
<geist> it's because qemu translates runs of instructions into the native instruction set
<geist> bochs interprets each instruction one at a time
<geist> and simics is i guess trying to emulate the full microarchitecture of the cpu
masoudd has quit [Ping timeout: 255 seconds]
<geist> though qemu doesn't really get near 1:1 performance, it's not too bad because of this translation effect, and it it not being a single instruction at a time
linearcannon has quit [Ping timeout: 264 seconds]
netbsduser has joined #osdev
Arthuria has joined #osdev
netbsduser has quit [Ping timeout: 272 seconds]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #osdev
air has joined #osdev
craigo has quit [Quit: Leaving]
air has quit [Client Quit]
netbsduser has joined #osdev
air has joined #osdev
netbsduser has quit [Ping timeout: 260 seconds]
Gooberpatrol66 has quit [Remote host closed the connection]
stolen has joined #osdev
netbsduser has joined #osdev
linearcannon has joined #osdev
netbsduser has quit [Ping timeout: 264 seconds]
Arthuria has quit [Ping timeout: 260 seconds]
vdamewood has joined #osdev
nanobot567 has joined #osdev
netbsduser has joined #osdev
bradd has quit [Ping timeout: 255 seconds]
bradd has joined #osdev
netbsduser has quit [Ping timeout: 268 seconds]
ThinkT510 has quit [Quit: WeeChat 4.2.1]
ThinkT510 has joined #osdev
nanobot567 has quit [Quit: Into the abyss I go!]
k0valski18891621 has joined #osdev
netbsduser has joined #osdev
netbsduser has quit [Ping timeout: 252 seconds]
Cindy has quit [Remote host closed the connection]
rustyy has quit [Ping timeout: 272 seconds]
rustyy has joined #osdev
Gooberpatrol66 has joined #osdev
pg12 has quit [Remote host closed the connection]
pg12 has joined #osdev
linear_cannon has joined #osdev
linearcannon has quit [Ping timeout: 260 seconds]
gog has joined #osdev
<chiselfuse> geist: i find no difference between what you suspected about bochs vs what you suspected about simics
<chiselfuse> if bochs tries executes instr by instr then it must be emulating the microarch
<geist> well, not exactly. an instruction at a time is not really emulating the stages of how a cpu would execute instructions
<geist> simics, i dunno much about it, may be doing sub instruction emulation, like the pipeline of the instructions
<geist> to get perhaps perfect timing
<gog> hi
<chiselfuse> hello
bauen1 has quit [Ping timeout: 246 seconds]
<geist> a gog!
<geist> good morning gog
<chiselfuse> geist: how about qemu? you said bochs does it instr by instr, does qemu do it by instr batch then? :P
<geist> it dynamically translates instructions to the host
<geist> and in runs of instructions
<Mutabah> or uses the host CPU's VM extensions
<chiselfuse> geist: wouldn't that be letting the host execute code of the guest instr by instr?
<geist> i'm assuming the host is not the same architecture
<geist> and indeed, if it's the same architecture and the host OS allows it, QEMU also serves as a virtual machine host
<geist> in which case the code is indeed running at full speed
<Mutabah> chiselfuse: qemu is usually a JIT - it converts blocks of code into host native instructions, then gets the host to run that block of code.
<Mutabah> in contrast to a simulator like bochs, that is a massive `switch` statement on the opcodes
<chiselfuse> Mutabah: switch to what? say i have `add eax, 5` on guest, can you give example for this?
<chiselfuse> just try to execute equivalent instr on host you mean?
<Mutabah> bochs would have something like `switch(opcode_byte) { case ADD_IMM_AX: regs->EAX += 5; update_flags(); break; ... }`
<Mutabah> while qemu would generate a block of native code that does the same thing, then jump to it
<Mutabah> the trick with qemu is that it translates lots of instructions in a go - maybe up to the next jump instruction, and then runs them in one batch.
<Mutabah> so, there's less overhead deciding what instruction needs to be run, and it can reuse that code generation if that same block is run again
<geist> and it's a block of code, in that it'll translate a run of instructions until it gets to some point where it has to make a decision
<Mutabah> (huh, that code would be `05 05`)
<Mutabah> sorry, `05 05 00 00 00` - forgot the zero bytes
<Mutabah> and really fancy JIT VMs like that can optimise the translated code, to remove unneeded calls - e.g. avoid updating flags if they aren't used.
<chiselfuse> i wonder if this Simics emulates the processors exactly with all possible hidden undocumented things
<chiselfuse> since intel develops it now
<chiselfuse> Mutabah: do you know instruction encodings by heart?
<Mutabah> No, I opened an emulator project I was working on ealier
<geist> yah i have written a few, but nothing recent
<chiselfuse> do you think i can get the full Simics?
<chiselfuse> they ask you to email them for that as far as i can tell
gbowne1 has quit [Quit: Leaving]
navi has joined #osdev
netbsduser has joined #osdev
<geist> good question
<geist> *probably* not but it doesn't hurt to ask
theyneversleep has joined #osdev
netbsduser has quit [Ping timeout: 256 seconds]
netbsduser has joined #osdev
theyneversleep has quit [Remote host closed the connection]
GeDaMo has joined #osdev
npc has joined #osdev
netbsduser has quit [Ping timeout: 252 seconds]
<mjg> have you NERDS seen the fallout tv show?
<gog> i'm not a nerd
<mjg> 's why i was not asking you mate
<mjg> anyhow i'm 6 episodes in (out of 8) and it is pretty decent
<gog> maybe we'll have to put it on our list
<gog> i've heard it's good
<mjg> from what i read on the interwebz people who are really into the franchise like it
<mjg> personally i only played fallout 1 and 2, and even then it was liek 20 years ago
<gog> i've only really played new vegas
<gog> but i love it
<gog> it's one of my fav games
<mjg> mon totally chheck out OG stuff
<mjg> you are old enough to be fine with 2d graphics
<mjg> :d
<gog> true
<mjg> anyhow they got the art style right afaics
<zid> I really like fo1, my friend really likes fo2, we do battle tomorrow at dawn
<gog> swordfighting in the denny's parking lot
<mjg> i have no idea how true it is to newer games
<gog> i've never played fo4
<gog> or 76
<zid> fo4 is weird, it's a nice little evolution on fo3's gunplay systems
<zid> but the story gets 3/4 of the way finished then just... stops
<zid> The big reveal is about to happen
<zid> then the guy who would reveal it doesn't, and it ends
<zid> so if people ask if they should play it I just say play it until you get bored of shooting things / building your rpg character, then stop
carbonfiber has joined #osdev
<zid> as we all know, the correct game to put lots of hours into is balatro
<gog> i lost a run on ante 7 this morning
<gog> i could only win with a flush of clubs
<zid> I lost to the final boss yesterday, whoopsie, I had a trash deck though
<zid> surprised it got as far as it did
<gog> yeh i was playing with a pretty bad set of jokers
<zid> I'm mainly just looking for my final legendary joker though to finish my collection tab
<gog> noice
<zid> I had erm, +1 mult per tarot, and stencil
<zid> :P
<zid> and didn't get any good celestial cards for the hand I was playing
<zid> so I was.. weak
<gog> oof
<zid> having to do things like hold justice in hand to pump store
<gog> stencil is good for like the first few rounds
<zid> stencil's kinda good midgame
<zid> early it's too weak imo because you have no flat +mult yet
<gog> true
<zid> midgame is good if you like, get a couple of good celestials for some flat, then pair it with say, 1 money joker and 1 mult joker
<zid> but if you don't get the celestials or a good money joker it.. rapidly murders you
<zid> I held on by the skin of my teeth to the final boss with some tricky tarot card banking
<zid> I've beaten all the challenges and unlocked everything now, except for 1 legendary joker (ironically, probably the best one)
<zid> and beaten gold stake on a deck
<gog> wow
zxrom has joined #osdev
netbsduser has joined #osdev
<zid> if you suck you probably just have POOR MONEY MANAGEMENT
<gog> yes
<gog> i do IRL too'
<zid> Just get to 25 asap and stay above it and game is ez
<zid> and don't skip much
<FireFly> just win and it's easy to win
<zid> just forget to lose
<gog> never lose
<gog> losing is for losers
<gog> if you lose you're a loser
<gog> and that's a permanent condition you can never change
<zid> That's how I beat bosses in dark souls, just keep my hp above 0 duh
<gog> roll
<zid> rolling is MID
<gog> so am i
<zid> man, I wanna play sekiro again now
<zid> hot tip btw, flushes are trivial to make and a flush with a couple of high cards gives just above 300 points, makes seeing the first shop trivia
<zid> then you can just restart if it's shit if you like
<gog> you need 75 points x4 for a flush to get you max monies
<gog> that's pretty easy
<zid> yup
<gog> a flush is 35x4
<zid> so you need 40 from the cards you played, two bigs and 3 littles
heat has joined #osdev
<heat> i fell asleep watching a video on my watch later playlist
<heat> woke up watching a vid about readahead
<heat> fuckin youtube (it's not youtube's fault)
<zid> gog: got an okay start
<zid> polychrome baron = lol
<gog> ooh
<gog> that's a good fucken joker
<heat> what is this, poker for nerds?
<gog> heat: yes
<zid> with burnt joker too so I can upgrade high card once per round
<gog> polychrome burnt joker
<zid> yep :D
netbsduser has quit [Remote host closed the connection]
netbsduser has joined #osdev
<zid> haven't had a single hanged man though, rip
<zid> fuuck, legendary joker, wrong one
<gog> i need to write a heap impl
<gog> fuck me
<gog> every time i get somewhere i need to do something else
<heat> slab slab lab slab slab
<heat> slab
<heat> slab
<gog> slab deez
<zid> ez life
<gog> neat
<zid> LOL blueprint
<zid> 2nd legendary, got it, done, fuck yea
stolen has quit [Quit: Connection closed for inactivity]
<netbsduser> what sort of heap gog
<gog> like malloc()/free()
<gog> memory heap
<netbsduser> who for?
<gog> myself
<gog> NIH
<heat> slab slab slab slab slab slab
<heat> or slub
<heat> slub slub slub slub slub
<heat> slub on deez nutz
<netbsduser> what sort of code will consume it? i hate malloc() and free(), most programs could be more specific about what they need to allocate and they could provide the size at free-time
<gog> userspace code
<heat> wait, userspace?
<gog> USER SPACE HEAT
<heat> slab is probably not a great choice then
<zid> last pic gog
<netbsduser> if you're NIH'ing the userspace code too then you could expose a slab allocator (called the queen of kernel memory allocators) interface directly and make use of it
<gog> holy shit zid
<gog> yaaaas queen
<gog> heat i am not a slub
<gog> don't slub shame me
<zid> four steel kings with red seal pretty good with 4 copies of baron
<heat> slab is a horrible horrible choice for most userspace programs
<gog> i only have mmap() rn
<gog> but i don't need whoel pages
<gog> well, i do, but not for the specific thing i'm working on
<heat> slab is also called the queen of memory consumption, and that doesn't go hand-in-hand with userspace
<gog> no matter i have to start house cleaning anyway
vdamewood has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
heat has quit [Ping timeout: 250 seconds]
npc has quit [Ping timeout: 256 seconds]
<zid> mechanical pencils? In *MY* pencilcase? It's more likely than you think.
spareproject has joined #osdev
SGautam has joined #osdev
goliath has joined #osdev
duckworld has quit []
flom84 has joined #osdev
duckworld_ has joined #osdev
flom84 has quit [Quit: Leaving]
Rubikoid has quit [Ping timeout: 246 seconds]
<mjg> i finished fallout (the show), 8.5/10 from me
<mjg> provided you accept the whacky comedy
goliath has quit [Quit: SIGSEGV]
duckworld_ has quit []
randm has quit [Remote host closed the connection]
randm has joined #osdev
duckworld_ has joined #osdev
duckworld_ has quit [Client Quit]
duckworld has joined #osdev
xenos1984 has quit [Read error: Connection reset by peer]
CryptoDavid has joined #osdev
flom84 has joined #osdev
flom84 has quit [Client Quit]
xenos1984 has joined #osdev
masoudd has joined #osdev
craigo has joined #osdev
SGautam has quit [Quit: Connection closed for inactivity]
duckworld has quit [Remote host closed the connection]
duckworld has joined #osdev
duckworld has quit [Remote host closed the connection]
duckworld has joined #osdev
rutvik has joined #osdev
kof673 has joined #osdev
rutvik has quit [Remote host closed the connection]
carbonfiber has quit [Quit: Connection closed for inactivity]
<kof673> ACTION builds https://www-old.cs.utah.edu/flux/alchemy/cmi.html on freebsd 4.9 with ghc 6 package, verifies the knit binaries for freebsd 3.x run https://www-old.cs.utah.edu/flux/alchemy/software.html, and builds cmix statically http://www.ibiblio.org/pub/Linux/devel/lang/c/cmix.lsm, then verifies they all run inside 32M freebsd 5.4 read-only image https://web.archive.org/web/20050729010034/http://www.tinybsd.org/tinybsd/Download which runs in qemu
<bslsk05> ​www-old.cs.utah.edu: Alchemy: CMI
<bslsk05> ​www-old.cs.utah.edu: Alchemy: Software
<bslsk05> ​web.archive.org: Download - TinyBSD.org
<kof673> i don't think i will use knit, it has some kind of function renaming with elf but too fancy for me, but looked at it for "flattening" because i could not find cmi source until i found some backups
<kof673> then...can just make a build use scp stuff over (or nfs), run with ssh for example, and scp back the result (or nfs) lol
* Ermine slabs
<kof673> in any case, freebsd 3.x/4.x/5.x libc seems "interchangeable" at least for the above, symlink seems to work lol trying to build ghc is a pain, but that fbsd 4.9 package version works lol
<kof673> out of tinybsd/nanobsd/picobsd, > PicoBSD is a one floppy version of FreeBSD 3.0-current but alas, only runs static binaries, not sure ghc 6 has a package for that :/
<kof673> 32M is fine IMO, but linux maybe could make a smaller image easier
gildasio has quit [Remote host closed the connection]
gildasio has joined #osdev
heat has joined #osdev
tomaw has quit [Read error: Connection reset by peer]
<kof673> *not sure ghc6 can run on any version of freebsd 3.x, to build binaries against freebsd 3.x libc
<mjg> dafaq you doin mate
<kof673> they are just useful for pre-lto c compilers lol
<kof673> still need to add some gcc to the 5.4 image for cmix to work, but the generated sources should all be "generic"
<kof673> you should be able to just pass pre-processed C89 from anywhere, they do there thing, and "transparent' to whatever target/libc/headers/etc. you use, so long as it is c89-ish
<kof673> *their
<kof673> cmix spits out a program, that generates the "reorganized" (specialized) source so it needs a c compiler, to compile source it generates, that simply generates "generic" source lol
tomaw_ has joined #osdev
<kof673> if not, might still work if your target is "close enough" lol
tomaw_ is now known as tomaw
<kof673> well if you have dynamic linking or a way to load dynamic binaries/code...then you can get "specialized" code...so long as you write all the other pieces to make that happen, and have a way to invoke this at run-time etc.
<kof673> *assuming you only write c89
<kof673> :D
<kof673> modern toolchains should do everything cmi and knit "flattening" feature do, cmix is perhaps more useful (again, c89 only lol)
theyneversleep has joined #osdev
spareproject has quit [Ping timeout: 246 seconds]
<kof673> cmix oversimplified just lets you say for a function such as foo(int a) make a specialized version for foo(3) (and propagate this further for whatever else foo() might call with that variable). so...it is just nice to have that done automatically without editing the source at all, "losslessly" and "transparent" in a sense, you just tell it what to "specialize" and it outputs transformed source
<kof673> so, one piece to slowly build up synthesis os-alike in C89 lol
<kof673> you still need a compiler of course, and some way to invoke that to compile the specialized code, and then load it, and tell whatever code to use that specialized version when possible
Arthuria has joined #osdev
theyneversleep has quit [Ping timeout: 260 seconds]
npc has joined #osdev
<kof673> knit let you do like pseudo-OO stuff with C, and oskit might have stuff like that (or use it) but you have to write fancy "makefiles" or whatever language it uses to specify "relationships"
<kof673> so it has fine-grained dependencies/build system but too much work IMO
<kof673> but theory is you could specify different "backends" whatever to implement a component, and the build system would handle that
<kof673> *my understanding, may be way off
<kof673> and stuff for initializing components in a required order, etc.
<gog> hi
<heat> gog
<gog> heat
Arthuria has quit [Ping timeout: 260 seconds]
<kof673> there is nothing special, just does ghc 6.0 build on modern systems? cmix is written in old c++...... it is easier just to use an old os to run them IMO
<kof673> so just having a VM to keep around is easier IMO
<kof673> (old at least) ghc needs old perl, and mangles the output assembly for tail calls, and wants like gcc 2.95 preferably IIRC...so just finding an old OS version that these programs build on is key IMO :)
<kof673> i would prefer wasm or something of course, but this will work in the meantime lol
heat has quit [Ping timeout: 250 seconds]
nanobot567 has joined #osdev
<kof673> w2c2 (wasm to c89) i think is not quite c89 itself despite cliaming to be, not sure about the output, but cmi would be useful there for old compilers on old machines too
<kof673> or, ideally these "program transformation" programs would be a compiler plugin or something, and not target-specific, generic source code "transformers" :/
heat has joined #osdev
<Ermine> heat gog
<heat> Ermine
<gog> Ermine heat
<gog> c69
<heat> hehehe nice
<Ermine> the best language ever
<kof673> there was a person asking how to homebrew on ps1 a few days ago in another channel :D cmi is good if you are using old gcc, can even reduce code size substantially (you have 2M ram on psx normally lol)
netbsduser has quit [Ping timeout: 255 seconds]
netbsduser has joined #osdev
goliath has joined #osdev
gog has quit [Ping timeout: 255 seconds]
zetef has joined #osdev
nanobot567 has quit [Quit: Into the abyss I go!]
nanobot567 has joined #osdev
masoudd has quit [Killed (NickServ (GHOST command used by masoudd_))]
masoudd_ has joined #osdev
zetef has quit [Ping timeout: 246 seconds]
masoudd_ is now known as masoudd
<geist> gog Ermine heat
<heat> geist gog Ermine heat
<heat> rust 2069
<heat> i want to implement readahead
<heat> readahead sounds mysterious but the actual implementation of it (on linux at least, i dont imagine other unices to be too different) is super simple
hbag has quit [Quit: The Lounge - https://thelounge.chat]
npc has quit [Remote host closed the connection]
<bslsk05> ​hackaday.com: Git Good, By Playing A Gamified Version Of Git | Hackaday
nanobot567 has quit [Ping timeout: 268 seconds]
<mjg> oh no
<heat> sorry i don't use git i use got
nanobot567 has joined #osdev
<geist> i haven't played it but it looks cute
<mjg> does it showcase legit uses though
<mjg> or does it facilitate the usual spaghettification of the repo
<mjg> really the biggest problem with git is protecting beginners from themselves
CryptoDavid has quit [Quit: Connection closed for inactivity]
masoudd has quit [Ping timeout: 246 seconds]
<geist> most of the beginner issues i've seen that are bad are not in the commits or how they do it, but in the local state. like starting a cherry pick, rebase, etc and then comtinung to work
<geist> the local index getting all fucked up
<mjg> dude
<mjg> total classic is the following: person makes a change on master, does git pull, that results in a spurious merge commit
<mjg> and they push that
<mjg> arguably does not make spaghetti, just garbage in git log
<geist> sure, but it's not fatal, it's just a silly merge commit
<geist> and yeah i 99% of the time force a rebase
<mjg> multiple by every person and every other commit they make
<geist> alas it's pretty much the default pattern on github with pulls
<mjg> i was part of a project so riddled with this shit i felt SAD
carbonfiber has joined #osdev
rutvik has joined #osdev
navi has quit [Quit: WeeChat 4.2.1]
<Ermine> but does anybody use readahead?
<geist> i assume heat is talking about the fact that the OS silently readaheads for you
<geist> so that the data is already cached and ready to go
<Ermine> Ah, probably
heat has quit [Quit: Client closed]
<Ermine> I thought about its explicit version
Arthuria has joined #osdev
<Ermine> Aand systemd dropped its support for quite a while ago
heat has joined #osdev
<mjg> makes you wonder how effective is it tho
<heat> how effective what is
<mjg> windows 98 on a modern pc
<heat> very
netbsduser has quit [Remote host closed the connection]
netbsduser has joined #osdev
rutvik has quit [Quit: Konversation terminated!]
<geist> oh that's true, heat could have been talking about boot time readahead
<geist> i guess we'll never know. heat is an enigma
<kof673> > download_ghc_600 This is a Windows Installer for Microsoft Windows 95, 98, ME, NT, 2000 and XP cmix i don't know...i assume "cygwin" would be an easy "port" :)
<heat> i was talking about the automagic readahead yeah
<kof673> *cygwin/mingw/whatever
<Ermine> i wonder if virtio-gpu supports directx somehow
bauen1 has joined #osdev
nanobot567 has quit [Ping timeout: 260 seconds]
<heat> the vulkan one must
<Ermine> ?
gog has joined #osdev
<heat> ?
<Ermine> > the vulkan one must
gog has quit [Ping timeout: 255 seconds]
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
<heat> whats the question
gbowne1 has joined #osdev
hbag has joined #osdev
<geist> doesn't look like directly, but i suppose you could transliterate to vulkan or whatnot
nanobot567 has joined #osdev
Rubikoid has joined #osdev
navi has joined #osdev
gog has joined #osdev
navi has quit [Quit: WeeChat 4.2.1]
<heat> yes
hbag has quit [Quit: The Lounge - https://thelounge.chat]
<heat> you can do gl over vulkan, dx over vulkan (DXVK), even sometimes gl over dx (ANGLE)
masoudd has joined #osdev
Arthuria has quit [Ping timeout: 246 seconds]
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
masoudd has quit [Killed (NickServ (GHOST command used by masoudd_))]
masoudd_ has joined #osdev
leg7 has joined #osdev
zetef has joined #osdev
<leg7> yo
<leg7> I just made a GDT in order to manage interrupts and get user input but when I try to load the GDT my os crashes
<zid> whoopsie
<zid> also you need an IDT for interrupts
<leg7> I've tried debugging it but I'm not sure what to make of the qemu -d int output
<zid> does it crash on the lgdt, or afterwards?
<zid> post the -d int output somewhere would be useful
<leg7> I think it crashes when I reload the segments
<heat_> zid link your gdt decoder
<zid> shogun went down
<zid> I need to restore it somewhere else
<zid> 🪱 Animal #257 🐕‍🦺
<zid> I figured it out in 3 guesses!
<zid> 🟥🟥🟩
<zid> 🔥 2 | Avg. Guesses: 7
<zid> #metazooa
<zid> fuck
<bslsk05> ​metazooa.com: Metazooa
<zid> check_exception old: 0xffffffff new 0xd
<zid> 0: v=0d e=0000 i=0 cpl=0 IP=0008:0020043f pc=0020043f SP=0018:00206fc8 env->regs[R_EAX]=00000000
<heat_> lmfao what
<zid> That's the one we want, first exception
<zid> what's at 0x20043f
<zid> we took a gpf at that address
<leg7> So how do I read this?
<zid> you need to disassemble 0x20043f
<leg7> huhu
<zid> and tell me what instruction it is
<leg7> like break at that address?
<zid> -no-shutdown -no-reboot
<zid> x /1i 0x20043f I think is the qemu syntax?
<heat_> i use gdb
<leg7> I use gdb too
<leg7> it crashes at `mov ss, ax`
<leg7> when I reload the code segments
<zid> is that the first instruction after your jump label?
<zid> for jmp 8:pmode
<leg7> no
<leg7> I can push and send you the repo if you want
<leg7> it's pretty barebones
<zid> yea that works as long as it uses a sane build system
<leg7> I have a nix flake
<leg7> if you know what that is
<zid> not in the least
<leg7> is that a gigabrain way to say yes?
<zid> no, it means "Not even a little bit"
<heat_> nix is a build system and a package manager
<heat_> basically the worst of both worlds
<leg7> Ok sorry I'm not native
<leg7> I know "not in the slightest"
<leg7> and I thought that might be a refrence to that
<leg7> but the other way around
<leg7> anyways
<leg7> I only use nix to get the env setup
<zid> hmm why is emerge being fucky all of a sudden
<leg7> then it's a makefile
<zid> great, I like makefiles
<zid> and I can add -m32 where needed if needed or whatever
hbag has joined #osdev
<zid> I have capstone in use flags, app-emulation/qemu capstone.. but no capstone for qemu
nanobot567 has quit [Ping timeout: 255 seconds]
<bslsk05> ​github.com: GitHub - leg7/LigmaOS at gdt
<zid> force masked, weird
<heat_> >ligmaos
<heat_> >chad pfp
<heat_> fuck
<leg7> yeah sorry
<leg7> not sorry
<zid> hardcoded gcc somewhere *finds*
<leg7> also the repo is huge because I have pdfs in docs you don't need to clone that
<leg7> if you can even not include it
<zid> well I'm already editing it to work on my machine, too late
<heat_> can you dump your gdt as an array of 64-bit words
<heat_> in hex
<leg7> can I do that with gdb?
<heat_> yes
<leg7> ok I'll figure it out brb
<heat_> x/gx yourgdt
<zid> capital K in kernel threw me there heh
<leg7> :)
gildasio has quit [Ping timeout: 260 seconds]
chiselfuse has quit [Ping timeout: 260 seconds]
Left_Turn has joined #osdev
<zid> crap what's the option for as for 32bit elf
<leg7> According to gdb my gdt is 0 >.<
<heat_> wat
<zid> heat halp
<zid> what is -melf_i386 but for ld
<zid> oh I can probaly --32
<zid> err for as
<heat_> idk
<leg7> if you use the nix flake it will just work
<leg7> :)
<heat_> wait, /gx doesn't work
gildasio has joined #osdev
<heat_> try
chiselfuse has joined #osdev
<heat_> x/Ngx where N is the number of entries
<zid> x /2gx gogo
<leg7> my gdb gui won't let me select and copy the output
<leg7> is there a way to redirect it to a file?
<leg7> the output of the command
<heat_> >gdb gui
<heat_> i swear is this a troll
<leg7> listen friend
<leg7> it's a good gui
<leg7> gf2
<heat_> i can take the ligmaOS but "gdb gui"? cmon
<leg7> the guy who made it made an operating system too
<zid> I have a boot/os.bin is that good
<leg7> yeah
<leg7> I use the iso
<heat_> is gf2 what you get when you can't get a normal gf
<leg7> do run with qemu
<leg7> you can do make run it will run it
<leg7> `make run`
<leg7> ig yeah
<zid> Too lazy to unbrick my qemu's disassembler
<zid> I mean, I could, but I don't have your tools or i386 qemu
<zid> soI will run it by hand like I've done everything else by hand
<zid> it was small enough that I could just use my system gcc with a shit load of flags
<zid> looks semi-sane at least
<heat_> is this 32-bit or 64-bit?
<leg7> 32
<leg7> if you use the nix flake it will just work
<zid> but that's what the gdtr points to right, and not what's loaded to it?
<zid> as mentioned, I have no clue what that is
<leg7> I explain it in the readme
<zid> lgdt [blah] blah: dw 24; dd gdt1 or whatever yea?
<leg7> it's what you end up using when you're tired of waiting for emerge on gentoo install n10
<zid> oh hey it worked
<zid> why would I wait, I have a cpu
Arthuria has joined #osdev
<zid> is this good
<heat_> ok zid i assume you have this
<heat_> good luck
<leg7> shit how do I copy paste in this
<zid> no gdt loaded though
<leg7> sorry for my clumsiness
<zid> wait, one is loaded
<leg7> first time using irc
<zid> v
<zid> GDT= 000cb2b4 00000027
<leg7> yeah that's what the os looks like
<zid> or is this the grub one
<zid> it's at a low address
<zid> I am at 94aeeb510, add vgatextmode
<bslsk05> ​github.com: hsd/usr/sys/stand/gdt.c at master · heatd/hsd · GitHub
<heat_> leg7, make sure your gdt kinda looks like this
<leg7> well don't we have the adress of the gdt in the interrupt dump I posted?
<zid> where is usr/sys/stand
<heat_> your gdtr limit is wrong
<zid> I have kernel/ and libc/ and kernel/ contains like.. Kernel.c and multiboot.s
<heat_> isn't it?
<zid> this might be the one from grub?
<heat_> i'm talking about their -d int dump
<leg7> are you on the gdt branch?
<zid> ah okay will do
<leg7> I didn't push to main
<leg7> kernel/memory
<leg7> is the limit the size?
<heat_> size - 1
<zid> oh I have to merge my Makefile changes nooo :P
<leg7> Did I not do that?
<leg7> oh
<heat_> qemu is showing a power of 2
<heat_> well, even number
<heat_> you should see my gdt code i promise i dont enforce the GPL on GDT code
<zid> nice, makefile is way better in this branch
<leg7> Well ok the size/limit was wrong but it's still crashing
<leg7> don't worry my code is gpl too
<heat_> ok then see my code
<leg7> Did you see what my gdt looks like?
<leg7> from the earlier screenshot?
<heat_> yes but im not decoding it
<leg7> ok
<heat_> even more so because you gave me a screenshot
<heat_> like seriously what
<leg7> I'm sorry
<heat_> your GDB GUI doesn't support copy pasting
<heat_> everything around the 5f bits looks wrong
<heat_> 0x00CF9A000000FFFF <-- this is a valid 32-bit CS
<zid> I'm re-fighting my tools, it's weirdly going worse the second time around
<zid> some 64bit .o is sneaking in somewhere and idk where beacuse it's doing it through tmp
<heat_> the 'a' nibble being the cs gdt segment type, and the rest being... a bunch of flags
<leg7> here's how it looks like
<leg7> maybe I got the masks wrong
<leg7> either that or the nasm function is incorrect
<zid> I am being dumb or something
<kof673> https://www.gnu.org/software/ddd/ DDD--A Free Graphical Front-End for UNIX Debuggers [...] (Informatik-Bericht No. 95-07, 7 August 1995) <-- that has been around forever, but i never bothered, plus...motif.... :/
<bslsk05> ​www.gnu.org: DDD - Data Display Debugger - GNU Project - Free Software Foundation (FSF)
<kof673> *the arrow is pointing at the 1995 date for the article
<zid> gcc -T linker.ld ./build/kernel/Kernel.o ./build/kernel/memory/Gdt.o ./build/kernel/graphics/VgaTextMode.o ./build/libc/string/string.o ./build/kernel/memory/Gdt.nasm.o ./kernel/multiboot.s -o isodir/boot/os.bin -ffreestanding -nostdlib -ggdb -no-pie -Wl,-melf_i386
<zid> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: i386:x86-64 architecture of input file `/tmp/ccc0Zo9k.o' is incompatible with i386 output
<zid> why tmp, like I passed -pipe even though I didn't, and where is the 64bit .o sneaking in
<zid> I literally did find . -name "*.o" | xargs file and they're all 32
<zid> the also your run to build .o from .s seems like it isn't being used
<zid> rule*
<heat_> found it
<heat_> ./kernel/multiboot.s
<heat_> pass -m32
<zid> oh did I not have -m32 in that one, just the cflags one.. fuck
<leg7> the gas compiler needs -m32?
<zid> there we go
<zid> check_exception old: 0xffffffff new 0xd
<zid> 0: v=0d e=0000 i=0 cpl=0 IP=0008:000000000020042f
<zid> huzzah
<leg7> so that fixed it?
<leg7> It's still closing for me
<zid> sigh how do I make qemu not use port 1234
<leg7> for gdb?
<zid> my machine's been hacked and something's already listening on 1234
<leg7> in my makefile I change it
<leg7> also I have a .gdbinit that will setup gdb up
<leg7> setup gdb*
<leg7> if you open gdb in the src/
<zid> I just moved my ssh tunnel, easier
<zid> than recompiling qemu
<leg7> It's just an option
<zid> what
<zid> -s makes qemu listen on port 1234
<zid> I need it to *not do that*
<leg7> qemu-system-i386 -cdrom $(OS_ISO) -S -gdb tcp::26000 -no-shutdown -no-reboot -d int
<zid> oh really?
<zid> fuck
<leg7> if you do `make run` in one terminal it will execute that
<zid> I do not have
<zid> qemu-system-i386
<zid> or an iso
<leg7> and open gdb in another while in src and it will auto connect
<leg7> I'm sorry I thought you were debuggin my os
<zid> I am.
<leg7> oh
<zid> I do not have your weirdo tools.
<zid> I have 64bit qemu, because.. why wouldn't I
<heat_> how do you not have qemu-system-i386?
<heat_> those two are usually packaged together
<heat_> like, x86_64 is literally just a superset
<zid> packaged? lol
<zid> fuck, I don't have i386 gdb
<leg7> gentoo life
<zid> workedaround
<zid> why are you loading 8 into ss at all
<zid> this makes no sense
<leg7> I followed a tutorial
<zid> oh that'd do it
<zid> is cs loaded with 16 then?
<zid> nope, also 0x8
<zid> you're putting your code selector into cs, then putting your code selector into all other regsiters too
<zid> try putting the.. data selector into those ones
<leg7> shouldn't ebp+12 be the data selector?
<zid> idk, you're loading 8 into it
<leg7> I meeanm
<leg7> ebp+14
<heat_> why is this configurable at all?
<heat_> just hardcode it
<leg7> the tutorial I followed leaded ebp+16
<zid> I also cannot copy paste from gdb, heat
<leg7> but I think that's just wrong
<zid> cus layout asm is really really fucky
<heat_> using gdb tui is pebkac
<geist> they probably put the gdt pointer on the stack?
<leg7> because the params are 32 bit 16 bit 16 bit
<geist> and then did a lgdt or it
<zid> I should have used gef but idk if it supports 32bit
<zid> ebp+12 is '8'
<leg7> yeha
<zid> which is your code selector, seeing as that's what's in cs
<geist> oh i see loading the cs
<leg7> and since it's 16 bit shouldn't ebp+14 be 16?
<zid> info registers cs: cs 0x8 8
<geist> yah 100% of systems just use 0x8 0x10 there, (2nd and 3rd entry) and to load cs you just do a far jump to it, or you use a retf
<zid> that's 0.. can you push shorts in your abi?
<zid> +16 is 0x10
<leg7> What?
<leg7> why?
<zid> ebp+12 is 8, ebp+16 is 16
<leg7> does c code not push shorts?
<zid> it's not C that's responsible for this, it's the ABI
<zid> hell, in long mode you physically *can't* push chars, for example
<zid> no worky
<leg7> I mean gcc usses sys V abi?
<leg7> right
<leg7> and the sys V abi pushes shorts
<heat_> yes this is a sysv abi detail
<leg7> no?
<heat_> no
<leg7> damn
<leg7> ok
<leg7> but it still crashes with ebp+16
<leg7> I tried that earlier
<zid> where do I change that
<leg7> and tried it again
<geist> it's behavior of the stack, the cpu itself will align the stack when you push it
<geist> based on the mode its in
<heat_> your gdt is fucked, i'm telling you
<heat_> i told you to check my gdt, you didn't
<leg7> ok yes the stack is algined on 4
<leg7> I remember
<zid> if loading 0x10 also fails, that selector is broken
<zid> where do I edit it to try that
<heat_> the gdt looks nothing like a normal 32-bit gdt
<leg7> What do you want to edit?
<zid> I want to load 0x10 not 0x8, you seemed to have 'fixed' a stack misalignment bug somewhere
<zid> where
<leg7> you can edit Gdt.nasm
<zid> wher eis that
<leg7> kernel/memory/
<zid> ..naturally
<leg7> src/kernel/memory/Gdt.nasm
<leg7> change ebp+14 to ebp+16
<leg7> line 21
<leg7> char 22
<zid> loading ds with 0x10 faults
<zid> That selector is.. 0x5f8b000000ffff
<geist> i concur with heat_ . your gdt is probably broken, also did you make sure your lgdt is long enough?
<geist> the length part
<zid> it's 0x18 which is long enough for 3 entries right?
<geist> yah
<leg7> I'll push my changes
<heat_> yes but the entries are completely borked
<geist> (though i think it's -1)
<zid> it's off by 1 though
<zid> should be 0x17
<geist> but it being one byte too long should be fine
<zid> yea
<zid> I want my gdt.html back :(
<geist> so yeah lets get that gdt fix
<geist> leg7: did you derive the gdt from scratch or get it from somewhere else?
<leg7> I pushed the fixes
<leg7> so far
<leg7> I followed a tutorial loosely but I wrote some stuff myself
<geist> what about the contents of the gdt itself?
<geist> side note, what tutorial was it?
<leg7> I was trying to separate the access byte with bit fields but my solution wasn't that great so I copied the guys solution using masks and a macros
<leg7> osdev.org and a youtube guy
<geist> kk
<leg7> let me lookup the vid
<bslsk05> ​'Building an OS - 8 - Interrupts, IDT, GDT' by nanobyte (00:36:53)
<geist> i only ask because a sizable chunk of vids are completely wrong
<geist> lots of times the tutorials are done by folks that have only just figured things out so they pass on bad ideas
<geist> or bad advice. not all of them, but some of them
<zid> I don't have any valid 32bit selectors to hand, only 64 :(
<leg7> Ok I will keep that in mind
<zid> maybe I could ask grub
<Ermine> kavin rocks !!!
<geist> heats are good, for a second opinion: https://github.com/littlekernel/lk/blob/master/arch/x86/gdt.S#L42
<bslsk05> ​github.com: lk/arch/x86/gdt.S at master · littlekernel/lk · GitHub
<Ermine> (actually no)
<geist> that has both 32 and 64bit selectors
<zid> I'd have to convert to hex :P
<leg7> I always try to figure things out myself first but this gdt nonsense was too much I didn't understand the diagrams on osdev.org
<zid> 0xCF 0xF2
<zid> that'll do
<Ermine> heat_: geist called you good
<geist> well, like i trust whatver heat links from his own system to be solid and functional
<zid> The intel manual is better
<zid> than osdev wiki for *anything*
<zid> if it's in the manual, read it there
<heat_> dang, this is going to my grave
<heat_> <geist> well, like i trust whatver heat links
<heat_> just this part is good
<heat_> quicke veryone visit http://kernal.org/
<geist> are you making a soundbyte out of it?
<bslsk05> ​kernal.org: ArmageddonSoon.com
<geist> 'from his own system'!
<Ermine> I want to seize this domain
<geist> i only really link the LK one because i did go through a fair amout of effort to comment every bit in it, and i think it's fairly clear
<geist> or at least clear enough to cross reference with the intel or amd manual
<leg7> I have the intel manual in the repo
<leg7> it's in /docs
<leg7> I've used it a couple times
<leg7> But I couldn't find gdt stuff
<Ermine> you don't need to store it in repo
<geist> it's definitely in there
<geist> the gdt stuff
<geist> side note: sometimes for early bringup i find the AMD manual to be a bit clearer
<leg7> I know I don't neeed to put it in the repo but it's more convinient
<geist> especially GDT/IDT layout
<Ermine> and is your repo is public it may be illegal actually
<leg7> there is no copyright notice in it
<zid> it appears to work if I fix the gdt
<zid> because I managed to crash it somewhere that isn't that
<geist> also i find that sometimes going to a much older manual, like the 386 manual itself, to be clearer for some of these basic things
<zid> oh wait, no, I crashed it by running SSE2, whoops :D
<geist> since it filters out all the later cruft
<leg7> my experience so far is that there is so much legacy crap
<leg7> it's annoying af
<zid> It now crashes at lret on 0x200442 which is.. GdtLoadi686's return point?
<zid> hmm
<zid> the cs is unhappy I guess
Turn_Left has joined #osdev
<leg7> What did you change?
<zid> *oh* user and code are upside down in heat's thing
<heat_> i have code first yeah
<geist> entry 1 and 2 for code and data? sure
<zid> char fake[16] = {
<zid> 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xF2, 0xCF, 0x00,
<zid> 0xff, 0xff, 0x00, 0x00, 0x00, 0xFA, 0xCF, 0x00
<zid> };
<zid> :D
<geist> that's data code right? looks like the DPL is set to 3
<zid> oh right those are user
Left_Turn has quit [Ping timeout: 260 seconds]
<zid> should be 9s not Cs
<geist> yeah for 64bit there are layout requirements
<zid> yea I know, I've done it
<geist> iirc data has to go in front of code for reasons
<zid> You thought mine wasn't going to work
<zid> but it does
<geist> uh no?
<zid> yea, I remember it
<geist> ah it has seared into your mind?
<zid> but it turns out other layouts work if you don't care about the emulation segs
<geist> dissaproval from geist
<zid> no?
<zid> I just.. remember the convo
<geist> heh
<geist> back when we used to argue all the time
* kof673 inserts joke about doug16k bench marked and uses an optimized gdt and idt layouts
<heat_> no but his tables were all nicely aligned as the intel sdm recommends
<kof673> lol
<geist> heh yeah i remember that. aligning it so that the corresponding code/data entries are in the same cache line
carbonfiber has quit [Quit: Connection closed for inactivity]
<leg7> Is my `limitLow` correct?
<leg7> shouldn't it be one more
<zid> oops forgot m y null selector now
<leg7> to be 0xFF'FF'FF
<leg7> it's 65535
<leg7> but shouldn't it be 65536?
<heat_> no
<heat_> 65536 is 1 << 16 aka 16-bits
xenos1984 has quit [Read error: Connection reset by peer]
<heat_> 17-bits*
<leg7> 2^16 is the biggest value a 16 bit binary unsigned integer can hold right?
<zid> no
<Ermine> 2^16 - 1 actually
<zid> 2^16 is 1 then 16 zeroes
<geist> you want all 15 bits set, this 1<<16 - 1
<zid> like how 1e100 is 1 then 100 zeroes
<Ermine> 2^16 is 1 and 16 zeros
<leg7> ok my bad
<leg7> then limit low is correct
<heat_> the gang figures out modular arithmetic
<leg7> base is correct too
<heat_> quick, find the inverse of 10 mod 2^16
<Ermine> it doesn't exist
<leg7> limitHigh is correct too because 15 is 2^4 - 1
<zid> I think I got it running btw
leg7 has quit [Remote host closed the connection]
<Ermine> 10 and 2^16 are not coprime
<zid> I can confirm that the ebp+16 fix, and then fixing the gdt entries, appears to cause it to run, at least, if he comes back
<heat_> Ermine, NERD
<heat_> yeah i was taking a piss and realized that you can't multiply 10 by any number and get an odd number
<Ermine> Yes, as in 'math faculty student'
leg7 has joined #osdev
<leg7> hey
<leg7> sorry I closed irc by accident
<Ermine> it's been a while
<leg7> and didn't know how to log back in
<leg7> Did you say you got it working?
<zid> it appears to work? it stops crashing at least
<zid> if I fix the gdt entries (with that ebp+16 fix)
<leg7> So you just pulled my fixes and it works?
<zid> no?
<leg7> It still crashes on my end
<leg7> oh
<zid> I changed ebp+14 to ebp+16, then fixed the gdt entries
<leg7> What did you change in the entries?
<zid> idk because I didn't use yours
<zid> I just hardcoded some filled out ones
<leg7> ugh
<leg7> ok
<zid> (qemu) x /3gx 0x202018
<zid> 0000000000202018: 0x0000000000000000 0x00cf9a000000ffff
<zid> 0000000000202028: 0x00cf93000000ffff
<zid> it appears to be happy with these, I stole them from grub
<geist> yep, i recognize those as the defacto 0x80 and 0x10 for DPL 0 32bit
<zid> okay so the machine with gdt.html was on AWS
<heat_> mine didn't work?
<zid> and the backup script wasn't working and the AWS was.. no longer being paid for, so the machine disappeared
<geist> cf9a and cf92 usually, though. but that's to do with the A bit
<zid> heat_: no but maybe I had them upside down
<geist> cf93 has the A bit set that i dont have in my GDT
<heat_> yeah A gets auto-set
<zid> yea they had the A bit set after them having been used to boot grub
<zid> so when I stole them from grub, I got it
<geist> ah makes sense yeah
<heat_> although it's important to have A set beforehand if the GDT is in rom
<heat_> otherwise historically a bunch of intel cpus have just hanged
<geist> yeah was looking it up before i opened my mouth and thought A was 'accessed' vs some alignment thing or something
<zid> 200441: eb fd jmp 200440 <_start+0xb>
<geist> but the A bit doesn't get set for code segments?
<zid> that's where I get to, apparently, seems legit
<zid> while(1) asm("hlt");
<leg7> am I supposed to read those hex codes as little endian?
<geist> yes
<leg7> ok
<Ermine> are there embedded x86 devices which could have gdt in rom?
<zid> The 1gx output is read from memory as though it were little endian yea
<geist> those numbers match with link from my stuff: https://github.com/littlekernel/lk/blob/master/arch/x86/gdt.S#L43
<heat_> Ermine, every x86 firmware ever
<bslsk05> ​github.com: lk/arch/x86/gdt.S at master · littlekernel/lk · GitHub
<zid> so my flat arrays are 0xFF 0xFF 0xFF ..
<geist> with the numbers broken out
<zid> 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9A, 0xcF, 0x00,
<Ermine> heat_: ok, but soomething except motherboard firmwares?
<zid> 0x00cf9a000000ffff
<geist> notably 0b10011010 (0x9a) and 0b10010010 (0x92)
<geist> bit 3 being the code vs data segment
<leg7> well I have 9b instead of 9a
<zid> should I just re-make my gdt tool
<heat_> yasss queen
<zid> okay heat volunteered
<leg7> and 5f instead of cf
<leg7> what the fuck
<zid> 5f is definitely wrong :P
<leg7> what is the command to print out the hex values in gdb again
<leg7> so I am sure not to make mistakes converting
<zid> x
<zid> then /, then how many, then what size, then in what base, so /32bx or /3gx
<zid> for bytes of hex, giant-words of hex
<zid> x for examine I think
<leg7> can't copy paste still fml
<Ermine> > hsd
<Ermine> heat_, are you developing another os?
<leg7> 0x005f9b000000ffff 0x005f8b000000ffff
<zid> 5F is 01011111
<heat_> Ermine, i have 3 operating systems
<zid> That means.. DPL 2, type 1111
<leg7> dpl is ring?
<zid> yea
<zid> descriptor priv level
xenos1984 has joined #osdev
<zid> 325462-sdm-vol-1-2abcd-3abcd.pdf page 3159
<heat_> Ermine, hsd is basically my attempt at a early BSD clone with cryptic code
<heat_> it's also 32-bit only
<Ermine> woah
<leg7> I don't understand how my entries can be 9b
<leg7> I'm literally oring with GdtEntryAccessRing0
<zid> hrmph I wanted to go back to reading my book but I've gone blind
<leg7> which is 0
<Ermine> heat_: so you liked bsds in the past?
<zid> https://github.com/zid/boros/blob/gameboy/gdt.c#L74 Yea the lstar crap makes the user ones upside down, how rude
<bslsk05> ​github.com: boros/gdt.c at gameboy · zid/boros · GitHub
<heat_> Ermine,
<heat_> oops im stupid
<heat_> Ermine, no hsd is pretty recent
<leg7> So the 9b part is just me setting the "accessed" bit in the access byte
<leg7> if I don't set it it's 9a but still crashes
<geist> leg7: what types are all those constants?
<leg7> u8
<geist> i get the idea what you're trying to do there with the very structured way, but sometimes that gets in your way
<leg7> yeah I realized
<leg7> I would like to know why it doesn't work though
<geist> i dont have your code in front of me but if you're trying to merge them into a larger word it could get clipped off?
<leg7> last problem should be the flags
<geist> i'd go back and super double triple check all your constants
<leg7> Yeah I'm doing that
<zid> ULL them
<leg7> so far the access byte and flags seem gucci
<geist> paste a link please
<leg7> I mean not flags
<leg7> I'm checking flags
<geist> to the constants that is
<zid> and tbh, you'd b e better off just writing these in a normal desktop program
<zid> then printfing them at the end
<zid> *then* add the code to your OS
<geist> and the comment how you got them, so future you knows how to deal with it
<zid> It's very blazé to do it in-kernel with limited debug functionality, when it's so easily tested otherwise
<geist> that's usually my take, if it's a single one time thing, like the GDT, there's not a lot of purpose building a whole infrastructure to synthesize the constants
<leg7> This is my first OS so I supposed I would need it later
<geist> hmm, those bitfields may be doing it
<geist> are you sure the two 4 bit fields are sorted that way?
<zid> Those all need extending to ULL if you shift them btw
<geist> re: flags and limit 19:16
<leg7> wdym sorted?
<geist> well, bitfields are ABI defined how they pack
<zid> A then B, or B then A
<geist> right
<geist> tis why *usually* it's not a good idea to use them for hardware, though if it's for exactly the same architecture, it's probalby more okay, provided you figure out which way it's doing it
<zid> and if you do `some_u8 << 32` that gives 0
<zid> you need some_u8 to be an unsigned long for big shifts, just fyi
<geist> so you might need to do flags before limit in your GDT structure
<geist> zid: they're not using anything larger than 8 in this case, so shouldn't be an issue
<zid> I can't really read it right now, so I'm just throwing shit out
<geist> i'm specifically talking about
<geist> u8 limitHigh : 4;
<geist> u8 flags : 4;// defined like access
<zid> I'm having a migraine so I can't see most of my screen
<geist> in the packed GdtEntry struct
<geist> zid: ugh, i'm having more of those lately. i tried to code the other day while having an vision migrane
<geist> no bueno, can watch lightweight youtube vids
<zid> I got a bunch of them when I was a teen, then they went away for a decade or two, now they're back
<geist> scintillating scotoma
<zid> yep
<geist> yah i get one maybe once a month or so. no obvious cause
<zid> I got precisely 0 in my 20s
<zid> but have had them in my teens and 30s, odd
<geist> oh i didn't get my first one until i was like 40
<leg7> Well when I read the values with gdb it matches what I did with the or operation so I don't think bitfields are a problem
<geist> when the lightning bolt crosses the center of my vision i basically cant read anything, but otherwise it's mostly annoying
<geist> but usually moves off my vision in about 30 minutes
<geist> leg7: so what value did you read from gdt?
<leg7> Well I posted a screenshot a couple times I'll post it again
<geist> yyah i'm really not going to try to go back and figure out what the last, correct, screenshot is
<zid> I'd probably just do it in reverse in userspace
<zid> data = 0xcf9a...FFFF; then dump all the fields back out and make sure they have the bit pattern I expect
<geist> but yeah it checks out. from what i can read fro the gdt.h file
<geist> aside from the bitfield
<Ermine> Libbsd release notes: > fix build on gnu/hurd, > fix build on musl
<zid> I actually had a bug in my gdt.c where I was offset by 1 bit, didn't find at first because the bit I fucked up was 0 and supposed to be 0
<geist> huh nice that it givces you decimal and octal
<zid> I needed to change it to a 1 later on and suddenly nothing works right for no reaosn :D
<geist> really helpful :)
<leg7> I'm a brainlet so octal doesn't help
<zid> geist is old enough to own a VAX
<zid> so he cares about octal
<zid> everybody under 50 doesn't
<geist> anyway it's '5f' instead of 'cf'
<geist> now the question is why....
<geist> that's in the flags field, lie it's shifted over 1 bit
<leg7> yep
<zid> There are some big shifts in there, which I was worried about, but they all go right so fuck it, unless base is a u16 etc
<geist> oh also bit 3 of the flags field is not resered by the cpu
<geist> it is 'G'
<geist> needs to be set to 1
zetef has quit [Remote host closed the connection]
<bslsk05> ​osdev.org: Global Descriptor Table - OSDev Wiki
<leg7> yeah it's bit 0 actually
<leg7> fml
<zid> > 325462-sdm-vol-1-2abcd-3abcd.pdf page 3159
<geist> yep, there ya go
<geist> G DB L 0
<geist> and you want that to be 1 1 0 0
<geist> 4K granularity, 32bit segment, not long mode, reserved (0)
<zid> (The way it's laid out aligns with the giant hex layout, which is nice)
<geist> yep
<geist> also it kinda depends on which version of the manual you're talking about, bit 1 in the flags has new meaning in long mode
<geist> and yeah bit 0 in flags is AVL, not reserved
<zid> I can't screenshot my hard copy of the 32bit manual sadly :P
<zid> If I were doing 32bit I'd probably use those over the pdf 64bit manual
<zid> just for less clutter
<geist> what i like about the AMD manual is that it describes all of the tables in one place, GDT, LDT, IDT, etc
<geist> and points out that the way the type field connects up makes sense, and actually there's only one table format
<geist> which is not as obvious from the intel manual which introduces GDT and IDT in separate places
<zid> yea there *is* a good type description, but it isn't here
<zid> which is annoying
<geist> so it's pretty neat. IDT can't be misinterpreted as GDT and vice versa, IIRC
<leg7> Also my 32bit and 64bit enum was messed up too
<leg7> GdtEntryFlagsSegmentsWidth
<leg7> that is
<geist> yeah, it's only one bit
<geist> i shoulda caught that before
<zid> osdev wiki actually wins there, it has a nice 1: 16-bit tss, 2 = ldt, 3 = 16-bit tss busy, 9 = 32-bit tss, .. table
<zid> it's just styled in an ugly way
<zid> It's mainly just a copy of the intel manual, but with less pretty graphics
<geist> yeah it's not super clear, but basically if the S bit is not set then it's something else, like a task or an interrupt descriptor
<leg7> I couldn't understand the osdev graphics to save my life
<leg7> I looked at them for 2 days trying to understand
<geist> but it's all set up such that if you interpret bit 40 through 44 as a type field there's no way they overlap
<geist> well, to be honest the proper sollution to all of this is to real the intel and/or amd manual
<geist> it's a big effort but then you're not just cobbling stuff together after the fact
<leg7> I still can't find gdt info in the intel manual
<geist> then you didn't read it
<geist> you skimmed it, looking for what you wanted
<zid> 5.2
<geist> i mean, like literally read it
<zid> I even gave the page number
<geist> sit down and read the manual, maybe skip over the parts where it goes over every instruction, but absorb it
<geist> start with an older version, like the pentium era maybe
<leg7> of course I skimmed it it's 5000 pages
<leg7> wtf
<geist> i've read it
<zid> you don't need to read the bits you aren't up to yet
<geist> many times, both the intel and AMD
<zid> but it's handy if you read the bits you are doing..
<zid> like, I've never read the bit about thermal alarm watchdog bananas, but I've defo read the gdt part
<leg7> I've read like 100 pages of it
<geist> at least start with the basics of the arcticture, how the registers are laid out
<zid> In other words, I can see again hoorah
<leg7> but if I can't find what I'm looking for in it I'm not going to read all 5000 pages
<geist> then go over to the part where it talks about system mode. generally the flow of interrupts, exceptions, paging
<geist> then that introduces you to the concepts so you have something to hang your hat on
<geist> then you can start skimming
<leg7> I read those
<leg7> excetpt exceptions
<leg7> and interrupts
<geist> then i'm blown away youdidn't find the GDT stuff
<geist> it's a very core component of the arcthiecture
<heat_> you read those but without thos
<heat_> just the 'e'
<geist> you probably skipped the section on segmentation thinking you didn't need it
<geist> but alas
<heat_> if you read the paging bits then describe how the paging works
<leg7> I read the segmentation section
<leg7> it's just not that good
* geist shrugs
<geist> anyway, you're close
<heat_> yeah i agree the intel SDM is a bad book
<heat_> what was the author thinking
<heat_> no character development, nothing
<heat_> just "segmentation"
<geist> no thats the ARM manual
<geist> it just tosses you directly in the deep end
<leg7> my flag byte is still fucked up
<geist> well, zid fixed it over on sugmaos
<leg7> nvm
<leg7> it's not fed up
<leg7> the data one is
<leg7> bruh
<heat_> geist, what's sugma
<geist> it's bofa ligma and sugma
<leg7> acces byte is messed up for the data segment
<bslsk05> ​'Ligma, ligma what you ask? Bofa, bofa what you ask? Sugma, sugma what you ask?' by rkgames (00:02:14)
<leg7> I have 8a
<leg7> should be 93
<leg7> Bofa?
<geist> dude your os is named ligmaos, *clearly* you're in on it
<geist> if not you should change it
<leg7> I've never heard bofa
<leg7> I swear
<heat_> how old are you
<kof673> bastard operator from...argentina
<leg7> 22
* kazinsal . o ( LigamentOS )
<heat_> in 22 years of age you must've heard all the fucking variants
<heat_> or you've been without internet for 22.9 of those 22 years
<leg7> Well I'm not a native english speaker
<leg7> so maybe that's why
<leg7> I know ligma, sugma, dragon, candice
<Ermine> I know only ligma
<geist> 'bofa' == both of
<heat_> Ermine, bofa deez patchez
<leg7> bofadiznuts
<geist> right, so yeah.
<kazinsal> iirc the origin of the deez nuts joke is early 90s west coast hip hop
<kazinsal> it's been around for a while
<geist> i may be old, but i grok these
<CompanionCube> oh that's what it means, i saw it alot but never actuallly got the meaning, now i feel stupid
<leg7> thank you I will use bofa from now on
<zid> leg needs to take lessons from biboo
<leg7> biboo?
<geist> but hey, you got it easy, you could be writing an os for ITAAAANIUM
<zid> streamer, her chat constantly try and ger her with ligma jokes but she always expertly avoids them
<heat_> leg7, have you heard of updog?
<Ermine> heat_: now I know how I'll ping you on new patches
<kazinsal> geist: that's easy, the magic compiler will just do the heavy lifting for you!
<Ermine> meanwhile, zathura fails to display intel sdm
<geist> anyway i hadn't thought about the ligma doctor in a year or two, memories
<leg7> yeah wassup dog
Turn_Left has quit [Read error: Connection reset by peer]
<bslsk05> ​'𝗜𝘁 𝘁𝗼𝗼𝗸 𝗕𝗶𝗯𝗼𝗼'𝘀 𝗖𝗵𝗮𝘁 𝗮𝗹𝗺𝗼𝘀𝘁 𝟯 𝗺𝗼𝗻𝘁𝗵𝘀 𝘁𝗼 𝗮𝗰𝗰𝗼𝗺𝗽𝗹𝗶𝘀𝗵 𝘁𝗵𝗶𝘀... |Hololive|' by Gomi Simpington Ch. (00:07:02)
<geist> ahahah
<geist> omg i'm losing it over here
<Ermine> But does anybody write OSen for m68k?
<geist> yah i have LK ported and running on 68k
<heat_> netbsduser ported his OS to m68k too
<Ermine> oh, cool
<geist> aaaand! i just got ahold of a 68030, just need to assemble the board for it
<geist> with 030 i have access to.... PAGING
<geist> MMMMMUUUUU
<Ermine> mmoo
<leg7> OMGGGG IT WORKSSSS
<zid> woot
<leg7> nice
<geist> noice
<Ermine> cool
<leg7> I had the bits reversed for GdtEntryAccessData = 0b000'10'000,
<netbsduser> yes i love all m68k
<leg7> I wrote GdtEntryAccessData = 0b000'01'000,
<zid> do it in userspace next time imo :P
<netbsduser> geist: enjoy
<geist> as much as we just told you the answer, i do low key kinda respect that you wanted to figure it out and not just copy the answer
<netbsduser> i only support 68040/68060 MMUs at the moment, 68030 has a wild one
<leg7> Well it improved my debuggin skills
<leg7> kinda
<geist> netbsduser: yeah i'm always looking out for a good mac SE/30 or an amiga
<geist> but both are pretty difficult
<zid> learning about x /32bx or whaever is a good skill toi have
<leg7> yep
<Ermine> but look, there are bunch of weird arches in linux/arch
<geist> netbsduser: i used to have a next slab with an 030, but i sold it a few years back when i was moving
<leg7> Well I still didn't really learn how to read the interrupt log from qemu
<heat_> a good chunk of those don't really have any good use
<geist> but that's not a real good machine to hack on to be honest
<zid> leg7: just look for old 0xffff
<leg7> but atleast I got a nice gdb setup
<leg7> How do I know what interrupts do what?
<netbsduser> geist: i have an amiga 2000 w/ 68060 card, and i do have a 68030 card somewhere, but it's tedious to swap them
<zid> intel manual
<bslsk05> ​wiki.osdev.org: Exceptions - OSDev Wiki
<geist> netbsduser: but yeah you're right the 030 mmu is a bit wonky
<Ermine> but they are still supported, unlike itanium
<leg7> with this?
<zid> ignore the SMM ones those are firmware doing things, you want old 0xffff, new 0xd
<zid> then old 0xd, new 0xe
<zid> etc
<geist> not entirely compatible with 040. or more importantly it appears that the 040 mmu is approximately a subset of the 030
<geist> but not precisely
<netbsduser> i might do some work targeting 68030 under FS-UAE emulation until i get myself a cheap a500 (also fits the same 68030 card i have for the 2000)
<leg7> what is itanium?
<geist> ITANIUMMMMM!
<zid> That's "Previous interrupt was nothing, now we have a #GP", then "Previous interrupt was #GP, now we have page fault", etc
<netbsduser> itanium is going too far
<leg7> I thought it was a name you made up earlier
<zid> then it's just a register dump
<netbsduser> i will not target the itanium
<zid> good news, gcc 14 is dropping itanium
<zid> now that linux has dropped it
<geist> leg7: it's a now dead architecture that intel released in 1999
<zid> For HP
<geist> had a run, didn't make it, died. but it's *bonkers*
<zid> who are the only people who ever used it
<Ermine> intel's first attempt at 64-bit architecture
<geist> but sometimes you'll see IA-64, since that's the official intel name for it
<zid> (which is why we're all using amd's 64bit architecture)
<geist> vs IA-32 or IA-32e, or Intel64 or whatnot
<netbsduser> incredible GCC support for paris, alpha, mips, and even vax will outlast itanium support
<zid> which intel call Intel 64, or EM64, or I32-e, depending on era/manual
<geist> yah though partially because i'm sure itanium support is a mega pain to maintain
<zid> EMT64*
<Ermine> like, why linux still supports alpha
<heat_> EM64T
<netbsduser> in fairness the others are much less remarkable architectures
<geist> actually of all old dead architectures, alpha still has some lgs
<geist> legs even
<heat_> Ermine, sentimental reasons
<leg7> is riscV better?
<heat_> it was the second arch on linux, the first big proof that linux is portable
<nikolapdp> in what way does alpha have legs
<geist> alpha stuff is still *Very* expensive, i think there's a fair amount of folks still needing to maintain old alpha systems
<leg7> like more organized and easier to work with
<nikolapdp> thought it died with dec
Matt|home has quit [Quit: Leaving]
<heat_> leg7, better than what?
<leg7> x86
<geist> well, it did and didn't. compaq bought it, and HP killed it later, but i think they continued to manufacture alpha servers through some of the 2000s
<geist> but the ones they made were enterprise grade stuff, so the hardware itself is still solid
<heat_> riscv has less legacy than x86, but the manual reads like something someone wrote on the back of a napkin
<geist> and i think theres some cases where there's a lot of alpha installations floating around
<geist> such that the hardware market is still quite expensive for used alpha stuff
<zid> heat_: back of 12 napkins
<zid> and you have to get them each from a different restaurant
<leg7> damn that bad
<heat_> amd manuals are good, intel manuals are good
<leg7> has anyone of you made a non x86 os?
<geist> but otherwise riscv is so simple it's pretty fun. i've been spending a lot of time in riscv land the last year and it's both fun and terrible but mostly fun
<Ermine> lk supports a lot of stuff
<heat_> arm manuals are like "here are the pieces to your CPU, have fun assembling them"
<geist> like in the way that crappy go-kart some kid down the street had where the wheels would fall off and you had to reach back and manually frob the throttle on the engine
<Ermine> but it's kinda barebones
<geist> but it ran like a bat out of hell
<Ermine> heat_: what is the state of aarch64 in onyx btw?
<geist> Ermine: yah lots of folks build things out of it
<geist> basically 'heres a kernel, here's where you add your code' go for it
<geist> and that seems to satisfy a lot of companies
<Ermine> yes, this is what I meant