[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] tcg: Fix execution on Apple Silicon
From: |
Richard Henderson |
Subject: |
Re: [PATCH v3] tcg: Fix execution on Apple Silicon |
Date: |
Thu, 21 Jan 2021 08:34:44 -1000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 1/12/21 5:28 PM, Roman Bolshakov wrote:
> @@ -1083,6 +1083,12 @@ static bool alloc_code_gen_buffer_anon(size_t size,
> int prot,
> {
> void *buf;
>
> +#if defined(MAC_OS_VERSION_11_0) && \
> + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
> + if (__builtin_available(macOS 11.0, *)) {
> + flags |= MAP_JIT;
> + }
> +#endif
This hunk should be in alloc_code_gen_buffer, where we do the other flags
manipulation.
I'll drop this hunk and apply the rest, which is exclusively related to
toggling the jit bit.
> --- a/util/osdep.c
> +++ b/util/osdep.c
> @@ -606,3 +606,23 @@ writev(int fd, const struct iovec *iov, int iov_cnt)
> return readv_writev(fd, iov, iov_cnt, true);
> }
> #endif
> +
> +#if defined(MAC_OS_VERSION_11_0) && \
> + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
> +void qemu_thread_jit_execute(void)
> +{
> + if (__builtin_available(macOS 11.0, *)) {
> + pthread_jit_write_protect_np(true);
> + }
> +}
> +
> +void qemu_thread_jit_write(void)
> +{
> + if (__builtin_available(macOS 11.0, *)) {
> + pthread_jit_write_protect_np(false);
> + }
> +}
> +#else
> +void qemu_thread_jit_write(void) {}
> +void qemu_thread_jit_execute(void) {}
> +#endif
I will move these inline in osdep.h, because it's either (1) a single function
call or (2) a nop.
r~