Guest User

Untitled

a guest
Oct 19th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. global load_gdt
  2. global reloadSegments
  3.  
  4. gdtr DW 0 ; For limit storage
  5. DD 0 ; For base storage
  6.  
  7. load_gdt:
  8. MOV AX, [esp + 4]
  9. MOV [gdtr], AX
  10. MOV EAX, [ESP + 8]
  11. MOV [gdtr + 2], EAX
  12. LGDT [gdtr]
  13. RET
  14. reloadSegments:
  15. ; Reload CS register containing code selector:
  16. JMP 0x08:.reload_CS ; 0x08 is a stand-in for your code segment
  17. .reload_CS:
  18. ; Reload data segment registers:
  19. MOV AX, 0x10 ; 0x10 is a stand-in for your data segment
  20. MOV DS, AX
  21. MOV ES, AX
  22. MOV FS, AX
  23. MOV GS, AX
  24. MOV SS, AX
  25. RET
Add Comment
Please, Sign In to add comment