summaryrefslogtreecommitdiff
path: root/libstd/syscall+plan9-x64.s
blob: 4de65022b4598f73efc1e3f367cbc2aca94125a7 (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
32
33
/*
Ugly: Kernel is caller-save, Myrddin
is callee-save. We need to preserve
registers before entering the kernel.

However, we also need SP to point to the
start of the arguments.

Luckily, the kernel doesn't touch our stack,
and we have 256 bytes of gap if we get a note.
*/
TEXT sys$syscall+0(SB),1,$0
	MOVQ	R11,-16(SP)
	MOVQ	R12,-24(SP)
	MOVQ	R13,-32(SP)
	MOVQ	R14,-40(SP)
	MOVQ	R15,-48(SP)
	MOVQ	BP,-56(SP)
	MOVQ	8(SP),RARG

	ADDQ	$8,SP
	MOVQ	DI, RARG
	SYSCALL
	SUBQ	$8,SP

	MOVQ	-16(SP),R11
	MOVQ	-24(SP),R12
	MOVQ	-32(SP),R13
	MOVQ	-40(SP),R14
	MOVQ	-48(SP),R15
	MOVQ	-56(SP),BP
	RET