From nobody Tue Feb 10 11:56:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1644927163; cv=none; d=zohomail.com; s=zohoarc; b=RWFKrPOJzKBiE0Vo4SfT9UkSMNLZvpf0AWO/Dvx4IRncmyc/kt+xFtA1s8JqvJCj31sPt1UEO8t0B5YDMDnWtd/mLG/Mmvsv1I933RkM7tF5b6kxTctiN0n0dHf+sm0nrFMWHu0AL842Dp1BmXTcUr1sp11hnVgXMfDaxremwOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644927163; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=J1kz5UUqyzdZGMp/mxnljjWHI+CVxZCoiLHlEt1WQgM=; b=gK8Pha4t1J8lX0CLG/wqfI/lWQQe/bQiLgtDkv+p4Fxl2D0DHUGtp8qlcvvX4hHFiEgLMeKodhdjDsHU8oFF7hw7KQOc2Bg6SpWqELTuQBACFQYT03xOmpXvJ4iwc0qW0ZQItF2HIMyp/X/aYBl/IUXT30QxnPD0UueZNIJnFVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644927163021933.1218459199507; Tue, 15 Feb 2022 04:12:43 -0800 (PST) Received: from localhost ([::1]:45484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJwhG-0005hT-0K for importer@patchew.org; Tue, 15 Feb 2022 07:12:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJwbr-00019p-J2 for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:11 -0500 Received: from [2607:f8b0:4864:20::431] (port=36475 helo=mail-pf1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJwbo-0001Ut-Ft for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:06 -0500 Received: by mail-pf1-x431.google.com with SMTP id z16so12635431pfh.3 for ; Tue, 15 Feb 2022 04:06:48 -0800 (PST) Received: from localhost.localdomain (71.red-83-50-68.dynamicip.rima-tde.net. [83.50.68.71]) by smtp.gmail.com with ESMTPSA id y20sm40402889pfi.78.2022.02.15.04.06.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Feb 2022 04:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J1kz5UUqyzdZGMp/mxnljjWHI+CVxZCoiLHlEt1WQgM=; b=cqhr4/KyecY11PmtETsA7qjYn2v28QQWpyt0DYbAXBL/8XoaWjBkIg9crbaDgwfLds KDRVDBfJSB6//3Gx++M6EPoqOGy9dB43lssoFfIiprKBHPxNrDUZC8HVG18RqdY+mV87 OzFPUa1cT8MYP88VqhBREfG4nuGFLWXFqj+LFG0KnJSFwZN1WX8VNw3VpS+iYKW77hix xPxjQ6JdjfIaz+HomPvuKxtg08+/TdvcPe8MrOXhTikcouSkh+o4ZzPMkQ3HzMJMpYBI r8MEZLpy/Wy46G0qeDsp3/NSzXfORhqyvga60f30vp4fcEdOTLbd6xMXEs53EsWjvG+s mo5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=J1kz5UUqyzdZGMp/mxnljjWHI+CVxZCoiLHlEt1WQgM=; b=L7KFdxda+A5LAWEysbOox8Y0sX/JNjF5YorsGG6mv6WvpLLCv35lY67FsZFD2c5GoO H6PDET0CDV42nZM55kgYv7GYjvOn8Kt6ZCkQegA/w/oly3wRozqise/bKsmHM0TGBKzx HlECbxQyGGvFweviSa65vSm+dTSiIuQoP7ZUn51vVdodcU3gkm7FM7yfQkqeGypBopZY U4b/17DoDEnc30Vk9/QmuyMvq6PUrsN3LXhbo8+MRsO5bTMyEJj/kkpBdlhE+erOuplq p8rIASmAarMxD/NkeSg6uKpL75ekYvczzw9l0r6kTh6yGU5eBmoSioV8VO7nmYFytGfG yegw== X-Gm-Message-State: AOAM530gjfr/QJbZI16hOuoAeZHRQcSbAnKCsFRCx6sfr7+jfzEEwf0b bnTP1C5cRqzYdrDmi9zp51lGgqY1e98= X-Google-Smtp-Source: ABdhPJzGRFiQTmwsQPLUbdP4y3VUucYywiQMFB9vZLLmqjhxzU1HsFYtK/T74pEQJX3nOSsG1nXO/g== X-Received: by 2002:a63:6a89:: with SMTP id f131mr3310988pgc.108.1644926807288; Tue, 15 Feb 2022 04:06:47 -0800 (PST) To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Roman Bolshakov , Christian Schoenebeck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/4] osdep: Un-inline qemu_thread_jit_execute/write Date: Tue, 15 Feb 2022 13:06:23 +0100 Message-Id: <20220215120625.64711-3-f4bug@amsat.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220215120625.64711-1-f4bug@amsat.org> References: <20220215120625.64711-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::431 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= via X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644927165089100001 qemu_thread_jit_execute() and qemu_thread_jit_write() call pthread_jit_write_protect_np() which is declared in "pthread.h". Since we don't want all C files to preprocess unused headers, avoid adding yet another header here and move the function definitions to osdep.c, un-inlining them. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/osdep.h | 17 ++--------------- util/osdep.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 1e7a002339..785884728b 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -773,21 +773,8 @@ size_t qemu_get_host_physmem(void); * Toggle write/execute on the pages marked MAP_JIT * for the current thread. */ -#if defined(MAC_OS_VERSION_11_0) && \ - MAC_OS_X_VERSION_MIN_REQUIRED >=3D MAC_OS_VERSION_11_0 -static inline void qemu_thread_jit_execute(void) -{ - pthread_jit_write_protect_np(true); -} - -static inline void qemu_thread_jit_write(void) -{ - pthread_jit_write_protect_np(false); -} -#else -static inline void qemu_thread_jit_write(void) {} -static inline void qemu_thread_jit_execute(void) {} -#endif +void qemu_thread_jit_execute(void); +void qemu_thread_jit_write(void); =20 /** * Platforms which do not support system() return ENOSYS diff --git a/util/osdep.c b/util/osdep.c index 42a0a4986a..b228a53612 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -124,6 +124,26 @@ int qemu_mprotect_none(void *addr, size_t size) #endif } =20 +static void qemu_pthread_jit_write_protect(bool enabled) +{ +#if defined(MAC_OS_VERSION_11_0) \ + && MAC_OS_X_VERSION_MIN_REQUIRED >=3D MAC_OS_VERSION_11_0 + if (__builtin_available(macOS 11.0, *)) { + pthread_jit_write_protect_np(enabled); + } +#endif +} + +void qemu_thread_jit_execute(void) +{ + qemu_pthread_jit_write_protect(true); +} + +void qemu_thread_jit_write(void) +{ + qemu_pthread_jit_write_protect(false); +} + #ifndef _WIN32 =20 static int fcntl_op_setlk =3D -1; --=20 2.34.1