| OLD | NEW |
| (Empty) |
| 1 .global __cp_begin | |
| 2 .hidden __cp_begin | |
| 3 .global __cp_end | |
| 4 .hidden __cp_end | |
| 5 .global __cp_cancel | |
| 6 .hidden __cp_cancel | |
| 7 .hidden __cancel | |
| 8 .global __syscall_cp_asm | |
| 9 .hidden __syscall_cp_asm | |
| 10 | |
| 11 #r0: volatile. may be modified during linkage. | |
| 12 #r1: stack frame: 16 byte alignment. | |
| 13 #r2: tls/thread pointer on pp32 | |
| 14 #r3,r4: return values, first args | |
| 15 #r5-r10: args | |
| 16 #r11-r12: volatile. may be modified during linkage | |
| 17 #r13: "small data area" pointer | |
| 18 #r14 - r30: local vars | |
| 19 #r31: local or environment pointer | |
| 20 | |
| 21 #r1, r14-31: belong to the caller, must be saved and restored | |
| 22 #r0, r3-r12, ctr, xer: volatile, not preserved | |
| 23 #r0,r11,r12: may be altered by cross-module call, | |
| 24 #"a func cannot depend on that these regs have the values placed by the caller" | |
| 25 | |
| 26 #the fields CR2,CR2,CR4 of the cond reg must be preserved | |
| 27 #LR (link reg) shall contain the funcs return address | |
| 28 .text | |
| 29 .type __syscall_cp_asm,%function | |
| 30 __syscall_cp_asm: | |
| 31 # at enter: r3 = pointer to self->cancel, r4: syscall no, r5: first arg,
r6: 2nd, r7: 3rd, r8: 4th, r9: 5th, r10: 6th | |
| 32 __cp_begin: | |
| 33 # r3 holds first argument, its a pointer to self->cancel. | |
| 34 # we must compare the dereferenced value with 0 and jump to __cancel if
its not | |
| 35 | |
| 36 lwz 0, 0(3) #deref pointer into r0 | |
| 37 | |
| 38 cmpwi cr7, 0, 0 #compare r0 with 0, store result in cr7. | |
| 39 beq+ cr7, 1f #jump to label 1 if r0 was 0 | |
| 40 | |
| 41 b __cp_cancel #else call cancel | |
| 42 1: | |
| 43 #ok, the cancel flag was not set | |
| 44 # syscall: number goes to r0, the rest 3-8 | |
| 45 mr 0, 4 # put the system call number into r0 | |
| 46 mr 3, 5 # Shift the arguments: arg1 | |
| 47 mr 4, 6 # arg2 | |
| 48 mr 5, 7 # arg3 | |
| 49 mr 6, 8 # arg4 | |
| 50 mr 7, 9 # arg5 | |
| 51 mr 8, 10 # arg6 | |
| 52 sc | |
| 53 __cp_end: | |
| 54 bnslr+ # return if no summary overflow. | |
| 55 #else negate result. | |
| 56 neg 3, 3 | |
| 57 blr | |
| 58 __cp_cancel: | |
| 59 b __cancel | |
| OLD | NEW |