diff options
Diffstat (limited to 'kernel/features/proc.asm')
-rw-r--r-- | kernel/features/proc.asm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/features/proc.asm b/kernel/features/proc.asm new file mode 100644 index 0000000..3d6bbc4 --- /dev/null +++ b/kernel/features/proc.asm @@ -0,0 +1,25 @@ +%define USER_CODE_SEGMENT 0x18 +%define USER_DATA_SEGMENT 0x20 +%define RING3_MASK 0b11 + +global proc_jump_userspace +extern _esp +extern _eip +proc_jump_userspace: + mov ax, USER_DATA_SEGMENT | RING3_MASK + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + + mov eax, dword [_esp] + push USER_DATA_SEGMENT | RING3_MASK + push eax + pushf + + sti + + push USER_CODE_SEGMENT | RING3_MASK + push dword [_eip] + + iret |