Skip to content

Commit 3937525

Browse files
Correct GDT entries for user descriptors (#142)
Shift user descriptors in GDT by 32 bits (like kernel descriptors).
1 parent 64a5c27 commit 3937525

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

02_Architecture/04_GDT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ Most of this descriptor is unchanged, except for the type field. Bit 4 is cleare
233233

234234
```c
235235
uint64_t user_code = kernel_code | (3 << 13);
236-
gdt_entries[3] = user_code;
236+
gdt_entries[3] = user_code << 32;
237237

238238
uint64_t user_data = kernel_data | (3 << 13);
239-
gdt_entries[4] = user_data;
239+
gdt_entries[4] = user_data << 32;
240240
```
241241

242242
A more complex example of a GDT is the one used by the stivale2 boot protocol:

0 commit comments

Comments
 (0)