GDT Tutorial "Long Mode" 64-bit table "User Mode" offsets are swapped compared to the 32-bit table
Posted: Fri Aug 14, 2026 8:57 am
https://wiki.osdev.org/GDT_Tutorial#Fla ... Mode_Setup
The 32-bit table shows rows:
Offset 0x18: "User Mode Code Segment"
Offset 0x20: "User Mode Data Segment"
while the 64-bit table shows these:
Offset 0x18: "User Mode Data Segment"
Offset 0x20: "User Mode Code Segment"
To rephrase, in the 64-bit table, the Data row is first with the Code row second, instead of vice-versa like the 32-bit table.
Questions:
* Is this deliberate?
* Is it common for 32-bit and 64-bit to have this difference in offsets?
* If it is common, why?
Suggestion: If it is an oversight, I can switch the 64-bit user rows. If it is deliberate, an explanation would be helpful.
The 32-bit table shows rows:
Offset 0x18: "User Mode Code Segment"
Offset 0x20: "User Mode Data Segment"
while the 64-bit table shows these:
Offset 0x18: "User Mode Data Segment"
Offset 0x20: "User Mode Code Segment"
To rephrase, in the 64-bit table, the Data row is first with the Code row second, instead of vice-versa like the 32-bit table.
Questions:
* Is this deliberate?
* Is it common for 32-bit and 64-bit to have this difference in offsets?
* If it is common, why?
Suggestion: If it is an oversight, I can switch the 64-bit user rows. If it is deliberate, an explanation would be helpful.