kvmbox/loader.asm
2011-10-04 16:40:00 +13:00

34 lines
481 B
NASM

[bits 32]
hlt
[bits 16]
start:
cli
mov dx, cs
mov ds, dx
lgdt [gdtr]
mov eax, cr0
or al, 1
mov cr0, eax
jmp long 0x8:0xf0000+protected
[bits 32]
protected:
jmp 0x8:0x000001bc
db 0x90,0x90,0x90
align 16
gdtr:
dw 0x18
dd gdt + 0xf0000
align 16
gdt:
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
db 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00
db 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00
[bits 16]
times 0xfff0-($-$$) db 0x90
jmp word 0xf000:start