summaryrefslogtreecommitdiff
path: root/src/user/lib/syscall.s
blob: 0f9e444ffdf32e6c51319c443eeb4ba8cd572bad (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
.section .text
.global _syscall
.type _syscall, @function
_syscall:
	push %rbx // preserve registers
	push %rsi
	push %rdi
	push %rbp

	// NOT the calling convention TODO you lazy fuck
	mov 20(%rsp), %rax
	mov 24(%rsp), %rbx
	mov %rsp, %rcx
	mov $_syscall_ret, %rdx
	mov 28(%rsp), %rsi
	mov 32(%rsp), %rdi
	mov 36(%rsp), %rbp
	sysenter

_syscall_ret:
	pop %rbp
	pop %rdi
	pop %rsi
	pop %rbx
	ret