<geist>
the obvious example of all of this is something like tcp/ip headers. if you mark them all as packed (as they need to be) you end up with terribad performance
<geist>
even if they happened to be aligned in whatever buffer you have
<clever>
ive also run into trouble, when i had a packed struct for reading the MBR, which turns out to be mis-aligned
<clever>
gcc initially assumed it would be mis-aligned, and did byte-wise access
<geist>
yeah MBR and FAT stuff is really bad. you're basically better off manually unpacking them into something padded out
<clever>
but when i turned on -O, it then started doing misaligned reads, and faulted
<geist>
in the caseof tcp/ip manually reading things out and endian swapping almost makes the most sense anyway
<clever>
the sub-struct for a single mbr partition was internally aligned, so i fixed it with just a memcpy to an aligned buffer
<geist>
having a packed and unpacked+swapped version of the header that you operate on
<geist>
actually i kinda wonder what Real Stacks do there
<clever>
the ext2 driver in LK does similar
<geist>
or if they just dont give a crap because decent architectures let you misalign
<geist>
clever: yeah that's cause i wrote it and was fiddling with that idea
<clever>
a function will byte-swap all of the fields in-place, if your cpu disagrees
<geist>
whether or not it's a good idea....
<clever>
i like that design
<clever>
you dont need to keep track of what fields need a swap and what dont
<geist>
yeah i think the issue is it's a modal thing that you have to make sure you do exactly once, and consistently
<clever>
the only other way you could do things safely, is to have LE and BE 32bit int types
<geist>
in C++ i guess you could put some class around it with a bool or something that tracks if you did
<clever>
and have the compiler enforce that a function wanting it in native, can only accept LE (if that is native)
<clever>
and passing any BE int, would be a type error
<clever>
or perhaps, have 3 types, LE, BE, native
<geist>
also flip side is modern cpus can byte swap without much problem, so you could also just have some sort of byte swapped accessors. that's probalby the C++ way and define BE types, etc
<clever>
and a function to convert to/from native
<clever>
yeah, having a set/get method on a class could work
<clever>
and if they can be inlined, it will entirely vanish at compile time
<geist>
could even turn off the tracking part for release builds
<geist>
to try to catch mismatches in debug builds
<clever>
or just make the raw struct private
<clever>
use the getter, or your never seeing it
<kingoffrance>
you are approaching meta clever. one small step to sign and magnitude ints. one small step back to lovely >=8 bits char, no more uint8_t etc.
<geist>
ah yeah not a huge fan of just accessors everywhere, but you *could* do some thing like load the struct, then first time you get() a pointer to the struct it swaps all of them
<clever>
ah, that can also work
<clever>
and track if its in network/disk or host order
<geist>
but then you have to have this bool to track that you did, and it'd get tested in every get(), etc
<clever>
so when you want to write it back to network/disk, you can decide if it needs a convert
<geist>
but could easily templatize some sort of wrapper thing around structs that way i guess
<geist>
would still need a swap() method defined for the struct, but then you just do that once
dude12312414 has quit [Remote host closed the connection]
dude12312414 has joined #osdev
Oli has quit [Quit: leaving]
Oli has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
Burgundy has joined #osdev
ElectronApps has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
bradd has quit [Ping timeout: 252 seconds]
sdfgsdfgDropBear has quit [Read error: Connection reset by peer]
sdfgsdfgDropBear has joined #osdev
sdfgsdfgDropBear has quit [Client Quit]
ElectronApps has quit [Remote host closed the connection]
nyah has joined #osdev
<klange>
I updated my infamous PDF/ISO résumé. Slapped the MuPDF package on the disk, added a little startup script to detect the CD, ensure it's mounted, and install that package from it, then it adds a little desktop shortcut to open itself.
junon has quit [Ping timeout: 265 seconds]
<klange>
Backported some of that to the regular CD, so it automounts the disk if it can find it, and you get a "CD-ROM" shortcut. Works in VBox, VMware, QEMU, and Bochs... if you use IDE. I'll get the AHCI stuff eventually, it's still in progress...
ElectronApps has joined #osdev
sdfgsdfgDropBear has joined #osdev
GeDaMo has joined #osdev
junon has joined #osdev
<sortie>
Is the .iso itself technically also a .pdf?
<klange>
Yes. PDF at the front and back, the ISO is a raw embedded file with just the right amount of data at the front chopped off for the main sector to be in the right place.
<sortie>
Sweeet
<klange>
I used to also do some nonsense to set up an MBR jump back when it was using grub, but the native Toaru loader versions are just EFI + El Torito, so there's nothing at the front to worry about.
dormito has quit [Quit: WeeChat 3.1]
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
opios2 has joined #osdev
sdfgsdfgDropBear has quit [Quit: sdfgsdfgDropBear]
sdfgsdfgDropBear has joined #osdev
sdfgsdfgDropBear has quit [Client Quit]
dormito has joined #osdev
sdfgsdfgDropBear has joined #osdev
junon has quit [Ping timeout: 265 seconds]
sdfgsdfgDropBear has quit [Ping timeout: 265 seconds]
sdfgsdfgDropBear has joined #osdev
sdfgsdfgDropBear has quit [Quit: sdfgsdfgDropBear]
[itchyjunk] has joined #osdev
ahalaney has joined #osdev
happy-dude has quit [Write error: Connection reset by peer]
novasharper has quit [Read error: Connection reset by peer]
paulusASol has quit [Read error: Connection reset by peer]
happy-dude has joined #osdev
k0valski has quit [Quit: Peace out !]
k0valski has joined #osdev
paulusASol has joined #osdev
novasharper has joined #osdev
srjek|home has joined #osdev
sprock has quit [Ping timeout: 265 seconds]
nur has quit [Remote host closed the connection]
freakazoid343 has quit [Ping timeout: 246 seconds]
nur has joined #osdev
Cyro has joined #osdev
<ZetItUp>
hmm im trying to get bochs to run my os, but on boot it says [PIC ] >>PANIC<< slave: not 80x86 mode
<ZetItUp>
can't find any info on what that means really
<ZetItUp>
is the PIC not set up correctly?
Arthuria has joined #osdev
rorx has quit [Ping timeout: 252 seconds]
[itchyjunk] has quit [Read error: Connection reset by peer]
rorx has joined #osdev
srjek|home has quit [Ping timeout: 245 seconds]
sprock has joined #osdev
<zid>
sounds like it
<zid>
the PIC has an actual 8086 mode
<zid>
ICW43
<zid>
ICW4* 0uPMIf set (1), it is in 80x86 mode. Cleared if MCS-80/86 mode