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
sprock has joined #osdev
NeoCron has quit [Remote host closed the connection]
PapaFrog has joined #osdev
<geist> corecode: yeah i dunno. use packed sparingly
sdfgsdfgDropBear has joined #osdev
<kazinsal> would __attribute__((packed, aligned(4))) be the magic to tell the compiler the struct is aligned to a 4-byte boundary?
<kazinsal> or is that the one that would tell it to ensure that the variables inside the struct are all padded to be aligned to 4-byte boundaries
<kazinsal> never been good at remembering all the semantics of wild gcc attributes
<geist> i think i tried all of those, but lemme see
<geist> actually yeah that does seem kinda sufficient: https://gcc.godbolt.org/z/nr5WYe3Tx
<geist> without the char in there it does the right thing, and even with the misalignment on the latter part it tries
<geist> but only seems to work well on the struct itself. what would be nice is forcing it through a pointer that then 'inflicts' the alignment on it
<geist> ie, test the pointer, but if it is aligned, then cast it to something equivalent that's aligned
<geist> https://gcc.godbolt.org/z/E74ff1b4o doesn't quite work since it seems to optimize it out
<geist> -O does the right thing though
<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
<geist> something like... https://gcc.godbolt.org/z/PPTs9eWMc
<geist> https://gcc.godbolt.org/z/4xPvnz6Eq to let you load it
h4zel has quit [Ping timeout: 252 seconds]
nyah has quit [Ping timeout: 265 seconds]
dude12312414 has joined #osdev
srjek|home has quit [Ping timeout: 245 seconds]
sts-q has joined #osdev
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
<zid> Sounds like you set bit 0 of ICW4
<zid> Err unset
<clever> what? :O
ElectronApps has quit [Remote host closed the connection]
<zid> Not just PCs used the 8259A, disgraceful behavior imo
<zid> using a chip from a PC in another product and using features that x86 doesn't
<ZetItUp> seems like my outb/inb/inw is not working correctly, getting errors on inw() now
<ZetItUp> took a while to find that out hehe
dh` has quit [Ping timeout: 245 seconds]
<ZetItUp> well that was like 8 hours wasted
<ZetItUp> i never initialized the data buffer :|
<ZetItUp> "Im getting page fault errors, must be something wrong with my paging code, or the ata driver
<ZetItUp> "
<dzwdz> oh hey, you're working on an ata driver too?
<dzwdz> i've started implementing mine like 2 days ago
<ZetItUp> well trying to get it to read a sector, seems to "work" now
<Cyro> nice
<ZetItUp> some bad workarounds but it works :D
Cyro has quit [Remote host closed the connection]
mctpyt has joined #osdev
bgs has joined #osdev
Oli has quit [Quit: leaving]
MohrgMarsh has quit [Ping timeout: 245 seconds]
mahmutov has joined #osdev
MiningMarsh has joined #osdev
Arthuria has quit [Ping timeout: 260 seconds]
pretty_dumm_guy has joined #osdev
freakazoid343 has joined #osdev
sprock has quit [Ping timeout: 265 seconds]
Kartikeya has quit [Ping timeout: 245 seconds]
Kartikeya has joined #osdev
sprock has joined #osdev
Kartikeya has quit [Ping timeout: 265 seconds]
freakazoid343 has quit [Ping timeout: 246 seconds]
[itchyjunk] has joined #osdev
Oli has joined #osdev
kuler has joined #osdev
kuler has quit [Remote host closed the connection]
Kartikeya has joined #osdev
noircode has joined #osdev
Kartikeya has quit [Ping timeout: 252 seconds]
Oli has quit [Read error: Connection reset by peer]
srjek|home has joined #osdev
freakazoid343 has joined #osdev
<gog> mew
<mjg> burp
Oli has joined #osdev
<geist> Slurm
<j`ey> Slurm McKenzie
sprock has quit [Ping timeout: 252 seconds]
freakazoid343 has quit [Ping timeout: 265 seconds]
ajhalaney has joined #osdev
crm has joined #osdev
ahalaney has quit [Ping timeout: 252 seconds]
orthoplex64 has quit [Ping timeout: 252 seconds]
fkrauthan has quit [Ping timeout: 252 seconds]
fkrauthan has joined #osdev
Kartikeya has joined #osdev
freakazoid12345 has joined #osdev
sprock has joined #osdev
GeDaMo has quit [Quit: Leaving.]
Kartikeya is now known as kkd
wootehfoot has joined #osdev
Burgundy has quit [Ping timeout: 252 seconds]
dormito has quit [Quit: WeeChat 3.1]
sprock has quit [Ping timeout: 252 seconds]
ss4 has joined #osdev
wootehfoot has quit [Ping timeout: 245 seconds]
vdamewood has joined #osdev
vinleod has joined #osdev
vdamewood has quit [Ping timeout: 260 seconds]
ajhalaney has quit [Quit: Leaving]
freakazoid12345 has quit [Ping timeout: 265 seconds]
dormito has joined #osdev
gioyik has joined #osdev
srjek|home has quit [Ping timeout: 245 seconds]
xenos1984 has joined #osdev
elastic_dog has quit [Ping timeout: 265 seconds]
freakazoid12345 has joined #osdev
elastic_dog has joined #osdev
crm is now known as orthoplex64
h4zel has joined #osdev
wootehfoot has joined #osdev
ss4 has quit [Ping timeout: 245 seconds]
vinleod is now known as vdamewood
freakazoid12345 has quit [Ping timeout: 265 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
Brnocrist has quit [Ping timeout: 252 seconds]
Brnocrist has joined #osdev
jjuran_ has joined #osdev
jjuran has quit [Ping timeout: 265 seconds]
jjuran_ is now known as jjuran
dude12312414 has joined #osdev
jjuran has quit [Ping timeout: 245 seconds]
jjuran has joined #osdev
srjek|home has joined #osdev