2023-05-29 12:44:26 -07:00
|
|
|
.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
|
2023-06-12 19:20:42 -07:00
|
|
|
pushq $0x202 # Bit 9 enables interrupts.
|
2023-05-29 12:44:26 -07:00
|
|
|
pushq $0x1B # cs
|
|
|
|
pushq %rdi
|
2023-06-06 16:24:03 -07:00
|
|
|
mov %rdx, %rdi
|
|
|
|
mov %rcx, %rsi
|
2023-05-29 12:44:26 -07:00
|
|
|
iretq
|