inflater wrote:
Then, you must develop a kernel. You have two choices:
- REAL mode (memory up to 640K), 16-bit OS
- PROTECTED mode (32-bit OS)
You must remember, that you must NOT call any DOS functions - it wont work. In protected mode you must not call any BIOS functions too.
That's not true anymore. Also, the distinction has sub-options that include their own limits.
You nowadays (since 4.5 years or so) have the choices of:
- Realmode, plain
- Realmode, as v86 mode in protected mode, you can do this if you regularly want to call some function in pmode or such, but usually want to work in realmode
- Protected mode, non-paged flat (no paging, no segmentation)
- Protected mode, paged flat (most common choice, Windows and Linux both use this, paging but no segmentation)
- Protected mode, non-paged segmented (no paging but some segmentation, easiest for embedded applications, since they usually boot once and stay in memory and this allows boot-time moving anywhere without relocation)
- Protected mode, paged segmented (not common, pretty hard to get right and only used in one common OS, OS/2)
- Long mode (and this is easy again, since you can't do any of the jokes mentioned above).
Then, for the paged pmode items you can choose either non-PAE for supporting more CPU's or PAE to support more memory (but less CPU's).
For my OS, I'm choosing these three common targets:
- Protected mode, paged flat without PAE
- Protected mode, paged flat with PAE
- Long mode
My boot loader supports booting to realmode, pmode paged with and without PAE and longmode, all from either a plain binary (entrypoint assumed to be the first byte - like a really big bootsector) or a plain ELF file in the appropriate format (which is checked). The only combination not supported is ELF in realmode, because there is no ELF standard for 16-bit code (afaik). If you know about a 16-bit ELF standard, tell me and I'll add it
That's a tad of a lie, the previous paragraph, I'm still hacking on the 32-bit support and the 32-bit pae target isn't baked in yet. Also, the paging setup is still in the ELF loader for 32-bit targets so you get an unpaged pmode for the hello world.