]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ppc/commpage/pthread.s
xnu-792.6.61.tar.gz
[apple/xnu.git] / osfmk / ppc / commpage / pthread.s
index dfd9083fab04fd51f0afe423a90cb21cf2abc041..24c785121e80498d412797233b15d82076f92167 100644 (file)
 
         .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)
     
         
 // *******************************************************
@@ -83,7 +98,7 @@ pthread_getspecific_uftrap:
         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)
     
         
 // *****************************************
@@ -97,4 +112,4 @@ pthread_self_uftrap:
         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)