1717 */ 
1818
1919#include  "Zend/zend_portability.h" 
20- #include  "Zend/zend_types.h" 
20+ #include  "Zend/zend_types.h" q 
2121#include  "TSRM/TSRM.h" 
2222#include  "zend_accelerator_debug.h" 
2323
2626
2727TSRMLS_CACHE_EXTERN ();
2828
29- struct  TLSDescriptor  {
30- 	void  * (* thunk )(struct  TLSDescriptor  * );
29+ typedef   struct  _tls_descriptor  {
30+ 	void  * (* thunk )(struct  _tls_descriptor  * );
3131	uintptr_t  key ;
3232	uintptr_t  offset ;
33- };
34- 
35- #if  defined(__x86_64__ )
36- static  void  * (* zend_jit_darwin_tls_thunk )(struct  TLSDescriptor  * );
37- static  struct  TLSDescriptor  * zend_jit_darwin_tls_desc ;
38- #endif 
33+ } tls_descriptor ;
3934
4035zend_result  zend_jit_resolve_tsrm_ls_cache_offsets (
4136	size_t  * tcb_offset ,
@@ -48,39 +43,15 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
4843	}
4944
5045#if  defined(__x86_64__ )
51- 	const  struct  TLSDescriptor  * desc ;
52- 	__asm__ __volatile__(
53- 		"leaq __tsrm_ls_cache@TLVP(%%rip), %0\n\t" 
54- 		"movq (%0), %0" 
55- 		: "=&r"  (desc )
56- 		:
57- 		: "memory" 
58- 	);
59- 
60- 	zend_jit_darwin_tls_thunk  =  desc -> thunk ;
61- 	zend_jit_darwin_tls_desc   =  (struct  TLSDescriptor  * )desc ;
62- 
63- 	* tcb_offset    =  0 ;
64- 	* module_index  =  (size_t )-1 ;
46+ 	* module_index   =  (size_t )-1 ;
6547	* module_offset  =  (size_t )-1 ;
66- 
48+ 	 * tcb_offset   =   0 ; 
6749	return  SUCCESS ;
6850#endif 
6951
7052	return  FAILURE ;
7153}
7254
73- ZEND_API  void  * zend_jit_tsrm_ls_cache_ptr (void )
74- {
75- #if  defined(__x86_64__ )
76- 	return  zend_jit_darwin_tls_thunk 
77- 		? zend_jit_darwin_tls_thunk (zend_jit_darwin_tls_desc )
78- 		: NULL ;
79- #else 
80- 	return  NULL ;
81- #endif 
82- }
83- 
8455/* Used for testing */ 
8556void  * zend_jit_tsrm_ls_cache_address (
8657	size_t  tcb_offset ,
@@ -99,9 +70,15 @@ void *zend_jit_tsrm_ls_cache_address(
9970		return  addr ;
10071	}
10172	if  (module_index  ==  (size_t )-1  &&  module_offset  ==  (size_t )-1 ) {
102- 		return  zend_jit_darwin_tls_thunk 
103- 			? zend_jit_darwin_tls_thunk (zend_jit_darwin_tls_desc )
104- 			: NULL ;
73+ 		const  tls_descriptor  * tlsdesc ;
74+ 		__asm__ __volatile__(
75+ 			"leaq __tsrm_ls_cache@TLVP(%%rip), %0\n\t" 
76+ 			"movq (%0), %0" 
77+ 			: "=&r"  (tlsdesc )
78+ 			:
79+ 			: "memory" 
80+ 		);
81+ 		return  tlsdesc -> thunk ((tls_descriptor  * )tlsdesc );
10582	}
10683	if  (module_index  !=  (size_t )-1  &&  module_offset  !=  (size_t )-1 ) {
10784		char  * base ;
0 commit comments