30
30
#include "stdlib.h"
31
31
#include "stdbool.h"
32
32
33
- #if defined(__APPLE__ ) && defined(HAVE_SPRR ) && (defined(__arm__ ) || defined(__aarch64__ ))
34
-
35
33
// Returns the S3_6_c15_c1_5 register's value
36
34
// Taken from
37
35
// https://stackoverflow.com/questions/70019553/lldb-how-to-read-the-permissions-of-a-memory-region-for-a-thread
38
36
// https://blog.svenpeter.dev/posts/m1_sprr_gxf/
39
37
// On Github Action (Virtualized environment), this shall always returns 0
38
+ #if defined(HAVE_SPRR_MRS )
40
39
static inline uint64_t read_sprr_perm (void )
41
40
{
42
41
uint64_t v ;
@@ -45,6 +44,14 @@ static inline uint64_t read_sprr_perm(void)
45
44
: "=r" (v )::"memory" );
46
45
return v ;
47
46
}
47
+ #else
48
+ static inline uint64_t read_sprr_perm (void )
49
+ {
50
+ return 0 ;
51
+ }
52
+ #endif
53
+
54
+ #if defined(__APPLE__ ) && defined(HAVE_PTHREAD_JIT_PROTECT ) && (defined(__arm__ ) || defined(__aarch64__ ))
48
55
49
56
__attribute__((unused )) static inline uint8_t thread_mask ()
50
57
{
@@ -77,15 +84,6 @@ static inline void assert_executable(bool executable) {
77
84
78
85
#else
79
86
80
- // Returns the S3_6_c15_c1_5 register's value
81
- // Taken from
82
- // https://stackoverflow.com/questions/70019553/lldb-how-to-read-the-permissions-of-a-memory-region-for-a-thread
83
- // https://blog.svenpeter.dev/posts/m1_sprr_gxf/
84
- static inline uint64_t read_sprr_perm (void )
85
- {
86
- return 0 ;
87
- }
88
-
89
87
__attribute__((unused )) static inline uint8_t thread_mask ()
90
88
{
91
89
return 0 ;
@@ -107,7 +105,7 @@ static inline void assert_executable(bool executable) {
107
105
#endif
108
106
109
107
110
- #if defined(__APPLE__ ) && defined(HAVE_PTHREAD_JIT_PROTECT ) && defined( HAVE_SPRR ) && (defined(__arm__ ) || defined(__aarch64__ ))
108
+ #if defined(__APPLE__ ) && defined(HAVE_PTHREAD_JIT_PROTECT ) && (defined(__arm__ ) || defined(__aarch64__ ))
111
109
112
110
/* write protect enable = write disable */
113
111
static inline void jit_write_protect (int enabled )
0 commit comments