OS as UEFI application
Posted: Fri Jun 26, 2020 7:47 pm
So, I have a question: right now my kernel is BIOS-only. I'd like to transition away from that and use UEFI. However, paging is tripping me up.
The Paging article uses assembly. Presume, then, that I wish to use the Setting up Paging article. Would everything in that article work the same under UEFI? I know that for memory allocation I'd need to use EFI_BOOT_SERVICES.AllocatePages() to set up the page directory somewhere in RAM. Will this memory allocation remain even after I call EFI_BOOT_SERVICES.ExitBootServices()? What else will I need to do if I choose to make my kernel an EFI application so it doesn't need a boot loader to run? And what will I need to keep in mind? And, finally, is this even advisable? (e.g.: I presume my kernel will need to be able to handle being executed by a loader like Grub, if that's even possible as an UEFI application.)
Edit: I'd like to note that I'd like to use identity paging (primarily because that's just easier to understand and work with).
The Paging article uses assembly. Presume, then, that I wish to use the Setting up Paging article. Would everything in that article work the same under UEFI? I know that for memory allocation I'd need to use EFI_BOOT_SERVICES.AllocatePages() to set up the page directory somewhere in RAM. Will this memory allocation remain even after I call EFI_BOOT_SERVICES.ExitBootServices()? What else will I need to do if I choose to make my kernel an EFI application so it doesn't need a boot loader to run? And what will I need to keep in mind? And, finally, is this even advisable? (e.g.: I presume my kernel will need to be able to handle being executed by a loader like Grub, if that's even possible as an UEFI application.)
Edit: I'd like to note that I'd like to use identity paging (primarily because that's just easier to understand and work with).