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
Burgundy has left #osdev [#osdev]
poisone has joined #osdev
<bslsk05> ​gcc.gnu.org: Using the GNU Compiler Collection 13.0.0 (experimental 20221111) documentation
<heat> new fancy gcc docs
<mjg> YO
<mjg> STAY HARD
<heat> i'm happy but not that happy
<zid> https://gcc.gnu.org/gcc-13/changes.html Still looks proper at least
<bslsk05> ​gcc.gnu.org: GCC 13 Release Series — Changes, New Features, and Fixes - GNU Project
<heat> ew
<heat> wdym "looks proper"
<heat> it doesn't even have dark mode
<heat> just raw whitey html
<zid> web 1.0
<zid> aka back when it still worked
<heat> sphinx also just works
<mjg> you can't handle the truth table
<heat> btw happy your back
<heat> you're*
<heat> that mjg_ just sucked
<poisone> double mjg;
<heat> this is nofpu code
<mjg> i'm a self help guru now
<mjg> 1. STAY HARD
<heat> hardbsd
<heat> better known as OPENBSD
<gog> girlbsd
<heat> we need a female ran operating system
<heat> maybe it wouldn't crash so much
<heat> or have such shit code
[itchyjunk] has quit [Ping timeout: 260 seconds]
[itchyjunk] has joined #osdev
Matt|home has quit [Quit: Leaving]
<mjg> gOgginS
<mjg> i would use that
<gog> well, if i'm in charge of it it would still have shit code
<heat> forking from bsd will always give you shit code
<heat> fork Onyx instead
<heat> highly good very good code
<gog> top quality best codes
<heat> believe me folks, i have the best code, best code in the whole world
<gog> i'm gonna write my own bsd but i'm gonna fork it from something very old
<heat> yessssssssss
<heat> slay queeeen
<mjg> gog: someone alredy did that, believe it or not
<gog> well shit
<mjg> they made an embedded-focused bsd out of the vax-era shit
<mjg> can't remember the name
<mjg> i guess an interesting, but flawed choice
<gog> yeah i was just reading about 3BSD and the VAX era lol
<gog> that seemed like the most reasonable starting point
<mjg> VAX MOTHERF
<mjg> UCKER
<mjg> gonna port SOLARIS to VAX
<gog> why would you abuse a vax like that
<gog> you're a sick person
<heat> “Look, having UNIX — my uncle was a great professor and scientist and engineer, Dr. Marshall McKusick at Berkeley; good genes, very good genes, OK, very smart, the University of California, very good, very smart —you know, if you're a microkernel fan, if I were a rust developer, if, like, OK, if I wrote a rust microkernel, they would say I'm one of the smartest people anywhere in the world — it's true! — but when you're a conserva
<heat> tive UNIX monolithic kernel fan they try — oh, do they do a number — that's why I always start off: Went to Berkeley, was a good student, went there, went there, did this, built an operating system —you know I have to give my like credentials all the time, because we're a little disadvantaged — but you look at the operating systems out there, the thing that really bothers me — it would have been so easy, and it's not as important
<heat> as these lives are UNIX is powerful; my uncle explained that to me many, many years ago, the power and that was 50 years ago; he would explain the power of what's going to happen and he was right — who would have thought?), but when you look at what's going on with the four microkernels — now it used to be three, now it's four — but when it was three and even now, I would have said it's all in the messenger; fellas, and it is fellas bec
<heat> ause, you know, they don't, they haven't figured that the women are smarter right now than the men, so, you know, it's gonna take them about another 150 years — but the rust developers are great negotiators, the microkernel fans are great negotiators, so, and they, they just killed, they just killed us.”
<heat> i needed this
<gog> one might be surprised to learn this about me
<gog> but i have no interest in rust
<heat> thank you
<gog> memory safety is for cowards
<heat> fuck memory safety and fuck your separate address spaces
<mjg> fuck your rings
* mjg goes full templeos
<gog> yes
<gog> a unified address space
<heat> terry had great quotes
<mjg> indeed he did
<heat> that unfortunately are not safe to post
<heat> still great quotes though
<mjg> his benchmarks are not safe to post man
<mjg> for real
<mjg> was very negatively surprised by what he pulled of
<mjg> f
<heat> lmao
<heat> god has pessimal code
<mjg> example: he wanted to bench whether optmizing code for size in his compiler makes any sense
<mjg> to that end he wrote a bench which just looped over a small code sample
<mjg> the cpu was able to cache and decode all of it
<mjg> ... meaning he ultimately did not benchmark what he intended
<mjg> on one hand pretty weird, on another i keep seeing this: someone otherwise capable of writing non-trivial code pulls off a total idiocy when it comes to performance
wootehfoot has quit [Quit: Leaving]
<mjg> i don't understand ohw that keeps happening
gog has quit [Quit: byee]
elastic_dog has quit [Killed (erbium.libera.chat (Nickname regained by services))]
elastic_dog has joined #osdev
ZombieChicken has joined #osdev
dutch has quit [Ping timeout: 260 seconds]
spikeheron has joined #osdev
isaacwoods has quit [Quit: WeeChat 3.7.1]
spikeheron has quit [Quit: WeeChat 3.0]
jjuran has quit [Ping timeout: 268 seconds]
spikeheron has joined #osdev
jjuran has joined #osdev
vdamewood has joined #osdev
Raito_Bezarius has quit [Ping timeout: 252 seconds]
<heat> mjg, because performance is hard
<mjg> cmon dawg. there is hard aspects and there is being incredibly naive about it
<heat> you can also halfass things if you wanna get some real progress done
heat has quit [Remote host closed the connection]
heat has joined #osdev
<heat> not everything needs to be optimal usually
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
<mjg> that's not a comment on the benchmark though
terrorjack has joined #osdev
<heat> ah sure
<heat> not everyone is intimately familiar with CPU internals
<heat> or like, at all
<mjg> then 1. don't the bench or 2. educate yourself
ZombieChicken has quit [Remote host closed the connection]
Raito_Bezarius has joined #osdev
[itchyjunk] has quit [Read error: Connection reset by peer]
Raito_Bezarius has quit [Max SendQ exceeded]
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Raito_Bezarius has joined #osdev
<zid> It just goes to show how much you can pull off if your tool of choice is '18 hour mental episode'
<zid> rather than 'knowing what you're doing', but writing no code
vdamewood has joined #osdev
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
myon98 has left #osdev [Leaving]
srjek|home has quit [Ping timeout: 256 seconds]
bradd has joined #osdev
<Mutabah> klange: You'll be happy to hear that I'm setting up GH actions on my kernel
heat has quit [Ping timeout: 256 seconds]
GeDaMo has joined #osdev
<Mutabah> yay, bitrot
<Mutabah> (more, I was rewriting a dependency I was pulling in as a git repo - and thus got out of sync)
<clever> {"active":false,"audible":false,"autoDiscardable":tvue
<clever> Mutabah: ive found this in a json file before, but i dont think it was bit-rot on-disk
<Mutabah> looks like a bit-flip?
<Mutabah> 0x72 -> 0x76
<clever> yep, if you convert the ascii to binary, its a single bit, yep
<clever> but this file is stored on zfs, with both compression and checksums
<clever> if the bit flipped on disk, the lz4 would not have undone, and the checksum would have failed
<Mutabah> "bit-rot" usually (well... to me) refers to knock-on changes making something no longer useful/usable
<clever> i believe it flipped in dram
<Mutabah> E.g. if something hasn't been compiled/run for a long time
<clever> ah, more like code just not being compatible
<Mutabah> Might be an overloaded term...
<clever> thats why ipxe doesnt use #ifdef for its config
<clever> ipxe compiles all code always, and then decides at link time if it should include a given .o or not
<clever> so if you break the compatability between modules, it fails, even if your never using them
<Mutabah> Ooh, nice idea
<Mutabah> I got quite salty at work last week after discovering that some automated tests (written early in the project... like, a year ago) were not only not being run, but also had substantially bitrotted
<clever> modules find eachother the same way little-kernel does, put a bunch of structs into a special .data.foo section, and then get start/end pointers from the linker
<clever> and you can iterate over every foo the linker included in the project
<Mutabah> ... this was after I suggested some basically-cosmetic changes to a merge request, and they were rejected with the reason "I can't test this easily - we know the current code works [from testing on real hardware]"
<clever> ouch
<clever> i try to keep CI running tests always
<clever> but yeah, some things cant be tested without hardware (or better emulators)
<Mutabah> yeah... thankfully, I was low on tasks - so tomorrow (Monday) I'm going to complete fixing of those tests
<Mutabah> (and add them to the CI)
<Mutabah> (f___ing hell, we designed this system to be developer testable - WHY DID THE TESTS GET FORGOTTEN)
<clever> in the past, i made a whole test framework using qemu, that would spin up a cluster and run some tests
<clever> then i discovered, the CI machines in aws cant use /dev/kvm, no nested virtualization in aws at the time
<clever> and with tcg emulation, the clocks drift out of sync so fast the test fails every time
<Mutabah> Oof
<clever> the devs later made better tests, that didnt need qemu
<clever> so the emulation doesnt matter anymore
elastic_dog has quit [Read error: Connection reset by peer]
elastic_dog has joined #osdev
Matt|home has joined #osdev
<klange> Mutabah: good, good, now... add an artifact upload stage (it is, amazingly, free)
<klange> I do build-on-push with artifact uploads, which are public but need to be logged in to github to see them, and I also automatically attach those builds to tagged releases and draft release notes; it's quite the whiz-bang automation
<Mutabah> Probably should
<Mutabah> but distracted now :)
potash has quit [Ping timeout: 260 seconds]
potash has joined #osdev
<vin> Why are standards like CXL/UCIe becoming prominant now? I.e. allowing PCIe to be byte addressable.
terminalpusher has joined #osdev
bgs has joined #osdev
wootehfoot has joined #osdev
Brnocrist has joined #osdev
vdamewood has quit [Read error: Connection reset by peer]
vdamewood has joined #osdev
spikeheron has quit [Quit: WeeChat 3.7.1]
spikeheron has joined #osdev
gog has joined #osdev
wootehfoot has quit [Read error: Connection reset by peer]
gareppa has joined #osdev
bradd has quit [Ping timeout: 268 seconds]
gareppa has quit [Read error: Connection reset by peer]
gareppa has joined #osdev
gareppa has quit [Remote host closed the connection]
gareppa has joined #osdev
[itchyjunk] has joined #osdev
elastic_dog has quit [Ping timeout: 240 seconds]
elastic_dog has joined #osdev
rwxr-xr-x has joined #osdev
vdamewood has quit [Read error: Connection reset by peer]
vdamewood has joined #osdev
srjek|home has joined #osdev
rwxr-xr-x has quit [Remote host closed the connection]
rwxr-xr-x has joined #osdev
ElementW has quit [Ping timeout: 248 seconds]
<rwxr-xr-x> Hello all!
<rwxr-xr-x> How's it going?
<GeDaMo> Hi rwxr-xr-x :)
<rwxr-xr-x> Hello!
<rwxr-xr-x> First time using IRC, seems pretty chill
<GeDaMo> If by "chill" you mean quiet, it varies :P
<rwxr-xr-x> I've joined a few different channels, they are remarkably quiet, that's for sure, there are a lot of people here though, which is surprising
<rwxr-xr-x> Every channel i've been in have been very welcoming, which is mostly what I was referring to, there is no gatekeeping, very nice
<GeDaMo> You can search channel names with /msg alis list *pattern* or channel topics with /msg alis list * -topic *pattern*
<GeDaMo> You can add -min 10 to only show channels with at least 10 nicks
<rwxr-xr-x> Hey that's pretty cool
<rwxr-xr-x> I was just using list and combing through lol
<GeDaMo> :)
<rwxr-xr-x> :)
<GeDaMo> You can see the biggest channels with /msg alis list * -min 500
<rwxr-xr-x> Nice, thanks!
<GeDaMo> A lot of people doesn't guarantee a lot of activity though :P
<rwxr-xr-x> yeah, i was just looking at the logs for osdev, last activity before I jumped in was 4 hours ago
<GeDaMo> It depends on who's on / awake
<rwxr-xr-x> yeah, nobody gets kicker out for being afk
<rwxr-xr-x> kicked*
<GeDaMo> Some people use a bouncer, a proxy which stays connected even if they're offline
<rwxr-xr-x> neat
<rwxr-xr-x> why so?
<rwxr-xr-x> they can just recconnect can they not? Reading old messages?
<GeDaMo> Yes but if you disconnect, you won't see message from that time
<GeDaMo> The bouncer keeps a log
<rwxr-xr-x> gotcha
<GeDaMo> Your client may have a way to hide join and part messages, those can get annoying in a busy channel
<rwxr-xr-x> Yeah mine does
<rwxr-xr-x> Okay, I've got an actual OSDev question now lol
<rwxr-xr-x> So i've just gotten to the point of switching from 16-bit real to 32-bit protection mode
<rwxr-xr-x> and I'm using QEMU
<rwxr-xr-x> I have it print a line in 16-bit real, then one in 32-bit prot when it switches, problem is it flickers like crazy, which i'm guessing is because qemu isn't letting the program print where it wants to, which is the top left corner, overwriting whatever is there, i can spam the pause button and every once in a while see it print the 16-bit real message, im not seeing the 32 bit one though, is it QEMU or my code?
<rwxr-xr-x> im learning with Nick Blundell's "Writing a simple Operating System -- from Scratch"
<GeDaMo> Is it triple faulting and restarting?
<GeDaMo> What does your program do after writing to the screen?
<rwxr-xr-x> It doesn't appear to triple fault, let me take a closer look
<rwxr-xr-x> All of the text qemu prints is flashing multiple times a second, text like "booting from hard disk" is partly disappearing, and the cursor is jumping from below the booting message to different parts of the left side of the screen
<rwxr-xr-x> and its printing the 16 bit real mode message every 10 or so seconds
<zid> are you using bios routines to print text
<zid> or writing to vga memory
<rwxr-xr-x> 16 bit is using bios routines, 32 is using vga memory
<zid> and which one was flickering, 32?
<rwxr-xr-x> The program starts in 16, prints a message, switches to 32, prints a message, then loops
<zid> and which one was flickering, 32?
<rwxr-xr-x> I think 32
<zid> you.. think? the messages are different I'd hope
<rwxr-xr-x> It only shows the 16 bit message
<zid> okay so your 32bit code is just totally broke
<rwxr-xr-x> the instant it starts qemu, it flashes ridiculously fast, and occasionally prints the 16-bit message
<zid> throw a binary out somewhere I wanna see :P
<rwxr-xr-x> i can do 2 things, i can package the asm files together or send a compiled binary
<rwxr-xr-x> what works better?
<zid> the latter
<rwxr-xr-x> alright, one moment
<zid> I don't want to have to replicate your toolchain
<zid> and I can just disassemble it
<rwxr-xr-x> sounds good
<bslsk05> ​file.io <no title>
<zid> yea this is just boot looping
<zid> It prints Started in 16-bit real mode then triplefaults
<zid> Time to teach you the magic debug options to qemu
<rwxr-xr-x> Sounds good!
<zid> # qemu-system-x86_64 -fda irc_test.bin -no-shutdown -no-reboot -d int -monitor stdio
<zid> try that
<zid> you're looking for check_exception old: 0xffffffff new 0x
<zid> d
<zid> you caused an exception 0xd (gpf?) at 0x7c6f, which also 0xd's, which then 0x8's
<zid> and the cpu stops
<rwxr-xr-x> check_exception old: 0x8 new 0xd
<rwxr-xr-x> yup
<rwxr-xr-x> i should really read about qemu lol
<rwxr-xr-x> that would've been helpful
<zid> 0x6F is
<zid> jmp 8:0x7c74
<zid> so your selector is fucked
<zid> and if you look at the first exception
<zid> 0: v=0d e=0008
<zid> 'gpf dealing with selector 8'
<zid> your third selector is fucky
<rwxr-xr-x> huh
<zid> it should be 0xcf9200000000ffff looking
<rwxr-xr-x> let me take a look here
<zid> looks like it's off by 1 byte
<zid> the 0xcf is missing so it's all shifted left by 8 bits
<zid> http://shogun.rm-f.net/~zid/gdt.html I made this, might be helpful idk
<bslsk05> ​shogun.rm-f.net: GDT Parser
<rwxr-xr-x> hey thats really cool
<rwxr-xr-x> thanks!
<zid> http://shogun.rm-f.net/~zid/page.html if you get into 64bit paging too..
<bslsk05> ​shogun.rm-f.net <no title>
<zid> I never do 32bit stuff so idk what good selectors look like though :P
<rwxr-xr-x> its whooping my ass
<zid> your 8 selector looks okay in my tool though
<rwxr-xr-x> 16 bit was easy lol
<rwxr-xr-x> having a bios doing shit for you is very nice
<zid> present, ring 0, code/data, executable, writeable
<zid> 32-bit
<rwxr-xr-x> I was looking at it right now
<rwxr-xr-x> thought that might be the issue as well
<rwxr-xr-x> its correct
<zid> yea it's definitely unhappy with it though
<rwxr-xr-x> Code segment: 10011010b & 11001111b
<zid> it's faulting trying to load it into cs
<rwxr-xr-x> Data Segment: 10010010b & 11001111
<rwxr-xr-x> yeah its very weird
<zid> I have a paper copy of the 32bit manual but
<zid> it's heavy and I am sat down
<rwxr-xr-x> for a second I thought it was because of my descriptor, i add the start and end and sub 1 from it
<rwxr-xr-x> lol
<zid> gist.github.com the gdt declarations and code that loads it?
<zid> the lgdt bit and the gdt: dq 0 dq .. nonsense
<rwxr-xr-x> its where i calc the size of the gdt, adding the start and end of it together then subbtracting 1 because its always less than 1 of the true size
<zid> yea your gdt may be too short, for example
<zid> actually qemu prints the limit I think
<zid> your limit is fucky but I think fine, you have it set to 25 bytes
<zid> which is enough for cs to load correctly, but I would fix it
Burgundy has joined #osdev
<rwxr-xr-x> yeah, 0xffff
<zid> paste paste paste
<zid> gist.github.com preferable but if you don't use github then whatever's fine
<rwxr-xr-x> ill send my gdt
<rwxr-xr-x> ill use gist
<bslsk05> ​gist.github.com: gdt.asm · GitHub
<zid> line 32
<zid> and 40
<zid> make your selectors 9 bytes long, which is fine for the first one, but misaligns the second
<zid> and then throws your length calculation off
<zid> dd + dd = 8, and dw + dw + dw + db + db = 8, but then you have another db
<zid> so you have 8 + 9 + 9 = 25
<rwxr-xr-x> shit
<rwxr-xr-x> wow i would never have gotten that
<zid> all hail x /3gx
dude12312414 has joined #osdev
<zid> annoyingly I don't think this will actually fix it
<rwxr-xr-x> the theoretical solution is remove one of the db 0x0's correct?
<zid> I mean, the last one is obviously wrong
<zid> selectors end with the 0xFFFF limit
<zid> not a 0
<zid> which is why your first selector looks fine, but second one starts with 00
<zid> err wait, start with flags, fuck
<zid> anyway, this doesn't cause an issue until selector 3 at 16, so it shouldn't actually fix anything I don't think, but it's still wrong
<zid> You have 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 9a cf 00 ff ff 00 00 00 00 92 cf 00 which the cpus sees as [00 00 00 00 00 00 00 00] [ff ff 00 00 00 00 9a cf] [00 ff ff 00 00 00 00 92] [cf 00
<zid> so only selector 16 and 24 are broken broken
<zid> (I made up the 92 and 9a, too lazy to math)
bauen1 has quit [Ping timeout: 260 seconds]
<zid> oh hey I was right though
<rwxr-xr-x> hm?
<zid> those bytes were 92 and 9a
<rwxr-xr-x> XD
<rwxr-xr-x> Nice
bauen1 has joined #osdev
<zid> hex editor shows it nicely
<zid> aligned to 8, aligned to 8, offset by 1, offset by 2
<rwxr-xr-x> Oh yeah
<zid> length is 0x19, address is 7C10
<rwxr-xr-x> alright, stupid question here, what do you mean by selectors?
<zid> the 8 byte things
<zid> are segment selectors
<zid> or segment decriptors
<zid> selectors are moreso the registers themselves but meh
<rwxr-xr-x> alright, thank you
<zid> also your gdt length + start pair being *after* the table is upside down compared to how most people do it, just thought you might wanna know :P
<rwxr-xr-x> so this makes more sense now, its offset weirdly
<zid> makes your address calc need that extra label and means it moves around as you add/remove selectors
<rwxr-xr-x> I was wondering why the extra label was so important!
<rwxr-xr-x> they mentioned the need for it to calculate the start/ end, but it just felt overcomplicated
<bslsk05> ​github.com: bootstrap/long.asm at master · zid/bootstrap · GitHub
<zid> most people do it this way up
<rwxr-xr-x> huh
<zid> length, addr, null descriptor/selector, code desc/sel, data desc/sel
<rwxr-xr-x> smart
<zid> I don't even bother with the labels and just hardcode it there though, these selectors are loaded for about 300 instructions
<zid> until C takes over and loads its own
<rwxr-xr-x> very cool
<mrvn> zid: why would you ever add selectors?
<zid> did you remove those two db 00 yet?
<rwxr-xr-x> yup, still crashes
<zid> yea figures, but at least loading 16 into ds/ss won't fault now :P
<zid> is your length correct now too?
<zid> should be what, 17?
<zid> GDT= 7C10 0017 or something
<rwxr-xr-x> exactly
<zid> good good
<rwxr-xr-x> i was going to see what it was before
<rwxr-xr-x> beat me to it
<zid> 19 before
<zid> (25 bytes)
<rwxr-xr-x> yeah
<rwxr-xr-x> improvement lol
<zid> so let's figure out what's wrong with your code selector I guess
<rwxr-xr-x> yeah it still doesn't like existing
<mrvn> update your gist
<rwxr-xr-x> un momento
<rwxr-xr-x> done
ElementW has joined #osdev
<mrvn> and add a hexdump of the compiled file
<gog> hi
<mrvn> Does "dd" align data?
<gog> no
<zid> highg og
<gog> iirc
<gog> if you have a db and then a dd the dword will be offset by a byte
<mrvn> rwxr-xr-x: Why don't you define the descriptors in C?
<gog> you need to put a .align pseudo before it
<gog> or the nasm equiv
<bslsk05> ​file.io <no title>
<zid> ah fixed align version? handy, won't have to hex edit it :P
<rwxr-xr-x> i don't think you understand how little I understand mvrn lol
<rwxr-xr-x> yeah
<mrvn> gog: or not. the gdt descriptor is supposed to be misaligned: length + address
<gog> i mean in the case that you want it aligned, not in this case specifically
<gog> in this case yeah you want the gdtr to be packed word:dword
<zid> as far as I can tell this is fine, I'm a bit stumped
<zid> cf9a is good shit
<gog> dd gdt
<gog> dd gdt + 16 is wrong
<zid> I assume writeable + code is legal
<gog> yeah long mode doesn't care anyway
<zid> this is 32bit
<gog> what is jmp 8:longmode then
<zid> my code
<gog> oh
<gog> nevermind
<zid> that I showed as an example of putting the gdt 'header' at the top
<zid> rather than below it, like this guy does, to make his life harder
<gog> bimbo moment
<gog> their code paste is gone now tho
<rwxr-xr-x> that what you were talking about?
<zid> I've just been ndisasm -o 0x7C00 -b16'ing the binary
<zid> :D
<zid> 9A gives us 'execute/read' according to the manual anyway
<zid> I forget precisely what conforming means
<gog> it has to do with PL changes
<gog> i forget exactly what though because it's not relevant in long mode
<rwxr-xr-x> It stops segments with lower privileges accessing it
<rwxr-xr-x> "by not corming it means code in a segment with a lower
<zid> yea same
<gog> ok i think i see what the problem is here
<zid> I know what selectors are supposed to look like in long mode
<zid> this is crusty knowledge
<gog> no wait i don't
<rwxr-xr-x> damnit
<zid> I think I actually have used these exact selector values before
<rwxr-xr-x> got me excited lol
<zid> cf9a and cf92 are really familiar
<gog> i was thinking long mode
<zid> lemme check the gpf manual entry, it has a list of like 40 things that might bew rong...
<zid> `Loading the CS register with a segment selector for a data segment or a null segment selector.` etc
<zid> `Exceeding the segment limit when referencing a descriptor table (except during a task switch or a stack
<zid> switch).
<zid> being the other one I checked
<zid> what was that nochain command line stuff..
<zid> *rebuilds qemu with capstone*
<rwxr-xr-x> im so f__ckin confused rn
<gog> i see what's wrong
<zid> huzzah
<gog> u16 limit, u16 base, byte base
<gog> you're off by a byte
<theWeaver> rwxr-xr-x: your nick is great
<zid> Did I count the 0s wrong
<theWeaver> nice work
<rwxr-xr-x> Thank you!
* theWeaver approves
<zid> yes, y es I did
<zid> good job gog
<zid> 0xcf9a00000000ffff
<gog> it should be dw 0xffff, dw 0x0, db 0x0
<rwxr-xr-x> i was reading about uac's a while back and thought it was good
<zid> Access00
<zid> Not-Present
<gog> then you'll need one more db 0 at the top
<zid> it's the middle that's wrong
<zid> the cf9a and ffff parts are great :P
<gog> dw limit, dw base, db base, db access, db flags_limit, db base
<zid> or I'm stuck thinking in long mode anyway
<zid> yea it should be 00CF9A000000FFFF
<gog> that's right for long mode and pmode
<zid> I assumed it had the right amount of zeros rather than *actually* transcribing it like I should have, and just slammed cf9a...ffff into my tool
<zid> I'll remember for next time at least I guess
<gog> you won't
<zid> I will
<gog> i won't either
<gog> don't be ashamed
<rwxr-xr-x> another db 0 at the top made gdt 7c10 and 18
<zid> do x /2gx 0x7c10
<zid> in the console
<gog> at the "top" i mean higher address
<gog> so at the end of the def
<gog> sorry
<gog> text grows down but the address grows up
<poisone> ret
<zid> like this right gog?
<gog> yes
<zid> rwxr-xr-x ^
<gog> why do i have cf9f in my head tho
<gog> i think cf9f is data?
<zid> 92 and 9a are what I use
<gog> or is 9f code and 9a data?
<gog> 92
<gog> yes
<gog> wtf is 9f
<zid> I think >8 is code, >0 is data
<gog> i think 9f is invalid
<zid> nah
<zid> exec/read/conform/access
<zid> table 3-1
<zid> That's just the low nibble of the 9x byte
<gog> ah ok
<zid> so 92 is rw, 9a is exec/read, the others are +conform or +accessed or both
<gog> i know why 9f is in my head, because that's what a 9a becomes after you load and jump into it
<theWeaver> who da fuq is turning 9a to 9f after you load and jump to it >:o
<gog> wait no it doesn't idk
<gog> ignore me i'm not thinking clearly
<zid> accessed adds 1 :P
<gog> yes
<zid> so it'd turn to 9b, 9b + comforming = 9f
<gog> yes that's right
<gog> theWeaver: ask the designers of the 286
<gog> they're the reason we have this mess
<zid> I had a very similar bug in my gdt impl actually
<zid> I forgot to mask in one of the bytes correctly
<gog> classic gdt bug
<zid> so it worked for weeks until I re-compiled and some addresses moved around, and my limit was no longer enough because I had it set to 00ff not ffff or something
<zid> suddenly GPF while doing something innocuous
rwxr-xr-x has quit [Remote host closed the connection]
<gog> oops
rwxr-xr-x has joined #osdev
<zid> whale cum back
<rwxr-xr-x> tyty
<rwxr-xr-x> accidentally closed my client lol
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<zid> oh right this explains where that extra 00 on the end came from now
<zid> it was actually an extra 00 in the middle and it was supposed to be there
<zid> duh
jimbzy has quit [Ping timeout: 255 seconds]
<zid> In other words finally huzzah, 100 wins in fortune's foundation
xenos1984 has quit [Ping timeout: 256 seconds]
xenos1984 has joined #osdev
xenos1984 has quit [Ping timeout: 260 seconds]
poisone has quit [Ping timeout: 268 seconds]
<zid> rwxr-xr-x: how goes it then? you're holding out on us, we're invested now.
<rwxr-xr-x> Okay so since i'm blind i didn't see the messages until now, i just now fixed it, it only prints the 16 bit message, but doesn't crash
<zid> good good
<zid> I'd take a new binary if you've got one
<rwxr-xr-x> ofc
<rwxr-xr-x> one moment
<zid> I'm not doing much else tonight
<bslsk05> ​file.io <no title>
<gog> i'm getting pizza
<rwxr-xr-x> i got some last night lol
xenos1984 has joined #osdev
<zid> EIP=003de948 that doesn't look right :P
<rwxr-xr-x> EIP=00007d85 is what i see
<zid> you're loading your ds/ss/es/fs/gs with a silly value
<zid> You set cs to 8, then ds/ss to 15
<zid> one of these two things is not like the otherrr
<zid> (if you give up I can tell you the correct value)
<rwxr-xr-x> the way it works in my code is I set ax to DATA_SEG, and then set ds->gs to ax
<rwxr-xr-x> DATA_SEG is gdt_data - gdt_start
<zid> I am getting good at using ndisasm
<rwxr-xr-x> yeah sheesh
<gog> you have an off by one error
<rwxr-xr-x> thats f__king cool
<gog> should be 0x10
<zid> might be because we fucked around with the segment desriptors earlier
<zid> and one of them is too long/short again
<gog> possibly
<zid> do the yep
<gog> yep
<zid> badly misaligned
<zid> 0000000000000000 ffcf9a000000ffff 0015cf92000000ff
<rwxr-xr-x> how
<rwxr-xr-x> so confusing
<gog> you changed one of them but not the other
<zid> gdt: dw 23; dd gdt+16 .align 16; dq 0; dq 0x00cf9a000000ffff; dq 0x00cf92000000ffff; ftw :p
<rwxr-xr-x> how do I implement that though
<zid> copy paste?
<gog> programmer's best friend
<rwxr-xr-x> indeed
<gog> and worst enemy
<rwxr-xr-x> but
<gog> frenemy if you will
<gog> just like zid and me
<zid> I bet if you replace your thing with that, it boots
<rwxr-xr-x> is that a replacement for gdt_descriptor?
<zid> yea
<zid> (it's literally just my long mode gdt setup but without the L bit set)
<gog> long mode best mode
<zid> long mode only mode
<zid> probably a bit early for rwxr-xr-x to deal with paging though ngl
<gog> probably
<zid> so this is probably the good way for him to play around
<gog> paging is hard
<rwxr-xr-x> i barely understand this shit lol
<zid> mov eax, [esp+4];PML4
<zid> mov [eax+4080], ecx
<zid> lea ecx, [eax+3]
<gog> that's fine, we barely understand it either
<zid> that's my paging code, don't ask me what it does because I forgot
<zid> looks like it's installing a recursive pagetable, news to me
<gog> yeh
<gog> you're identity mappign the whole first 512GiBs
<gog> with the forbidden trick
<zid> nah it's at +4080
<zid> so it's the.. -2th 512gb
<gog> oh tru
<zid> I should have made a diagram with where I mapped everything, but included the droste effect
<bslsk05> ​file.io <no title>
<rwxr-xr-x> new binary
<zid> deleted
<rwxr-xr-x> nothing changed
<gog> yo dawg i heard you like page mapping so i put a page mapping in your page mapping
<rwxr-xr-x> huh
<zid> you could just x /3gx 0x7c10 it yourself
<bslsk05> ​file.io <no title>
<zid> deleted
<zid> is it getting antiwirused?
<zid> base64encode it and paste it to gist.github.com :P
<rwxr-xr-x> alr
<zid> arithmetic lotate right
<bslsk05> ​gist.github.com: bin.64 · GitHub
terminalpusher has quit [Remote host closed the connection]
<zid> you have af9b af93
<zid> that's my 64bit long mode one
<zid> but the alignment is good!
<zid> length is wrong though, should be 23
<zid> oh wait, hex
<zid> 17 is correct
<rwxr-xr-x> yep
<zid> change your af's to cf's
<rwxr-xr-x> no change
<zid> what fault do you get
<zid> You're still loading ax with 15
<zid> mov ss, ax faults, cus that's illegals
<rwxr-xr-x> how did you see that?
<zid> I looked at the code
<zid> 0x7CA2
<zid> try
<zid> x /1i 0x7CA2
<rwxr-xr-x> ndisasm
<rwxr-xr-x> tf?
<zid> hmm?
<rwxr-xr-x> wdym x /1i 0x7CA2
<zid> in qemu
heat has joined #osdev
<gog> heat
<zid> hmm qemu isn't picking up my capstone, wonder if I need to explicitly ./configure for it
<heat> gog
<Ermine> gog: may I pet you?
<heat> no
<gog> yes
<heat> no
* Ermine is confused
<Ermine> Anyway,
<heat> no + yes = 0
<heat> no + yes + no = no
<zid> That seems bad
* Ermine pets gog
* gog prr
<rwxr-xr-x> ofc
<zid> #include <capstone.h> fails
<heat> zid, check the l o g s
<heat> also
<heat> PRAISE BE THINE MESON
<zid> should be capstone/capstone.h
<zid> so meson is fucked
<zid> should I go bother them on oftc
<bslsk05> ​www.boredpanda.com: World's Fittest Grandma Just Celebrated Her 80th Birthday | Bored Panda
<rwxr-xr-x> i need you to clarify here, what do i do with x /1i ??
<zid> type it into qemu
<zid> [16:23] <zid> # qemu-system-x86_64 -fda irc_test.bin -no-shutdown -no-reboot -d int -monitor stdio
<rwxr-xr-x> How the hell does that translate to that command
<gog> in qemu monitor
<gog> x examines an address
<gog> /1i decodes an instruction
<zid> it translates to 'type it into qemu'
<zid> that's how you run qemu such that you can type into it
<rwxr-xr-x> Alright this makes sense now
<rwxr-xr-x> im using emacs for everything, and it won't let me type commands in
<rwxr-xr-x> i have to open a terminal instance
<rwxr-xr-x> let me check now
<zid> okay so resolved my issue
<gog> emacs
<zid> gef requires capstone 5, qemu is not capstone 5 aware yet
<zid> and capstone 5 changes its include path from <capstone.h> to <capstone/capstone.h>
<rwxr-xr-x> 0x00007ca2: 8e d0 movl %eax, %ss
<rwxr-xr-x> thats what it returns
<zid> yep
<zid> and you should also have interrupt log if you scroll up
<zid> check_exception: 0xffffffff new 0xd
<zid> then a register dump
<rwxr-xr-x> yeah
<zid> and it should tell you what EIP was
<rwxr-xr-x> 7ca2..
<zid> tada, all makes sense now?
<rwxr-xr-x> ah
<rwxr-xr-x> yeah
<zid> I hope you learned an important lesson about using emacs as your operating system
<zid> instead of your operating system
<rwxr-xr-x> lmaaoooo
<rwxr-xr-x> its useful!!
<rwxr-xr-x> and installing screen on here is a pain in the ass
<zid> just open 8 terminal windows like a good boy
<rwxr-xr-x> christ
<heat> use onyx
<heat> best operating!!!!!11!111
<zid> ah there's already a bloody patch to fix this
<heat> ye bloody patch innit
<bslsk05> ​patchwork.kernel.org: [RFC] capstone: fix building using system package - Patchwork
<zid> fuck applying out of tree patches though I'll just stick to --extra-cflags=-I/usr/include/capstone for now
<heat> the capstone pkgconfig sounds borken
<zid> nah capstone just made a breaking change to how they expect people to include their shit
<zid> they switched to SDL style
<zid> <SDL/mixer.h> <SDL/sdl.h> rather than -I/usr/include/SDL in --cflags
<heat> that patch is from 2018
<heat> and that particular problem got fixed, see https://bugs.gentoo.org/647570
<bslsk05> ​bugs.gentoo.org: 647570 – app-emulation/qemu-2.11.0 should have USE=capstone
<zid> apparently it either never got merged, or the fix doesn't fix it anymore
<rwxr-xr-x> so wait, i've lost the flow in all these messages, moving ax into ss causes a fault because its illegal.. why?
<zid> what's in ax
<zid> (hint: 0xf)
<rwxr-xr-x> dw 0x0 - dd 0x0, right?
<zid> don't guess
<zid> qemu printed it, and if you scrolled it all off, you can ask it again with info registers
<rwxr-xr-x> okay, the logic here, the way i calc DATA_SEG, which is gdt_data - gdt_start, would be dd 0x0 - dw 0x0, which would bee the second segment in gdt_data
<rwxr-xr-x> wrong though huh?
<rwxr-xr-x> let me look...
<zid> answer the question though?
<zid> https://cdn.discordapp.com/attachments/417023075348119556/1041435234257883146/image.png Sorry for the AT&T I don't know how to make it not do it :p
<zid> (your assembler is probably in the wrong cpu mode after the jmp 8: btw)
<rwxr-xr-x> (qemu) x /1i 0x7c9c
<rwxr-xr-x> 0x00007c9c: 66 b8 0f 00 movw $0xf, %ax
<rwxr-xr-x> yeah
<zid> that's supposed to be mov ds, ax I think
<zid> but it ends up being part of the mov eax
<zid> but the fault is still because ax is being loaded with f
<zid> GDTR= shows.. 0x7C40
<zid> x 1/gx 0x7C40 + 0xF
<zid> will give you the selector you tried to load
<zid> loading SS with a system segment = GPF
<zid> You wanted to load ax with 16 (0x10) not 15
<rwxr-xr-x> yeah...
<zid> x /1gx 0x7C40 + 0x10 -> 0x00af93000000ffff
<rwxr-xr-x> this is so confusing lol
<zid> which is much healthier looking
<zid> It's just addition
<rwxr-xr-x> Yeah i get that, it just shouldn't need it to work
<zid> it shouldn't need addition to work?
<rwxr-xr-x> Why should the program need to be manually offset at a specific register
<zid> because that's what the value in ds/cs/ss etc *means*
<rwxr-xr-x> it feels like fixing an effect, not the cause
<zid> the byte offset into this table to read segmentation information from
<zid> the gdtr itself holds information about the table
<zid> cs/ds/ss/etc hold an offset into the table
<zid> invalid offsets do invalid things
<rwxr-xr-x> huh
<zid> lgdt [blah] load 12 bytes from memory for 'information about a table'
<zid> err 6 bytes
<zid> a 2 byte length, and a 4 byte address
<zid> then cs/ds/ss holds an offset into that table
<zid> that's 100% of everything
<zid> That's why you loaded cs with 8, because the value in your GDTR says the table is at 0x7c40 and 0x7c48 has a thing that looks like a valid code segment descriptor
<zid> cs is only a 16bit register, so if you put the full address into cs you'd have to keep all your selectors within the first 64kB of memory and that'd *suck*, so instead it just holds an offset into a table
<rwxr-xr-x> okay
<rwxr-xr-x> i think i understand
<rwxr-xr-x> so i just have to offset it by 0x10
<zid> got me my qemu patch
<rwxr-xr-x> holy
<rwxr-xr-x> I was supposed to offset the gdt_data code that would be assigned to ds, correct?
<zid> pardon
<zid> you need to load 0x10 into ds
<zid> because that's the offset of your data descriptor in your gdt
* geist yawns
<zid> busy day today, got a patch into qemu to fix capstone, then patched capstone to not use AT&T
<zid> and geist is only just waking up
<geist> yah i shoulda got up a few hours ago
<heat> zid, ew
rwxr-xr-x has quit [Read error: Connection reset by peer]
<heat> AT&T 4LIFE
<zid> Ah yes but
<zid> “let there be light” is clearly destination-first, so this matter was already resolved by Genesis 1:3.
<geist> also good job helping 755 there
<heat> sky syntax when
<zid> intel is sky daddy syntax
<zid> at&t is.. demonic hellspawn syntax?
<zid> yoda syntax
<zid> I should make AT&T C, where the = operator is backwards
<mjg> you, fuck
<geist> note that zid's opinion is just that
<heat> AT&T C comparison
<heat> if (0 != number)
<zid> movl 42, eax? more like 42 = eax; amirite
<heat> that's so wrong
<geist> but assembly isnot C. on that same token should we be upset there are no objects? or that tabs aren't important for nesting, or any other random language?
<heat> movl $42, %eax
<mjg> $42, movl, %eax
<mjg> who is with me
<zid> 1f jmpl when
<geist> left to right seems just as natural to me, it's just different. maintains brain plasticity
<heat> $42 = %eax
<heat> GNU assembler, but in C
<zid> Oh so like BASIC
<mjg> $eax %42 movl
<zid> where you have to tag types with grammar
<zid> %42 is integer 42, $42 is float 42.0 etc
<mjg> and ^42.0 is bitcoin
<heat> ftx moment
<heat> weird fact someone just told me about
<zid> "We've been hacked, also I am flying to argentina with this suitcase with $600M inside, don't ask why"
<heat> XNU supports loading 4K aligned segments in arm64
<geist> interestgig maybe that's used to load a corresponding aligned arm64 translated rosetta thing?
<geist> i was generally under the impression that 4K is solely there to supoprt x86 stuff
<geist> although i guess since you can make fat x86/arm64 binaries there may be more situations where it's necessary
<heat> possibly, but this is just a macho loader hack
<heat> it probably does away with any mmap CoW sharing but oh well
<geist> yah possible
<geist> i gues it worksin the way that hypthetically a completely unaliged ELF binary still works too, you just dont get any sharing, etc
<heat> what do GNU toolchains align on?
<zid> how are you supposed to say mach-o btw, mac-oh I assume, but.. if they're trying to pun macho that opens up two more
<heat> geist, yeah, but traditionally operating systems just ENOEXEC because they can't bother
<geist> yah
<geist> mach-oh i am pretty sure
DoubleJ has joined #osdev
<heat> geist, anyway what do the gnu toolchains (gnu, llvm) align on?
<heat> given that the base page size varies
<geist> i dont htink they align on anything that isn't described in the a linker script
<geist> and there's a linker script for each arch, etc
<heat> lld doesn't have a linker script
<geist> oh you were asking about gnu toolchains
<heat> gnu and llvm
<geist> what lld does? beats me. probalby just has it hard coded per arch
<heat> GNU-like
<geist> it also supports less arches, so less to worry about
<heat> i thought you'd know by just, you know, looking at stuff
<heat> I'm specifically asking about ARM
<geist> yeah but i dont really use lld
<heat> 64
<geist> ah, well the ABI says you should align on 64k, so it probably does that
<geist> unless you override it
<geist> that's a case where there's a moern arch that has an ABI that says what you're supposed to do
<geist> but of course the triple could override that
<heat> heh
<geist> but to be clear arm64 specifies a 64k alignment for segments (not sections per se) but segments (where the permissions change in the ELF binary) to allow you to load a single ELF file on a kernel running with 4, 16k, or 64k pages and still get COW, etc
<heat> yeah
<geist> so since there are generally at most 3 segments (RX, R, and RW) it's not *too* bad
<geist> and depending on if you allow the pages in the bianry to overlap, it doesn't necessarily make the binary any bigger
<geist> by default gcc/ld seems to allow overlapping, and clang/llvm doesn't (which pads out the binary a lot, usually by about 128k)
<geist> the latter is more secure since it allows less gadgets (ie, ro/data pages mapped i the text segment with +x permissions)
<heat> yeah
<heat> tldr praise 4k
<heat> the eternal page size
<geist> i htink what we do for fuchsia is the non overlapped, but we override -mmax-page-size=4k
<geist> which i think will bite us in the butt if we evere try for 16k pages, etc
* Ermine screams in 16k
<Ermine> Mac M1 uses 16k for some reason.
<geist> yep. well more importantly apple ARM64 stuff uses 16k pages for years
<geist> ie, iphone/ios, it's just now exposed to desktop users
<geist> the 'for some reason' is it's probably much more efficient speed wise, at the expense of maybe using more memory
<geist> it's a little hard to measure until you do it, but there are some hardware benefits to using less, larger pages
<geist> especially on a system like M1 which iirc has a crapton of TLB entries, i think
<geist> right off the bat it effectively expands the size of your TLB cache by 4x
<gog> hi
<geist> teh gog!
<gog> is the tlb on arm different in that each one can indepedently track a page of varying size, because iirc on most amd64 they have fixed-size tags
<geist> yes
<gog> so there are only a handful of 1GB, more 2GB and then a bunch of 4k
<gog> 2MiB
<geist> ARM has fully unified TLB, as well as most AMD machines. it's really intel x86 that has the split stuff
<gog> ahhh ok
<geist> i thought AMD only did that with zen, but someone at work pointed out that AMD has had a unified TLB since about K8 or K10
<geist> clearly that's harder to implement in the TLB matching hardware, and probably adds a bit more gate delay in something that has to be hella fast, but its a case of a deeply optimized thing in either direction
GeDaMo has quit [Quit: I'm going to show these people something you don't want them to see. I'm going to show them a world without you.]
gareppa has quit [Quit: Leaving]
<mrvn> On AMD64 the default pagesize is 2MB and that padds the binaries alot. But gcc seems to have it's own linker script and seems to do some magic depending on size or something.
<geist> at some point he dfault max pagesize was 32KB which was strange and suited no one
<geist> i dunno if that changed to 2MB at some point ,which actuallym akes sense
<mrvn> geist: it's 2MB. You get hit with that on your kernels sometimes and your multiboot header ends up 2MB into the binary and doesn't work.
<mrvn> You have to add the linker option for 4k page size to get the multiboot header into the first 8k sometimes.
<mrvn> As for the TLB matching hardware: it turns the address compare from a 2-way AND + 56-way AND into a 3-way AND + 56-way AND. Or 2/3-way NAND + 56-way OR. I'm not sure that makes a noticeable difference.
* geist nods
<geist> yeah, i think the L1 TLB matchers have to be done at least within a single cycle, so it's definitely critical path
<geist> but i'm sure that's highly highly optimized (at the expense of space)
<mrvn> Having a 56bit compare hardware for every TLB entry must be huge in gate counts.
<geist> yah
<geist> well, it'sd not full 56 bit, but it's still a lot of bits
<mrvn> well, less for CPUs that don't have 64bit virtual address space
<geist> right
<geist> so it's something more like 48 - 12 bits, but still 36 bits is a lot
<mrvn> 48 bits virtual, 12 bit at least for page leaving 36bit to compare here.
<geist> but it also has to mux the matching logic based on the page size being tested for + the extra test to see if the TLB matches it
<mrvn> What's the biggest now? 57 bits?
<geist> on x86, yeah 57 - 12 bits in this case
<mrvn> geist: MUX? Nah, address & TLB address & TLB mask.
<geist> largest i know of personally would be itanium which would be 64 - 3 (3 top level regions, presumably tagged differently) - 12 bits for page size
<geist> er 8 top level regions, each with their own ASID
<geist> of course, with ASIDS and PCIDs that's another parallel compare that's also happenining
<geist> that must be anded in at the end
<geist> but doesn't really make it deeper here
<mrvn> hmm, not sure. Can't you have the same address in the TLB for different PCIDs?
<geist> absolutely
<geist> sio you have to in addition to all this address matching also match the PCID/ASID
<mrvn> Then you have to AND that in earlier or you get 2 hits before you mask out one.
<geist> possibly, yeah
<mrvn> So back to 48 - 57 bits to compare.
<geist> i honestly dont know what the state of the hard fast test for equality of a bunch of bits looks like, but i assume for somethingl ike there's there are gate level tricks for it
<mrvn> You might safe some bits because the way TLB slots are assigned to addresses.#
<geist> so that it's not just a chain of gates
<mrvn> I would probably XOR the address and TLB address with a bus driver output. I.e. only output something when the bits don't match, then connect all the bits to a common line and negate that.
<mrvn> + a pull down
* geist nods
<mrvn> Should give you a 3 gate depth regardless of the number of bits.
<mrvn> The TLB entry size then just enables/disables some of the bus drivers so the lower bits get ignored depending on size.
<geist> yah, i think that's probably totally possible in an ASIC but not sure you can do that in an FPGA
<mrvn> You connect the MASK as input to the bus drivers and the address XOR to the enable.
<geist> FPGAs tend to be somewhat stricter about everything is a gate or a mux and you dont have any of these shared line things, but then that's just a different technology
epony has quit [Ping timeout: 268 seconds]
<mrvn> a shared line is just etching a channel connecting all the outputs. Shouldn't be that hard.
<geist> i think with an FPGA you probably at best end up with a bunch of 6:1 muxes with a truth table chained together
<geist> so you get a tree but with a fan out of 6:1
<geist> so only a few levels for a large test like that
<geist> s/muxes/rom
<mrvn> Oh, you mean when you implement that with FPGA logic units. That's way harder than a dedicated address compare circuit.
<geist> yah
<mrvn> They should have buses though.
<mrvn> You might have to loop a bus output back to an input of the chips or something.
<geist> not that i know of.i dont think you can really express any sort of open drain or floating things in fpgas at all
<geist> without emulating them
<mrvn> not in the normal LUTs, no.
<mrvn> No floating in the truth tables.
<geist> and i assume the connection of a LUT to a bus is basically hard coded, ie part of the bitfile you feed into it
<geist> and not dynamically configurable as another latch
Burgundy has quit [Ping timeout: 256 seconds]
bgs has quit [Remote host closed the connection]
vdamewood has quit [Ping timeout: 260 seconds]
epony has joined #osdev
Burgundy has joined #osdev
rwxr-xr-x has joined #osdev
<rwxr-xr-x> You still here zid?
xenos1984 has quit [Read error: Connection reset by peer]
<gog> hi
<rwxr-xr-x> hey gog!
<gog> i'm still here rwxr-xr-x
<rwxr-xr-x> how's it going?
<gog> can i call you 755
<rwxr-xr-x> yeah LOL
<gog> :D
<rwxr-xr-x> that's smart!
<rwxr-xr-x> I didn't think of that
<gog> <- smort gorl
gorgonical has joined #osdev
<gorgonical> Conference speaking never gets easy
<gorgonical> So frightening
<gog> how do you feel about karaoke while sober
<gorgonical> Also horrifying
<rwxr-xr-x> its the perfect crime
<rwxr-xr-x> sing your best, and if they hate it, say you were drunk!
<gorgonical> Even like booth karaoke is frightening when sober
<gog> i did 3 songs a few weeks ago
<gog> and i only had one beer
<rwxr-xr-x> shit
<rwxr-xr-x> wow
<rwxr-xr-x> i would fucking DIE
<gorgonical> Cost like 400 isk, that beer I bet
<gog> 1200
<gorgonical> I forgot the exchange rate
<gog> inflation is bad here
<gorgonical> That's pretty bad. That's like airport prices
<gog> yeh
<gog> that was just the beginning of the night tho
<gorgonical> I mean when I was there it was expensive, too but I was even at the tourist bars and it wasn't that bad
elastic_dog has quit [Ping timeout: 240 seconds]
<gog> yeh
elastic_dog has joined #osdev
<gorgonical> do locals ever go to that lebowski bar, gog
<gog> yeh me and my work friends go there sometimes
<gog> i always get the brant
<zid> That sounds like a euphamism
<gorgonical> That's somewhat surprising to me. I always thought it was for tourists. I guess reykjavik's not big enough to be picky huh
<zid> You do a rotation of the 4 businesses
<zid> 5th day you worship moss, then you repeat
<gog> nah lebo is just cheap
<gog> compared to a lot of burger joints
<gog> zid: i'm an alichenist
<gog> sorry
<gorgonical> I went to aktu-taktu for the novelty and that was outrageous
<zid> You must get bored every 5th day then
<gog> i've never been to aktu-taktu
<gog> or metro
<zid> gog: How much is a tree on the black market there?
<gog> hah
<gog> it's easier to get a nuke
<gorgonical> i think i got a cheeseburger with fries and a drink and it was nearly $20 usd
<zid> so like, half london prices
<zid> not bad for a capital
<\Test_User> could I trade ya a tree for a nuke? :P
<gorgonical> zid: how much does mcdonald's cost there??
<gog> yeah $20 is about what you'd pay at a more upscale place
<zid> about 40 grand in parking
<gog> burger, fries and beer at lebo is about $18
<mrvn> It's 3 EUR for a Döner on Mondays here.
<rwxr-xr-x> okay, now that i'm back, let me jump back into this shithole code
<zid> oh hey it back
<rwxr-xr-x> yup
<rwxr-xr-x> okay, the last thing i rushed in was mov bx, 0x10
<rwxr-xr-x> mov ds, bx
<zid> (seriously, parking in london is like $15)
<rwxr-xr-x> can't remember why lol
<rwxr-xr-x> wait what?
<zid> because you got mad at ax
xenos1984 has joined #osdev
<rwxr-xr-x> i recall nothing
<mrvn> rwxr-xr-x: is that loading the value 0x10 or the memory at 0x10? What asm syntax?
<rwxr-xr-x> Oh shit
<rwxr-xr-x> that's true
<rwxr-xr-x> let me check
<mrvn> what's in bx when you single step it?
<mrvn> i hate mondays
puck has quit [Excess Flood]
puck has joined #osdev
gorgonical has quit [Ping timeout: 256 seconds]
<gog> i like mondays
<gog> thursdays are what's hard
<rwxr-xr-x> its sunday rn i don't know what y'all are on
<zid> mondays is when bookworm comes out, it's the best day
<gog> it's monday in an hour for me
<zid> 58 minutes to go, by so solid crew
<rwxr-xr-x> mrvn how can I single step in qemu?
<zid> you can't
<zid> gdb can, but I wouldn't try it in 16bit mode, but.. technically you're past that so you could
<zid> did you remember to switch your nasm to bits 32 after your long jump yet?
<zid> you were mis-assembling before
<rwxr-xr-x> wdym??
<zid> your cpu has gone from 16bit instructions
<zid> to 32bit instructions
<zid> but you apparently never told your assembler that it happened
<zid> so when you write 'mov ax, ...' the cpu sees 'mov eax, ...'
<rwxr-xr-x> every time i make a long jump i use [bits 32]
<zid> the binary you sent me was fucky and hadn't done that properly in the right spot, at least
<rwxr-xr-x> what if I make a repo and stick all the relevant files and send it
<rwxr-xr-x> would get rid of it
<zid> You had B8 0F 00 8E D8 which was supposed to be "mov ax, 0xF; mov ds, ax" but that's 16bit, in 32bit that reads as 'mov eax, 0xde8e000f'
<zid> And I am assuming you wrote mov ax, 0xf; mov ds, ax; and not infact, mov eax, 0xde8e00f
<rwxr-xr-x> mov ax, DATA_SEG; mov ds, ax
<rwxr-xr-x> yeah
<rwxr-xr-x> wait a minute
<rwxr-xr-x> let me stick this in a gist
<bslsk05> ​gist.github.com: switch_pm.asm · GitHub
<rwxr-xr-x> i wanna see if you see what i do
<rwxr-xr-x> just let me know if anything jumps out
<zid> yea that one looks correct
Burgundy has quit [Ping timeout: 256 seconds]
<rwxr-xr-x> alright
<bslsk05> ​file.io <no title>
<zid> baleeted
<rwxr-xr-x> FUCK
<bslsk05> ​'projects' by [idk] (--:--:--)
<zid> how are you ensuring the right part ends up at 0x7C00 when you link this?
<rwxr-xr-x> what do you mean?
<zid> you want the first instruction first in your binary
<rwxr-xr-x> well yeah
<rwxr-xr-x> that's how first works
<zid> so then the question
<zid> how are you ensuring the right part ends up at 0x7C00 when you link this?
<rwxr-xr-x> At the beginning of the main file, boot.asm, i use [org 0x7c00]
<rwxr-xr-x> offsets everything by 0x7c00
<zid> no it doesn't
<zid> It tells that file that instructions referencing labels should add 0x7C00
<zid> it does nothing to cause certain files' contents to appear in a certain order in the output
<rwxr-xr-x> okay, i haven't looked at anything you've just said, i just have to say this
<rwxr-xr-x> i just looked up 'org asm' in google on accident LOL
<zid> That seems to be a running theme
<rwxr-xr-x> org assembly
<rwxr-xr-x> shit man
<rwxr-xr-x> so org adds 0x7c00 to any labels in boot.asm
<rwxr-xr-x> nowhere else
<\Test_User> yes
<zid> nor does it guarentee any kind of ordering
<rwxr-xr-x> which is what i need rn
<\Test_User> you need to tell the linker where to put the different sections in the final file
<\Test_User> (unless you're not using a linker and just assembling straight to a binary, then it's different)
<zid> I think he is but idk how he does that
<zid> I asked
<zid> but he didn't even understand the question :D
<rwxr-xr-x> 2 commands
<rwxr-xr-x> nasm -fbin noot.asm -o test,bin
<\Test_User> so no linker
<rwxr-xr-x> qemu -fda test.bin -no-shutdown -no-reboot -d int -monitor stdio
<rwxr-xr-x> nope
<zid> okay so all thje other files in here are red herrings
<zid> and the only one that matters is pingu.asm
<\Test_User> you can specify a start=<x> in sections, or if using only one section it'll always be at 0 already
<\Test_User> one/none
<klange> pro type: `-serial mon:stdio`, multiplex serial and monitor on the same tty, switch with `ctrl+a c`
<klange> protip
<klange> even
<klange> need caffeine
<zid> crap was it AA 55 or 55 AA I can never remember
<\Test_User> if qemu boots it that's right
<zid> haha
<\Test_User> I think it's 55AA in the final file and AA55 in dw bc little endian
<klange> 55 aa
<klange> bah, do it with two bytes so you won't be confused
<rwxr-xr-x> dw 0xaa55
<zid> oh I see, it's copy pasting shit with %include
<rwxr-xr-x> little endian confused the shit out of me at first because of the magic word lol
<rwxr-xr-x> i was like why the hell did it get reversed????
<zid> I'm getting close to getting this building properly, lots of globals and externs to add, I started while I waited for an answer and almost finished, so I thought fuck it might as well carry on
<zid> will serve as an example later
<rwxr-xr-x> what question are youwaiting on?
<zid> I'm not anymore
<rwxr-xr-x> im multitasking here, ive lost about 4 questions to noise
<rwxr-xr-x> got it
<zid> fuu just dleted a file I wanted to keep
<zid> bitten for the billionth time that objcopy doesn't need -o also
<rwxr-xr-x> man i fuckin hate 32 protected mode
<rwxr-xr-x> shit is so confusing
<\Test_User> wait till ya get to 64-bit mode
<rwxr-xr-x> oh christ
<rwxr-xr-x> i should really learn assembly more
<zid> 64bit is easier
<\Test_User> but when confused at this level
<\Test_User> sure once you're started 64-bit isn't really hard to deal with
<zid> test.bin: DOS/MBR boot sector
<zid> seems to have worked at least
<heat> operating system
<zid> oh hey it prints 'Started in 16-bnit real mode' too, good enough for me
<rwxr-xr-x> thats what it should do
<rwxr-xr-x> only half of it
<rwxr-xr-x> yo what the FUCK
<rwxr-xr-x> i downloaded the code off the github os-tutorial i was following and it works
<rwxr-xr-x> im gonna compare all of it
<rwxr-xr-x> brb
<bslsk05> ​zid/rwx - feedback to rwx (0 forks/0 stargazers)
<zid> There we go
<zid> I added a proper build system cus why the fuck not
<\Test_User> yeah that one tutorial is a bit broken, doesn't actually run on my physical computer bc it's missing some stuff
<\Test_User> and idr what the other issues I had with it was
<zid> I am apparently bored today, waiting for bookworm
<bslsk05> ​github.com: Build system · zid/rwx@05230b8 · GitHub
<zid> oh should probably delete the times db stuff eh
<heat> good guy zid helping people out
<zid> maybe in 2 months when he can understand it :P
<zid> I should just read this novel I started and listen to the undertale OST like I was doing
<heat> actually i can't count in hex
<heat> can you help
<zid> sure
<zid> http://shogun.rm-f.net/~zid/count3.html stare at this for the next hour
<bslsk05> ​shogun.rm-f.net <no title>
<zid> then get back to me
<zid> oh wait is that base 7 or something
<bslsk05> ​shogun.rm-f.net <no title>
<heat> i said hex stupid
<heat> i don get it
<heat> why magic letter come up
<clever> i just have a tiny text file, with 0-f, 0000-1111, and 0-15, each in a seperate column
<clever> and then i printed it out on a scrap of paper
<clever> that allows easily converting between hex and binary, one nibble at a time
<zid> Thanks clever
<heat> 0x9, 0x10a right???
<rwxr-xr-x> im back
<rwxr-xr-x> got it to run
<rwxr-xr-x> reverting gdt descriptor back to the old code and adding the old db 0x0's to code and data segments
<rwxr-xr-x> oh yo
<rwxr-xr-x> nice github
<rwxr-xr-x> mind giving me a crash course in linkers?
<zid> object files go in, linker gives things addresses, binaries come out
<zid> object files may reference each other's data/code and the linker resolves that and puts the right addresses in
<zid> (after deciding what that address will be)
<rwxr-xr-x> cool!
<rwxr-xr-x> what's needed to build using a linker?
<rwxr-xr-x> i can't use nasm and qemu alone to use it correct?
<rwxr-xr-x> it won't use it automatically
<zid> global/extern pairs in your .asm files