2 #include "../../dyninstAPI/src/inst-power.h"
5 .globl DYNINSTthreadIndexFAST
6 .globl .DYNINSTthreadIndexFAST
7 DYNINSTthreadIndexFAST:
8 .DYNINSTthreadIndexFAST:
11 .globl DYNINSTthreadContext
12 .globl .DYNINSTthreadContext
14 .DYNINSTthreadContext:
20 beq DYNINSTthreadContext_NOT_SPR
22 DYNINSTthreadContext_NOT_SPR:
24 .globl DYNINSTthreadSelf
25 .globl .DYNINSTthreadSelf
33 beq DYNINSTthreadSelf_NOT_SPR
35 DYNINSTthreadSelf_NOT_SPR:
38 .globl compare_and_swap2
39 .globl .compare_and_swap2
44 bne- compare_and_swap2
58 lwarx 4,0,10 # r4 == old value of mutex
59 stwcx. 6,0,10 # t->mutex = 1
60 bne- tc_lock_lock_loop
62 bne- tc_lock_lock_done
63 tc_lock_lock_failed: # Someone else has the lock
64 l 5,4(10) # r5 == old tid value
66 bne tc_lock_lock_loop # Don't have lock, try again
67 lil 3,-2 # Already have lock, return error, -2 == DYNINST_DEAD_LOCK
69 tc_lock_lock_done: # Need to record new tid, return
70 st 3,4(10) # t->tid = pid
77 .globl tc_lock_trylock
78 .globl .tc_lock_trylock
88 lwarx 4,0,10 # r4 == old value of mutex
89 stwcx. 6,0,10 # t->mutex = 1
90 bne- tc_lock_trylock_loop
92 bne- tc_lock_trylock_done
93 tc_lock_trylock_failed: # Someone else has the lock
94 l 5,4(10) # r5 == old tid value
96 bne tc_lock_trylock_live # Don't have lock, try again
97 lil 3,-2 # Already have lock, return error
100 lil 3,-1 # Someone else has lock, LIVE_LOCK == -1
101 b tc_lock_trylock_ret
102 tc_lock_trylock_done: # Need to record new tid, return
103 st 3,4(10) # t->tid = pid