1570af302Sopenharmony_ci.global __cp_begin 2570af302Sopenharmony_ci.hidden __cp_begin 3570af302Sopenharmony_ci.global __cp_end 4570af302Sopenharmony_ci.hidden __cp_end 5570af302Sopenharmony_ci.global __cp_cancel 6570af302Sopenharmony_ci.hidden __cp_cancel 7570af302Sopenharmony_ci.hidden __cancel 8570af302Sopenharmony_ci.global __syscall_cp_asm 9570af302Sopenharmony_ci.hidden __syscall_cp_asm 10570af302Sopenharmony_ci 11570af302Sopenharmony_ci#r0: volatile. may be modified during linkage. 12570af302Sopenharmony_ci#r1: stack frame: 16 byte alignment. 13570af302Sopenharmony_ci#r2: tls/thread pointer on pp32 14570af302Sopenharmony_ci#r3,r4: return values, first args 15570af302Sopenharmony_ci#r5-r10: args 16570af302Sopenharmony_ci#r11-r12: volatile. may be modified during linkage 17570af302Sopenharmony_ci#r13: "small data area" pointer 18570af302Sopenharmony_ci#r14 - r30: local vars 19570af302Sopenharmony_ci#r31: local or environment pointer 20570af302Sopenharmony_ci 21570af302Sopenharmony_ci#r1, r14-31: belong to the caller, must be saved and restored 22570af302Sopenharmony_ci#r0, r3-r12, ctr, xer: volatile, not preserved 23570af302Sopenharmony_ci#r0,r11,r12: may be altered by cross-module call, 24570af302Sopenharmony_ci#"a func cannot depend on that these regs have the values placed by the caller" 25570af302Sopenharmony_ci 26570af302Sopenharmony_ci#the fields CR2,CR2,CR4 of the cond reg must be preserved 27570af302Sopenharmony_ci#LR (link reg) shall contain the funcs return address 28570af302Sopenharmony_ci .text 29570af302Sopenharmony_ci .type __syscall_cp_asm,%function 30570af302Sopenharmony_ci__syscall_cp_asm: 31570af302Sopenharmony_ci # at enter: r3 = pointer to self->cancel, r4: syscall no, r5: first arg, r6: 2nd, r7: 3rd, r8: 4th, r9: 5th, r10: 6th 32570af302Sopenharmony_ci__cp_begin: 33570af302Sopenharmony_ci # r3 holds first argument, its a pointer to self->cancel. 34570af302Sopenharmony_ci # we must compare the dereferenced value with 0 and jump to __cancel if its not 35570af302Sopenharmony_ci 36570af302Sopenharmony_ci lwz 0, 0(3) #deref pointer into r0 37570af302Sopenharmony_ci 38570af302Sopenharmony_ci cmpwi cr7, 0, 0 #compare r0 with 0, store result in cr7. 39570af302Sopenharmony_ci beq+ cr7, 1f #jump to label 1 if r0 was 0 40570af302Sopenharmony_ci 41570af302Sopenharmony_ci b __cp_cancel #else call cancel 42570af302Sopenharmony_ci1: 43570af302Sopenharmony_ci #ok, the cancel flag was not set 44570af302Sopenharmony_ci # syscall: number goes to r0, the rest 3-8 45570af302Sopenharmony_ci mr 0, 4 # put the system call number into r0 46570af302Sopenharmony_ci mr 3, 5 # Shift the arguments: arg1 47570af302Sopenharmony_ci mr 4, 6 # arg2 48570af302Sopenharmony_ci mr 5, 7 # arg3 49570af302Sopenharmony_ci mr 6, 8 # arg4 50570af302Sopenharmony_ci mr 7, 9 # arg5 51570af302Sopenharmony_ci mr 8, 10 # arg6 52570af302Sopenharmony_ci sc 53570af302Sopenharmony_ci__cp_end: 54570af302Sopenharmony_ci bnslr+ # return if no summary overflow. 55570af302Sopenharmony_ci #else negate result. 56570af302Sopenharmony_ci neg 3, 3 57570af302Sopenharmony_ci blr 58570af302Sopenharmony_ci__cp_cancel: 59570af302Sopenharmony_ci b __cancel 60