d
GUIhandle:
pushad
sgdt fword [storage]
sidt fword [storage+6]
cli
in al,0x70
btr ax,7
out 0x70,al
mov edx,cr0
btr dx,0
mov cr0,edx
jmp far 0x0000:REAL
REAL:
xor dx,dx
mov ds,dx
mov es,dx
mov ss,dx
mov gs,dx
mov dx,0xb800
mov fs,dx
jmp short continue
REAL_IDT:
dw 0xff00
dd 0x00000000
continue:
lidt fword ptr REAL_IDT
mov al,0x11 ; init controler interrupt master slave
out 020h, al
out 0A0h, al
xor al,al ; set offset in IDT hardware descriptor master
out 021h, al
mov al, 0x08 ; ; set offset in IDT hardware descriptor slave
out 0A1h, al
mov al, 00000100b
out 021h, al
mov al, 2
out 0A1h, al
mov al, 00000001b
out 021h, al
out 0A1h, al
sti
in al,0x70
bts ax,7
out 0x70,al
.CallBiosPrint:
mov ah,0x0a
cld
.lp:
lodsb
int 0x10
loop .lp
in al,0x70
btr ax,7
out 0x70,al
cli
lgdt fword ptr storage
lidt fword [storage+6]
mov edx,cr0
bts dx,0
mov cr0,edx
jmp far 0x0008:.Protected
.Protected:
mov dx,0x0010
mov ss,dx
mov ds,dx
mov es,dx
mov gs,dx
mov dx,0x0018
mov fs,dx
mov al,0x11 ; init controler interrupt master slave
out 020h, al
out 0A0h, al
mov al,0x30 ; set offset in IDT hardware descriptor master
out 021h, al
mov al, 0x38 ; ; set offset in IDT hardware descriptor slave
out 0A1h, al
mov al, 00000100b
out 021h, al
mov al, 2
out 0A1h, al
mov al, 00000001b
out 021h, al
out 0A1h, al
in al,0x70
bts ax,7
out 0x70,al
sti
.return:
popad
iretd

