X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/55e303ae13a4cf49d70f2294092726f2fffb9ef2..4a3eedf9ecc9bbe3f3a5c6ce5e53ad199d639d32:/osfmk/ppc/commpage/pthread.s diff --git a/osfmk/ppc/commpage/pthread.s b/osfmk/ppc/commpage/pthread.s index a53c7ef3d..58dd6c4aa 100644 --- a/osfmk/ppc/commpage/pthread.s +++ b/osfmk/ppc/commpage/pthread.s @@ -1,16 +1,19 @@ /* * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ - * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER @@ -20,7 +23,7 @@ * Please see the License for the specific language governing rights and * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #include @@ -30,43 +33,58 @@ .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) // ******************************************************* @@ -86,7 +104,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) // ***************************************** @@ -100,4 +118,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)