.text
.align 2
- .globl EXT(pthread_getspecific_sprg3)
- .globl EXT(pthread_getspecific_uftrap)
- .globl EXT(pthread_self_sprg3)
- .globl EXT(pthread_self_uftrap)
#define USER_SPRG3 259 // user-mode-readable encoding for SPRG3
-// *****************************************************
-// * P T H R E A D _ G E T S P E C I F I C _ S P R G 3 *
-// *****************************************************
+// ***********************************************************
+// * P T H R E A D _ G E T S P E C I F I C _ S P R G 3 _ 3 2 *
+// ***********************************************************
//
-// For processors with user-readable SPRG3. Called with:
+// For processors with user-readable SPRG3, in 32-bit mode. Called with:
// r3 = word number
// r4 = offset to thread specific data (_PTHREAD_TSD_OFFSET)
-pthread_getspecific_sprg3:
+pthread_getspecific_sprg3_32:
slwi r5,r3,2 // convert word# to byte offset
mfspr r3,USER_SPRG3 // get per-thread cookie
add r5,r5,r4 // add in offset to first word
lwzx r3,r3,r5 // get the thread-specific word
blr
- COMMPAGE_DESCRIPTOR(pthread_getspecific_sprg3,_COMM_PAGE_PTHREAD_GETSPECIFIC,k64Bit,0,0)
+ COMMPAGE_DESCRIPTOR(pthread_getspecific_sprg3_32,_COMM_PAGE_PTHREAD_GETSPECIFIC,k64Bit,0,kCommPage32)
+
+
+// ***********************************************************
+// * P T H R E A D _ G E T S P E C I F I C _ S P R G 3 _ 6 4 *
+// ***********************************************************
+//
+// For processors with user-readable SPRG3, in 64-bit mode. This may not be used
+// because the 64-bit ABI uses r13 for the thread-local-data pointer. Called with:
+// r3 = word number
+// r4 = offset to thread specific data (_PTHREAD_TSD_OFFSET)
+
+pthread_getspecific_sprg3_64:
+ sldi r5,r3,3 // convert double-word# to byte offset
+ mfspr r3,USER_SPRG3 // get per-thread cookie
+ add r5,r5,r4 // add in offset to first word
+ ldx r3,r3,r5 // get the thread-specific doubleword
+ blr
+
+ COMMPAGE_DESCRIPTOR(pthread_getspecific_sprg3_64,_COMM_PAGE_PTHREAD_GETSPECIFIC,k64Bit,0,kCommPage64)
// ***************************************
// * P T H R E A D _ S E L F _ S P R G 3 *
// ***************************************
//
-// For processors with user-readable SPRG3.
+// For processors with user-readable SPRG3. Useable both in 32 and 64-bit modes.
pthread_self_sprg3:
mfspr r3,USER_SPRG3 // get per-thread cookie
blr
- COMMPAGE_DESCRIPTOR(pthread_self_sprg3,_COMM_PAGE_PTHREAD_SELF,k64Bit,0,0)
+ COMMPAGE_DESCRIPTOR(pthread_self_sprg3,_COMM_PAGE_PTHREAD_SELF,k64Bit,0,kCommPageBoth)
// *******************************************************
lwzx r3,r3,r5 // get the thread-specific word
blr
- COMMPAGE_DESCRIPTOR(pthread_getspecific_uftrap,_COMM_PAGE_PTHREAD_GETSPECIFIC,0,k64Bit,0)
+ COMMPAGE_DESCRIPTOR(pthread_getspecific_uftrap,_COMM_PAGE_PTHREAD_GETSPECIFIC,0,k64Bit,kCommPage32)
// *****************************************
sc // get r3==TLDP
blr
- COMMPAGE_DESCRIPTOR(pthread_self_uftrap,_COMM_PAGE_PTHREAD_SELF,0,k64Bit,0)
+ COMMPAGE_DESCRIPTOR(pthread_self_uftrap,_COMM_PAGE_PTHREAD_SELF,0,k64Bit,kCommPage32)