Advertisement
Guest User

Untitled

a guest
Feb 11th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. gdt64_start:
  2.     ; Null
  3.     dq 0
  4.  
  5.     ; Code (0x8)
  6.     dw 0x0000                   ; Limit lower
  7.     dw 0x0000                   ; Base  lower
  8.     db 0x00                     ; Base middle
  9.     db 10011010b                ; Access..
  10.  
  11.     ; NOTE: The AMD Volume 2, page 88 says that the segment limit fields
  12.     ;   are actually ignored in long mode. The OSDev long mode page, however,
  13.     ;   says that the CPU will make one last limit check when jumping into long mode    
  14.     ;   (tested by them in Bochs) and that's why I also set the higher bits
  15.     ;   of the limit to 1111. However, I also tested with 0000 and it works.
  16.     ;   Maybe it was a bug in Bochs that lead to checking the limit when
  17.     ;   jumping to long mode?
  18.     db 10101111b                ; Granularity & Limit
  19.     db 0x00                     ; Base higher
  20.  
  21.  
  22.     ; Data (0x8)
  23.     dw 0x0000                   ; Limit lower
  24.     dw 0x0000                   ; Base  lower
  25.     db 0x00                     ; Base middle
  26.     db 10010010b                ; Access..
  27.     db 00000000b                ; Granularity & Limit
  28.     db 0x00                     ; Base higher
  29. gdt64_end:
  30.  
  31. gdt64_pointer:
  32.     dw gdt64_end - gdt64_start - 1
  33.     dq gdt64_start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement