Jump to user mode.

This instantly creates a page fault as we always map pages with ring 0
permissions.
This commit is contained in:
Drew Galbraith 2023-05-29 12:44:26 -07:00
parent aefb4f082b
commit 7184f527a0
7 changed files with 37 additions and 7 deletions

View file

@ -0,0 +1,16 @@
.global jump_user_space
// rdi - entry point, rsi - user stack
jump_user_space:
cli
mov $0x23, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
pushq $0x23 # ss
pushq %rsi
pushf # Can we just push 0 for flags?
pushq $0x1B # cs
pushq %rdi
iretq