Detect if we have valid pthread_jit_write_protect_np
This commit is contained in:
29
qemu/configure
vendored
29
qemu/configure
vendored
@@ -2139,13 +2139,40 @@ fi
|
|||||||
if [ "$darwin" = "yes" ] ; then
|
if [ "$darwin" = "yes" ] ; then
|
||||||
cat > $TMPC << EOF
|
cat > $TMPC << EOF
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
int main() { pthread_jit_write_protect_np(0); return 0; }
|
int main() { pthread_jit_write_protect_np(0); return 0;}
|
||||||
EOF
|
EOF
|
||||||
if ! compile_prog ""; then
|
if ! compile_prog ""; then
|
||||||
have_pthread_jit_protect='no'
|
have_pthread_jit_protect='no'
|
||||||
else
|
else
|
||||||
have_pthread_jit_protect='yes'
|
have_pthread_jit_protect='yes'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$have_pthread_jit_protect" = "yes" ; then
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include "stdint.h"
|
||||||
|
int main() {
|
||||||
|
uint64_t commpage_sprr = (*(uint64_t*)0xFFFFFC10C);
|
||||||
|
|
||||||
|
// In Apple Hypervisor, this value is not accessbile and
|
||||||
|
// pthread_jit_write_protect_np essentially is a no-op
|
||||||
|
if (!commpage_sprr) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
if ! compile_prog ""; then
|
||||||
|
have_pthread_jit_protect='no'
|
||||||
|
else
|
||||||
|
$TMPE
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
have_pthread_jit_protect='yes'
|
||||||
|
else
|
||||||
|
have_pthread_jit_protect='no'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
|
|||||||
Reference in New Issue
Block a user