summaryrefslogtreecommitdiff
path: root/kernel/src/sys/userspace_asm.S
blob: 5817a8c732a989db1722c797394ac33aa35825f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.text

.extern begin_userspace
.extern syscall_handler

.global jump_userspace
jump_userspace:
	mov $0x1b, %ax
	mov %ax, %ds
	mov %ax, %es
	mov %ax, %fs
	mov %ax, %gs

	mov $0xc0000082, %rcx
	movabs $__syscall, %rax
	shr $32, %rax
	mov %eax, %edx
	movabs $__syscall, %rax
	wrmsr
	mov $0xc0000080, %rcx
	rdmsr
	or $1, %eax
	wrmsr
	mov $0xc0000081, %rcx
	rdmsr
	mov $0x00100008, %edx
	wrmsr

	mov $begin_userspace, %ecx
	mov $0x202, %r11
	sysretq