diff --git a/opal/asm/base/POWERPC32.asm b/opal/asm/base/POWERPC32.asm index e613b9ccf1..16c1b9bdf4 100644 --- a/opal/asm/base/POWERPC32.asm +++ b/opal/asm/base/POWERPC32.asm @@ -154,3 +154,17 @@ START_FUNC(opal_atomic_sub_32) lwz r3,0(r3) blr END_FUNC(opal_atomic_sub_32) + +START_FUNC(opal_sys_timer_get_cycles) + LSYM(15) + mftbu r0 + mftb r11 + mftbu r2 + cmpw cr7,r2,r0 + bne+ cr7,REFLSYM(14) + li r4,0 + li r9,0 + or r3,r2,r9 + or r4,r4,r11 + blr +END_FUNC(opal_sys_timer_get_cycles) diff --git a/opal/asm/base/POWERPC64.asm b/opal/asm/base/POWERPC64.asm index c66c441c29..3168a69d62 100644 --- a/opal/asm/base/POWERPC64.asm +++ b/opal/asm/base/POWERPC64.asm @@ -142,3 +142,18 @@ START_FUNC(opal_atomic_sub_32) extsw r3,r3 blr END_FUNC(opal_atomic_sub_32) + +START_FUNC(opal_sys_timer_get_cycles) + LSYM(7) + mftbu r2 + rldicl r2,r2,0,32 + mftb r0 + rldicl r9,r0,0,32 + mftbu r0 + rldicl r0,r0,0,32 + cmpw cr7,r0,r2 + bne cr7,REFLSYM(7) + sldi r3,r0,32 + or r3,r3,r9 + blr +END_FUNC(opal_sys_timer_get_cycles) diff --git a/opal/include/sys/powerpc/timer.h b/opal/include/sys/powerpc/timer.h index 1237546c5f..6bacdbb736 100644 --- a/opal/include/sys/powerpc/timer.h +++ b/opal/include/sys/powerpc/timer.h @@ -41,7 +41,9 @@ opal_sys_timer_get_cycles(void) #else -#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 0 +opal_timer_t opal_sys_timer_get_cycles(void); + +#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1 #endif /* OMPI_GCC_INLINE_ASSEMBLY */ diff --git a/opal/include/sys/powerpc/update.sh b/opal/include/sys/powerpc/update.sh index dd7733554c..5c4a0cff7d 100644 --- a/opal/include/sys/powerpc/update.sh +++ b/opal/include/sys/powerpc/update.sh @@ -15,11 +15,11 @@ # $HEADER$ # -CFILE=/tmp/opal_atomic_$$.c +CFILE=/tmp/opal_asm_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 -echo Updating atomic.s from atomic.h using gcc +echo Updating asm.s from atomic.h and timer.h using gcc cat > $CFILE< @@ -30,8 +30,9 @@ cat > $CFILE<