summary refs log tree commit diff stats
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRoman Bolshakov <r.bolshakov@yadro.com>2021-01-13 06:28:07 +0300
committerRichard Henderson <richard.henderson@linaro.org>2021-01-23 12:13:00 -1000
commit653b87eb36045b506b79f0bb433016ef1c54bc9a (patch)
tree9072762b0292a3b668f5e55f94da53e1edb9c5a2 /tcg/tcg.c
parent65269192241104342e3b1ba2b7b0f50e5042052e (diff)
downloadfocaccia-qemu-653b87eb36045b506b79f0bb433016ef1c54bc9a.tar.gz
focaccia-qemu-653b87eb36045b506b79f0bb433016ef1c54bc9a.zip
tcg: Toggle page execution for Apple Silicon
Pages can't be both write and executable at the same time on Apple
Silicon. macOS provides public API to switch write protection [1] for
JIT applications, like TCG.

1. https://developer.apple.com/documentation/apple_silicon/porting_just-in-time_compilers_to_apple_silicon

Tested-by: Alexander Graf <agraf@csgraf.de>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Message-Id: <20210113032806.18220-1-r.bolshakov@yadro.com>
[rth: Inline the qemu_thread_jit_* functions;
 drop the MAP_JIT change for a follow-on patch.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 8f8badb61c..67b08f708d 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1112,6 +1112,7 @@ void tcg_prologue_init(TCGContext *s)
     s->pool_labels = NULL;
 #endif
 
+    qemu_thread_jit_write();
     /* Generate the prologue.  */
     tcg_target_qemu_prologue(s);