mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
We now jump to userspace !
This commit is contained in:
parent
3c1e97c157
commit
d0d546e073
@ -40,11 +40,12 @@ KeJumpToUserspace:
|
||||
; rdx = user space stack
|
||||
|
||||
; Build a fake iret frame
|
||||
push QWORD 0x10 ; Selector 0x20 (User Data) + RPL 3
|
||||
push QWORD 0x23 ; Selector 0x20 (User Data) + RPL 3
|
||||
push rdx ; User space stack
|
||||
push QWORD 0x202 ; rflags = interrupt enable + reserved bit
|
||||
push QWORD 0x08 ; Selector 0x18 (User Code) + RPL 3
|
||||
push QWORD 0x1B ; Selector 0x18 (User Code) + RPL 3
|
||||
push rsi ; Entry point in user space
|
||||
|
||||
iretq
|
||||
|
||||
|
||||
|
@ -43,18 +43,19 @@ void MmInitGdt(void)
|
||||
memzero((void *)&tss, sizeof(tss));
|
||||
|
||||
// Kernel codeseg
|
||||
gdt[1].access = PRESENTSEG | RESERVED | RESERVED2;
|
||||
gdt[1].access = PRESENTSEG | READABLE | RESERVED | RESERVED2;
|
||||
gdt[1].flags = LONG;
|
||||
|
||||
// Kernel dataseg
|
||||
gdt[2].access = PRESENTSEG;
|
||||
gdt[2].access = PRESENTSEG | READABLE | RESERVED2;
|
||||
gdt[2].flags = LONG;
|
||||
|
||||
// User codeseg
|
||||
gdt[3].access = PRESENTSEG | RESERVED | RESERVED2 | USER | USER2;
|
||||
gdt[3].flags = LONG;
|
||||
|
||||
// User dataseg
|
||||
gdt[4].access = PRESENTSEG | USER | USER2;
|
||||
gdt[4].access = PRESENTSEG | READABLE | RESERVED2 | USER | USER2;
|
||||
|
||||
tssDesc.access = TSS_TYPE | PRESENTSEG;
|
||||
tssDesc.lowBase = (ulong)&tss & 0xFFFF;
|
||||
|
Loading…
x
Reference in New Issue
Block a user