1 #r0: volatile. may be modified during linkage.
2 #r1: stack frame: 16 byte alignment.
3 #r2: tls/thread pointer on pp32
4 #r3,r4: return values, first args
6 #r11-r12: volatile. may be modified during linkage
7 #r13: "small data area" pointer
9 #r31: local or environment pointer
11 #r1, r14-31: belong to the caller, must be saved and restored
12 #r0, r3-r12, ctr, xer: volatile, not preserved
13 #r0,r11,r12: may be altered by cross-module call,
14 #"a func cannot depend on that these regs have the values placed by the caller"
16 #the fields CR2,CR2,CR4 of the cond reg must be preserved
17 #LR (link reg) shall contain the funcs return address
19 .global __syscall_cp_asm
20 .type __syscall_cp_asm,%function
22 # at enter: r3 = pointer to self->cancel, r4: syscall no, r5: first arg, r6: 2nd, r7: 3rd, r8: 4th, r9: 5th, r10: 6th
25 # r3 holds first argument, its a pointer to self->cancel.
26 # we must compare the dereferenced value with 0 and jump to __cancel if its not
28 lwz 0, 0(3) #deref pointer into r0
30 cmpwi cr7, 0, 0 #compare r0 with 0, store result in cr7.
31 beq+ cr7, 1f #jump to label 1 if r0 was 0
33 b __cancel #else call cancel
34 # (the return address is not needed, since __cancel never returns)
36 #ok, the cancel flag was not set
37 # syscall: number goes to r0, the rest 3-8
38 mr 0, 4 # put the system call number into r0
39 mr 3, 5 # Shift the arguments: arg1
48 bnslr+ # return if no summary overflow.