Advertisement
MichaelPetch

TSS examples

Apr 11th, 2023 (edited)
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. ; Example GDT entry for a TSS
  2.  
  3. ; TSS for transitioning between rings, 1-byte gran, base=tss, limit=TSS_SIZE-1
  4. gdt_tss:
  5. dw TSS_SIZE-1 ; segment length, bits 0-15
  6. dw tss ; segment base, bits 0-15
  7. db 0x0 ; segment base, bits 16-23
  8. db 10001001b ; access flags (8 bits)
  9. db 00000000b ; flags (4 bits) + segment length, bits 16-19
  10. db 0x0 ; segment base, bits 24-31
  11.  
  12.  
  13. ; Example TSS structure
  14.  
  15. tss:
  16. dd 0x0
  17. dd 0x4000 ;esp0
  18. dd 0x10 ;ss0
  19. TIMES 22 dd 0x0
  20. dw 0x0
  21. dw TSS_SIZE ;IOPB offset
  22. ; dd 0x0 ; SSP: If not using a shadow stack (CET disabled)
  23. ; this can be removed
  24. tssend:
  25. TSS_SIZE equ tssend - tss
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement