Realmode Assembly – Hello World Bootloader
0x00sec.org
0x00sec.org
I used to teach an Asm course, and a lot of my students were wondering why we started with 16-bit, single-segment DOS COM programs --- being used to multi-KB or MB apps that don't do much, they thought it'd be impossible; and yet came away with a completely new perspective on how far away that 64KB limit seems, even if you're writing moderately complex programs.
For UEFI, I believe this article here has been posted on HN before: http://www.rodsbooks.com/efi-programming/hello.html
A quick result yields various results across the internet: https://duckduckgo.com/?q=uefi+bootloader+hello+world&t=ffip...
"perl cgi" can be not used at all, but today's x86 machines still boot in realmode and you can already do a lot of interesting things there.
while there is a clear lack of good introductory articles on how to create minimalistic kernels using a stack like Core boot, uefi, TianoCore
That could be explained by the massive increase in complexity that UEFI entails compared to BIOS. Presumably it is only after you have gotten everything working with the BIOS that will prepare you to tackle UEFI; but speaking as someone with many years of experience with the former, and even read the BIOS source listings from the original IBM manuals, the UEFI spec was still ridiculously dense and if I were writing my own OS I would definitely choose the BIOS.
Related reading from someone who has written his own, now rather famous, OS: http://yarchive.net/comp/linux/efi.html
But if you're just planning on writing very simple text programs in ASM, then the only things that are really relevant is the text display, keyboard, and possibly disk/floppy. The text display is exactly the same (assuming the GDT from grub places it at the same location), but the keyboard is a fair amount more involved, and floppy is basically impossible (without writing a fairly involved driver). An IDE driver is surprisingly simple though (But still requires an interrupt, as does the keyboard). Both of these things are basically functions calls when you still have the BIOS around, so it does create a bit of a problem.
Basically, one would have to setup multiple registers like the GDT which sets the protection on different memory ranges (hence protected mode). Once you have your GDT setup, set a few bits in CR registers and execute a long jump to the code segment of the GDT (provided you have instructions loaded there).
Then once in protected mode, everything changes. The system allows you to set interrupts habdlndlers through the LIDT, to enable memory paging and you'll have to reload the GDT again. But no more access to the convenient BIOS functions.
You also set up the PIC of your system to get a ticking clock for scheduling your kernel operations. Once you got all that is where the fun begins and you can start implementing memory managers and allocators, writing a disk operations layer and implement (or write your own!) filesystem.
OS Dev is truly a fascinating subject because there's so much to learn. Even more with 64-bit, and multiple core initialization and usage.
I don't know how all of this works on ARM, but I might order myself an experimentation board to get my hands on.
its not _really_ worth it, but if you're just noodling around and want to send packets or write to disks you don't have to write drivers. of course you have to have dedicated buffers visible in both spaces.
the only other reason i can think of to use real mode is to actually explore the segment model rather than just treating it as trash you have to walk over to get something up from reset...but it would probably be better just to invent some kind of segmented virtual machine