Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 7c00h
- use16
- cli
- lgdt[gdt]
- mov eax,cr4
- or al,1
- mov cr4,eax
- mov eax,cr0
- or al,1
- mov cr0,eax
- jmp gdt_code-gdt_table:pmode
- vm86:
- mov ax,0e41h
- mov bx,7
- int 10h
- mov ax,gdt_data-gdt_table
- mov gs,ax
- mov fs,ax
- mov ds,ax
- mov es,ax
- mov ss,ax
- push ss
- push esp
- pushf
- push gdt_code-gdt_table
- push return
- iretd
- jmp $
- use32
- pmode:
- mov ax,gdt_data-gdt_table
- mov gs,ax
- mov fs,ax
- mov ds,ax
- mov es,ax
- mov ss,ax
- mov esp,9fffch
- mov ax,18h
- ltr ax
- push 0
- push 0
- push 0
- push 0
- push 0
- push 0fffeh
- push 20000h
- push 0
- push vm86
- iret
- jmp $
- return:
- mov dword[0b8000h],41h
- mov dword[0b8000h+1],7
- jmp $
- gdt:
- dw gdt_end-gdt_table-1
- dd gdt_table
- gdt_table:
- dq 0
- gdt_code:
- dw 0ffffh
- dw 0
- db 0
- db 9ah
- db 0cfh
- db 0
- gdt_data:
- dw 0ffffh
- dw 0
- db 0
- db 92h
- db 0cfh
- db 0
- gdt_tss:
- dw 0ffffh
- dw 0
- db 0
- db 89h
- db 8fh
- db 0
- gdt_end:
- times 510-($-$$) db 0
- dw 0aa55h
Advertisement
Add Comment
Please, Sign In to add comment