Advertisement
MichaelPetch

SO Question 75614053

Mar 2nd, 2023 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. init_prot:
  2. ; Since this moment all data segment registers
  3. ; point to the same data segment in GDT:0x10
  4. mov ax, GDT_DS_PROT
  5. mov es, ax
  6. mov fs, ax
  7. mov gs, ax
  8. mov ds, ax
  9. mov ss, ax
  10.  
  11. ; Get 16 bit return address from real mode stack and zero extend it
  12. ; to 32-bit and place in EAX
  13. movzx eax, word [esp]
  14.  
  15. ; Set up the protected mode stack
  16. mov esp, STACK_SEGMENT_PROT_MODE
  17. mov ebp, esp
  18.  
  19. ; Push 32-bit return address in EAX onto stack.
  20. push eax
  21.  
  22. xor eax, eax
  23.  
  24. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement