Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global load_gdt
- global reloadSegments
- gdtr DW 0 ; For limit storage
- DD 0 ; For base storage
- load_gdt:
- MOV AX, [esp + 4]
- MOV [gdtr], AX
- MOV EAX, [ESP + 8]
- MOV [gdtr + 2], EAX
- LGDT [gdtr]
- RET
- reloadSegments:
- ; Reload CS register containing code selector:
- JMP 0x08:.reload_CS ; 0x08 is a stand-in for your code segment
- .reload_CS:
- ; Reload data segment registers:
- MOV AX, 0x10 ; 0x10 is a stand-in for your data segment
- MOV DS, AX
- MOV ES, AX
- MOV FS, AX
- MOV GS, AX
- MOV SS, AX
- RET
Add Comment
Please, Sign In to add comment