Show HN: xOS – a 32-bit OS for the PC
github.com
github.com
It just makes you so much better at dealing with all the shit your future career will throw at you.
Congrats, great job!
Getting into long mode itself is just a tiny bit of boilerplate at the very beginning. If you didn't plan on using paging then you need to do a bit more work to identity map everything, but if you already did the extra virtual address space means you can just map all physical addresses (that are hooked up to anything) linearly somewhere and not have to play games with mapping/unmapping things just so the kernel can access them briefly. You lose the ability to have the processor save state on context switch for you via the TSS, but that's not very hard to do yourself either. The ins and outs of running something in compatibility mode are quite complicated, but there's no reason to involve yourself in that if you're writing your own toy OS.
Overall I'd say 32-bit dodges a few things, but I wouldn't call it much easier.
x86-64 uses a 4-level page-table, which is much more annoying to get right then a 2-level page-table if you're not familiar with paging or haven't dealt with it before.
I agree about TSS - nobody really bothers using it anyway. That said, x86-64 has a bit more state to handle when doing a context-switch (Though nothing very extreme)
x86-64's calling convention is more complex then x86's calling convention. For this project it doesn't really apply because it isn't followed anyway, but for a C project it would come into play.
IMO, another big issue with doing x86-64 is documentation - x86 has tons, x86-64 has comparatively little.
I would definitely agree that if you know what you're doing the differences aren't huge, but if you don't know what you're doing I think you'll definitely have an easier time getting stuff working with x86.
Depending on your coding style though I'm not sure how much it would really come into play - x86 is registered starved, but it also allowed memory addresses in lots of instructions, allowing you to avoid putting things into registers in the first place. You get twice the number of registers with x86-64, but his code doesn't really appear to be suffering for not having enough registers to begin with.
But for someone learning this stuff, limiting the complexity you have to deal with is a good idea.
If you want to write an OS with a GUI on modern x86 hardware from scratch, there is an insane amount of stuff you have to do to support a generic keyboard, mouse, and display before you can do any work on your OS proper.
He's not alone in this, but the way; another OS author wrote "it probably never will support anything other than AT-harddisks, as that’s all I have :-(."
Sounds like he needs to go to SV, I think he'd fit right in.
Edit: I should elaborate: it's hard to put these sorts of analytical skills to use in medicine, without banging your head against the wall. I've met some brilliant software developers who happen to be doctors. They are universally frustrated by their working environment.
When I was 15, I'm not interested in learning computer programming yet. Mostly just played games, like Duke Nukem 3D or :/
Curiosly, it was a book about computer virus programming (obviously in assembly) which hooked me into coding :D