Hi! I'm relatively new to bootloaders, and I'm looking for some help with an example bootloader that just attempts to go into 64-bit mode, and then runs the kernel. If it fails, then it just runs the 32-bit kernel in its place.
I know I'm probably asking a lot, but all the 64-bit bootloader tutorials I've seen around show random snippets, but nothing I've been able to make work.
My goal is to write a hybrid microkernel as a personal project, but I need to get the thing to load =P
Thanks very much!
Fud
64-Bit bootloader
Re: 64-Bit bootloader
That's probably what I'll end up doing lol
-
- Member
- Posts: 127
- Joined: Sat Sep 29, 2007 5:43 pm
- Location: Amsterdam, The Netherlands
Re: 64-Bit bootloader
Hi,
Generally, the boot process (I use) is as following:
Regards,
Stephan J.R. van Schaik.
Generally, the boot process (I use) is as following:
- Set up the segment registers and the stack pointer.
- Store BIOS information.
- Set up VGA.
- Test if the CPU is at least a 80386.
- Validate that the boot loader is entirely loaded, otherwise try it manually when possible.
- Test if the CPU supports certain instructions I need.
- Enable the A20 gate.
- Enter unreal mode (real mode with 32-bit data descriptors).
- Attempt to retrieve the memory regions.
- Set up a minimal memory manager.
- Parse the file system looking for KERNEL32 and KERNEL64 and load them both.
- Test if the CPU is a 64-bit processor.
- Prepare to jump to KERNEL64, when it was loaded i.e. exists.
- Otherwise prepare to jump to KERNEL32.
Regards,
Stephan J.R. van Schaik.
-
- Member
- Posts: 127
- Joined: Sat Sep 29, 2007 5:43 pm
- Location: Amsterdam, The Netherlands
Re: 64-Bit bootloader
Actually, this was what I was doing several months ago, but I am not using 64-bit at the moment and it took me some time to rethink what I exactly did in my older boot loaders. My new boot loader currently only supports 32-bit, but will use the exact method I described here since I am trying to merge both architectures into one file.berkus wrote:Why not reverse these two and skip loading the not-needed kernel altogether?StephanVanSchaik wrote:
- Parse the file system looking for KERNEL32 and KERNEL64 and load them both.
- Test if the CPU is a 64-bit processor.
Regards,
Stephan J.R. van Schaik.