Code: Select all
mov eax, 0
mov ax, ds
shl eax, 4
add eax, GDTStart
Code: Select all
cli
mov eax, 0
mov ax, ds
shl eax, 4
add eax, GDTStart
mov [GDTInfo + 2], eax
lgdt [GDTInfo]
mov eax, cr0
or eax, 1
mov cr0, eax
mov ax, 0x10
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
jmp 0x08:pmode
GDTInfo:
dw GDTEnd - GDTStart - 1
dd GDTStart
GDTStart:
dd 0x00000000 ;Descriptor 0 Null
dd 0x00000000
dw 0xffff ;Descriptor 1 Code
dw 0x0000
db 0x00
db 10011010b
db 11001111b
db 0x00
dw 0xffff ;Descriptor 2 Data
dw 0x0000
db 0x00
db 10010010b
db 11001111b
db 0x00
GDTEnd: