tasking: add simple base for running things in ring 3

This commit is contained in:
2025-04-07 16:13:31 +03:00
parent 03e718c2c8
commit 372b308ec8
9 changed files with 163 additions and 10 deletions
+21
View File
@@ -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