tasking: add simple base for running things in ring 3
This commit is contained in:
@@ -94,3 +94,24 @@ switchProcess:
|
||||
; |------------------------|
|
||||
|
||||
ret
|
||||
|
||||
global jump_usermode
|
||||
extern test_user_function
|
||||
jump_usermode:
|
||||
mov ax, (4 * 8) | 3 ; ring 3 data with bottom 2 bits set for ring 3
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax ; SS is handled by iret
|
||||
|
||||
; and eax, ~0x80000000
|
||||
; mov cr0, eax
|
||||
|
||||
; set up the stack frame iret expects
|
||||
mov eax, esp
|
||||
push (4 * 8) | 3 ; data selector
|
||||
push eax ; current esp
|
||||
pushf ; eflags
|
||||
push (3 * 8) | 3 ; code selector (ring 3 code with bottom 2 bits set for ring 3)
|
||||
push test_user_function ; instruction address to return to
|
||||
iret
|
||||
|
||||
Reference in New Issue
Block a user