mirror of
https://github.com/phire/kvmbox.git
synced 2024-05-12 10:15:13 -04:00
39 lines
607 B
NASM
39 lines
607 B
NASM
; Copyright (c) 2011 Scott Mansell <phiren@gmail.com>
|
|
; Licensed under the MIT license
|
|
; Refer to the included LICENCE file.
|
|
|
|
[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
|