use16
org 0x7c00
start:
mov ax,4F02h
mov bx,100h
int 10h
in al, 0x92
or al, 2
out 0x92, al
lgdt [gdtr]
cli
in al, 0x70
or al, 0x80
out 0x70, al
mov eax, cr0
or al, 1
mov cr0, eax
jmp 00001000b:pm_entry
use32
pm_entry:
cld
xor edi,edi
mov esi,edi
mov ax,16
mov gs,ax
p0:
mov al,1Fh
mov [gs:edi],al
inc edi
cmp edi,307200
jz $
jmp p0
gdt:
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
db 0xFF, 0xFF, 0x00, 0x00, 0x00, 10011010b, 11001111b, 0x00
db 0FFh,0FFh,0,00h,0Ah,92h,40h,0
gdt_size equ $ - gdt
gdtr:
dw gdt_size - 1
dd gdt