我的代码如下所示:
[org 0x7c00]
[bits 16]
cli
; %include 'gdt.asm' , what is wrong if i set the gdt here instead of bellow the long jump?
lgdt [gdt_32_descriptor] ; gdt_32_descriptor is contained in gdt.asm
mov eax, cr0
or eax, 0x00000001
mov cr0, eax
jmp 0x8:init_pm ; 0x8 -> second segment of the gdt
%include 'gdt.asm' ; contains the global descriptor table and gdt descriptor (why does it only work in this position)
[bits 32 ]
init_pm :
%include 'print_msg_32_bit.asm' ; prints a message on screen
我没有得到的是,如果我将全局描述符表放在不同的位置(特别是在跳远之前),则不会打印消息。为什么会这样?他使用 qemu 和 nasm。