Jump to user mode.
This instantly creates a page fault as we always map pages with ring 0 permissions.
This commit is contained in:
parent
aefb4f082b
commit
7184f527a0
7 changed files with 37 additions and 7 deletions
16
zion/scheduler/jump_user_space.s
Normal file
16
zion/scheduler/jump_user_space.s
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue