I know that I simply have done some stupid error (or didn't read the manual careful enough), but I'm standing still without any idea. When attempting to execute the following code:
Code: Select all
mov rax,rsp
push qword 24 ;SS
push qword rax ;RSP
push qword 0 ;RFLAGS
push qword 16 ;CS
push qword TEST ;RIP
iretq
TEST:
jmp $
#GP comes at 'ireq' with error code 10 (the selector of my ring-3 code segment). My GDT is:
Code: Select all
align 8
GDT:
dq 0 ; Null descriptor.
db 0,0,0,0,0,10011000b,00100000b,0 ; Ring-0 descriptor.
db 0,0,0,0,0,11111000b,00100000b,0 ; Ring-3 descriptor.
db 0,0,0,0,0,10010000b,00000000b,0 ; Ring-3 stack.
GDTP:
dw $-GDT-1
dq GDT
I have got no TSS, but the ireq doesn't require one, does it? Ring0-to-ring0 interrupts and ireqs works fine, U/S paging flag is on, but that is not relevant anyway, as the fault occurs before the user code starts execution. Can anybody help me? Thanks in advance.