real mode to long mode in wiki
Posted: Tue May 17, 2011 6:04 am
hi guys,
i followed the sample in osdev wiki at
http://wiki.osdev.org/Entering_Long_Mode_Directly
but got stuck in this line (cant compile)
i'm using flat assembler and it say the line
has unknown symbol "gdt.code"
but it is clearly declared in Global Descriptor Table above.
and i wonder why gdt.pointer is known
and gdt.code is unknown
please help
i followed the sample in osdev wiki at
http://wiki.osdev.org/Entering_Long_Mode_Directly
but got stuck in this line (cant compile)
Code: Select all
;Enter long mode
mov eax,10100000b ;Set PAE and PGE
mov cr4,eax
mov edx, 0x0000a000 ;Point CR3 at PML4
mov cr3,edx
mov ecx,0xC0000080 ;Specify EFER MSR
rdmsr ;Enable Long Mode
or eax,0x00000100
wrmsr
mov ebx,cr0 ;Activate long mode
or ebx,0x80000001 ;by enabling paging and protection simultaneously
mov cr0,ebx ;skipping protected mode entirely
lgdt [gdt.pointer] ;load 80-bit gdt.pointer below
jmp gdt.code:startLongMode ;Load CS with 64 bit segment and flush the instruction cache
;Global Descriptor Table
gdt:
dq 0x0000000000000000 ;Null Descriptor
.code equ $ - gdt
dq 0x0020980000000000
.data equ $ - gdt
dq 0x0000900000000000
.pointer:
dw $-gdt-1 ;16-bit Size (Limit)
dq gdt
Code: Select all
jmp gdt.code:startLongMode
but it is clearly declared in Global Descriptor Table above.
and i wonder why gdt.pointer is known
and gdt.code is unknown
please help