Code: Select all
0x08 | 00000000(56)-00100000(48)-10011000(40)-00000000(32)-00000000(24)-00000000(16)-00000000(8)-00000000(0) | kernel code
0x10 | 00000000(56)-00100000(48)-10010000(40)-00000000(32)-00000000(24)-00000000(16)-00000000(8)-00000000(0) | kerrnel data
0x18 | 00000000(56)-00100000(48)-11111000(40)-00000000(32)-00000000(24)-00000000(16)-00000000(8)-00000000(0) | user code
0x20 | 00000000(56)-00100000(48)-11110000(40)-00000000(32)-00000000(24)-00000000(16)-00000000(8)-00000000(0) | user data
0x28 | {TSS}
Code: Select all
asm!("cli
push r10
push rsp
pushfq
push r12
push r13
iretq"
:
: "{r10}"(0x20 << 3 | 3), // selector for user data segment
"{r12}"(0x18 << 3 | 3), // selector for user code segment
"{r13}"(instruction_pointer)
:
: "intel", "volatile");
I've checked each GDT descriptor carefully, but clearly I'm missing something?