如何在x86_64上进入64位模式

fad*_*bee 6 assembly x86-64 bare-metal

我在xv6 https://github.com/chrisdew/xv6/blob/master/bootasm.S中找到了很多装配,它向我展示了如何从16位移动到32位保护模式.

有没有人知道进入64位模式的类似示例?(通过或不使用32位模式.)

Dev*_*lus 7

要启用64位功能,必须将CPU切换到长模式.

要在64位x86处理器(x86-64)上进入长模式:

If paging is enabled, disable paging.
If CR4.PAE is not already set, set it.
Set IA32_EFER.LME = 1.
Load CR3 with a valid PML4 table.
Enable paging.
At this point you will be in compatibility mode. A far jump may be executed to switch to long mode. However, the offset must not exceed 32-bit.
Run Code Online (Sandbox Code Playgroud)