Howdy, I just registered as I plan on taking on my OS project seriously now... I'm starting with AMD64, and I printed the manuals from the site. However, I didn't find the sequence to start long mode... Can anybody point me to a tut or a man that says how?
Thanks a lot! and wish me luck
- Fetrovsky
AMD64 Long Mode
im not sure if this is
im not sure if this is what your asking, but this is how you enable long mode:
disable paging
set the pae enable bit in CR4
load CR3 with physical address of PML4
set EFER.LME flag in msr 0xC00000080
enable paging
disable paging
set the pae enable bit in CR4
load CR3 with physical address of PML4
set EFER.LME flag in msr 0xC00000080
enable paging
oh microsoft, microsoft, what souls you have dismayed
"Everything" you need is available in the AMD documentation on this page:
http://developer.amd.com/devguides.jsp
The long mode startup sequence is outlined in detail in the "AMD64 Architecture Programmer's Manual Volume 2: System Programming Rev 3.13" document, in chapter 14.
If you get totally stuck, you can contact me or take a look at my project here:
http://trac.devlime.com/neptune/browser ... unk/loader
The relevant code is in main.cpp, and loader.asm. You'll notice I've also got a workaround for GRUB's inability to read elf64 files. The 32 bit loader is loaded by grub, which then goes into long mode. It reads the elf64 kernel, passed as a GRUB module, and jumps to it once we're in long mode.
Hope that helps. Feel free to contact me if you're stumped.
http://developer.amd.com/devguides.jsp
The long mode startup sequence is outlined in detail in the "AMD64 Architecture Programmer's Manual Volume 2: System Programming Rev 3.13" document, in chapter 14.
If you get totally stuck, you can contact me or take a look at my project here:
http://trac.devlime.com/neptune/browser ... unk/loader
The relevant code is in main.cpp, and loader.asm. You'll notice I've also got a workaround for GRUB's inability to read elf64 files. The 32 bit loader is loaded by grub, which then goes into long mode. It reads the elf64 kernel, passed as a GRUB module, and jumps to it once we're in long mode.
Hope that helps. Feel free to contact me if you're stumped.
Here are some examples, of entering long mode with fasm:
http://board.flatassembler.net/topic.php?t=6206&start=0
They may help point you in the right direction
Note: to down load the zip file, you need to join.
http://board.flatassembler.net/topic.php?t=6206&start=0
They may help point you in the right direction
Note: to down load the zip file, you need to join.