GDT:
.set GDT.NULL, . - GDT
.quad 0
-.set GDT.KERNEL_CODE, . - GDT
- .short 0xFFFF # Limit[0:16]
- .short 0x0000 # Base[0:16]
- .byte 0x00 # Base[16:24]
- .byte 0b10011010 # Access: present | readable | ring0
- .byte 0b10101111 # Flags: page_gran | long_mode, Limit[16:20]
- .byte 0x00 # Base[24:32]
.set GDT.KERNEL_DATA, . - GDT
.short 0xFFFF # Limit[0:16]
.short 0x0000 # Base[0:16]
.byte 0b10010010 # Access: present | writeable | ring0
.byte 0b11001111 # Flags: page_gran | d_b, Limit[16:20]
.byte 0x00 # Base[24:32]
-.set GDT.USER_CODE, . - GDT
+.set GDT.KERNEL_CODE, . - GDT
.short 0xFFFF # Limit[0:16]
.short 0x0000 # Base[0:16]
.byte 0x00 # Base[16:24]
- .byte 0b11111010 # Access: present | readable | ring3
+ .byte 0b10011010 # Access: present | readable | ring0
.byte 0b10101111 # Flags: page_gran | long_mode, Limit[16:20]
.byte 0x00 # Base[24:32]
.set GDT.USER_DATA, . - GDT
.byte 0b11110010 # Access: present | writeable | ring3
.byte 0b11001111 # Flags: page_gran | d_b, Limit[16:20]
.byte 0x00 # Base[24:32]
+.set GDT.USER_CODE, . - GDT
+ .short 0xFFFF # Limit[0:16]
+ .short 0x0000 # Base[0:16]
+ .byte 0x00 # Base[16:24]
+ .byte 0b11111010 # Access: present | readable | ring3
+ .byte 0b10101111 # Flags: page_gran | long_mode, Limit[16:20]
+ .byte 0x00 # Base[24:32]
.set GDT.TSS, . - GDT
.short TSS_SIZE & 0xFFFF # Limit[0:16]
.short 0x0000 # Base[0:16] # TSS & 0xFFFF
.short . - GDT - 1
.quad GDT - KERNEL_VMA
+.globl TSS
TSS:
.skip 4
RSP0: .quad 0