summaryrefslogtreecommitdiff
path: root/src/thread/powerpc64/syscall_cp.s
blob: d420dbdef51017cd4d282e9e2a54941960386961 (plain) (blame)
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
34
35
36
37
	.global __cp_begin
	.hidden __cp_begin
	.global __cp_end
	.hidden __cp_end
	.global __cp_cancel
	.hidden __cp_cancel
	.hidden __cancel
	.global __syscall_cp_asm
	.hidden __syscall_cp_asm
	.text
	.type   __syscall_cp_asm,%function
__syscall_cp_asm:
	# at enter: r3 = pointer to self->cancel, r4: syscall no, r5: first arg, r6: 2nd, r7: 3rd, r8: 4th, r9: 5th, r10: 6th
__cp_begin:
	# if (self->cancel) goto __cp_cancel
	lwz   0, 0(3)
	cmpwi cr7, 0, 0
	bne-  cr7, __cp_cancel

	# make syscall
	mr    0,  4
	mr    3,  5
	mr    4,  6
	mr    5,  7
	mr    6,  8
	mr    7,  9
	mr    8, 10
	sc

__cp_end:
	# return error ? -r3 : r3
	bnslr+
	neg 3, 3
	blr

__cp_cancel:
	b __cancel