From nobody Tue May 7 17:01:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153989009228289.20687690355908; Thu, 18 Oct 2018 12:14:52 -0700 (PDT) Received: from localhost ([::1]:44037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDDku-0006IN-0n for importer@patchew.org; Thu, 18 Oct 2018 15:14:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDDXn-0004cH-Ld for qemu-devel@nongnu.org; Thu, 18 Oct 2018 15:01:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDDXj-00010i-G9 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 15:01:15 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:40881) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gDDXj-0000zH-62 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 15:01:11 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mo73N-1fpicu24eB-00pdBw; Thu, 18 Oct 2018 21:00:31 +0200 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mo73N-1fpicu24eB-00pdBw; Thu, 18 Oct 2018 21:00:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:00:25 +0200 Message-Id: <20181018190026.9494-2-laurent@vivier.eu> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181018190026.9494-1-laurent@vivier.eu> References: <20181018190026.9494-1-laurent@vivier.eu> X-Provags-ID: V03:K1:efUa1GbK81/9CdIOexOtgnneTW9mNTCrIybthZC1tAmkhRHoJ0e GyoTeM4GbyYYaZXGpXit9Px26dzEYYvuA2s9oa4YxlgknbLspWhqsBabTMW9Jl49MggxXXJ yPRvG3U7d9+xMpngFSfSpQh1A83TY7SCE+8fsy1dwfSpjbnoeV0ww8Rbw2hnTdWJjiPLnX7 Js6G4jKALe1Ty/pz4TkCQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:mTnHxwi4VtY=:1F8Xd93sv2ks/6UR2kTsK/ O5nNV31ACPsjwtfMwuXKY+WL0xkBIfZeMQtaTkTyYajnSC3W7LQfuPNkw4m5zJoH/qjL8+Beq k3eoaifRS0cHkd8UtegM7YXGPiDb2VF8NmXJm5iDSZBq+yfZWztvinm79+E+h4z0HFyImTegL 3IeaIJEyQRBGoHEe7xFULyIE6y/IJ1OYC7A1vdOVwFOIjNJU1DcuyManmXKY/bSq0el/AfXSD I7wrAzLWgue7xg1Z3iaq2sTQJfQcUaUrh5kXVPhwUFdLxP9pwEFvPlrZoh81MXdpGZ68778UO ZErXvp5I5wDw7judJs6pAMPL1oUMJsvbwcl7mgHA4oJqDc7ID7mVASzdn8TFxiow1bZejfpTO 1MKdmMKJwoPjkHaE0UlfixbZK1rCNEZqrXS8+i8Sva191jWAXwxpycZy1MMoEwEVkNpTQ3Wlx yJnmgSMA1wda4Szy+j0acjbdhOmOB3PjwwPxfUrqODUJAycGupc+mLEHLgBS64oPu2fykAeQl 6nrAc7R2y9dZYIUiaIVlxWw54u/570Y9yHBfyePtRvl3K1WcB19QA6ZXlsTZgnshAZ2EWUZmX ZA/ZxywIQsKcywgS856VcpC8+/GJ3zGqlaxpNLIxOu5njzjK1XFk7xCxI8FPsBI8DzeAByOwI /iYWycUlaGlAQK34vmWjniD+J3GK9ckOv8Zeij4mErlaW+Z+kb9+AGFfogSISkoPzAtE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [2 1/2] linux-user: Suppress address-of-packed-member warnings in __get/put_user_e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Our __get_user_e() and __put_user_e() macros cause newer versions of clang to generate false-positive -Waddress-of-packed-member warnings if they are passed the address of a member of a packed struct (see https://bugs.llvm.org/show_bug.cgi?id=3D39113). Suppress these using the _Pragma() operator. Unfortunately _Pragma() support in gcc is broken in some gcc versions and in some usage contexts, so we limit the pragma usage here to clang. To put in the pragmas we need to convert the macros from expressions to statements, but all the callsites effectively treat them as statements already so this is OK. Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20181009161814.21257-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/qemu.h | 74 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index b4959e41c6..1beb6a2cfc 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -461,27 +461,59 @@ static inline int access_ok(int type, abi_ulong addr,= abi_ulong size) These are usually used to access struct data members once the struct has been locked - usually with lock_user_struct. */ =20 -/* Tricky points: - - Use __builtin_choose_expr to avoid type promotion from ?:, - - Invalid sizes result in a compile time error stemming from - the fact that abort has no parameters. - - It's easier to use the endian-specific unaligned load/store - functions than host-endian unaligned load/store plus tswapN. */ - -#define __put_user_e(x, hptr, e) \ - (__builtin_choose_expr(sizeof(*(hptr)) =3D=3D 1, stb_p, = \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 2, stw_##e##_p, = \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 4, stl_##e##_p, = \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 8, stq_##e##_p, abort)))) = \ - ((hptr), (x)), (void)0) - -#define __get_user_e(x, hptr, e) \ - ((x) =3D (typeof(*hptr))( \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 1, ldub_p, = \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 2, lduw_##e##_p, = \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 4, ldl_##e##_p, = \ - __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 8, ldq_##e##_p, abort)))) = \ - (hptr)), (void)0) +/* + * Tricky points: + * - Use __builtin_choose_expr to avoid type promotion from ?:, + * - Invalid sizes result in a compile time error stemming from + * the fact that abort has no parameters. + * - It's easier to use the endian-specific unaligned load/store + * functions than host-endian unaligned load/store plus tswapN. + * - The pragmas are necessary only to silence a clang false-positive + * warning: see https://bugs.llvm.org/show_bug.cgi?id=3D39113 . + * - We have to disable -Wpragmas warnings to avoid a complaint about + * an unknown warning type from older compilers that don't know about + * -Waddress-of-packed-member. + * - gcc has bugs in its _Pragma() support in some versions, eg + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D83256 -- so we only + * include the warning-suppression pragmas for clang + */ +#ifdef __clang__ +#define PRAGMA_DISABLE_PACKED_WARNING \ + _Pragma("GCC diagnostic push"); \ + _Pragma("GCC diagnostic ignored \"-Wpragmas\""); \ + _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"") + +#define PRAGMA_REENABLE_PACKED_WARNING \ + _Pragma("GCC diagnostic pop") + +#else +#define PRAGMA_DISABLE_PACKED_WARNING +#define PRAGMA_REENABLE_PACKED_WARNING +#endif + +#define __put_user_e(x, hptr, e) = \ + do { = \ + PRAGMA_DISABLE_PACKED_WARNING; = \ + (__builtin_choose_expr(sizeof(*(hptr)) =3D=3D 1, stb_p, = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 2, stw_##e##_p, = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 4, stl_##e##_p, = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 8, stq_##e##_p, abort= )))) \ + ((hptr), (x)), (void)0); = \ + PRAGMA_REENABLE_PACKED_WARNING; = \ + } while (0) + +#define __get_user_e(x, hptr, e) = \ + do { = \ + PRAGMA_DISABLE_PACKED_WARNING; = \ + ((x) =3D (typeof(*hptr))( = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 1, ldub_p, = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 2, lduw_##e##_p, = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 4, ldl_##e##_p, = \ + __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 8, ldq_##e##_p, abort= )))) \ + (hptr)), (void)0); = \ + PRAGMA_REENABLE_PACKED_WARNING; = \ + } while (0) + =20 #ifdef TARGET_WORDS_BIGENDIAN # define __put_user(x, hptr) __put_user_e(x, hptr, be) --=20 2.17.2 From nobody Tue May 7 17:01:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539889641238826.9635537934664; Thu, 18 Oct 2018 12:07:21 -0700 (PDT) Received: from localhost ([::1]:43994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDDdg-00008M-3W for importer@patchew.org; Thu, 18 Oct 2018 15:07:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDDXK-0004CA-RV for qemu-devel@nongnu.org; Thu, 18 Oct 2018 15:00:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDDXG-00007n-QF for qemu-devel@nongnu.org; Thu, 18 Oct 2018 15:00:46 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:34745) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gDDXG-000057-FQ for qemu-devel@nongnu.org; Thu, 18 Oct 2018 15:00:42 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mirb8-1fjMxQ0668-00ex0R; Thu, 18 Oct 2018 21:00:32 +0200 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mirb8-1fjMxQ0668-00ex0R; Thu, 18 Oct 2018 21:00:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:00:26 +0200 Message-Id: <20181018190026.9494-3-laurent@vivier.eu> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181018190026.9494-1-laurent@vivier.eu> References: <20181018190026.9494-1-laurent@vivier.eu> X-Provags-ID: V03:K1:YwyU+Bw/KbiaikvW1DWuHd9VpdZr8UD1gGXGoUyuYP8ckuEZk5+ Pb3l8bbYros03nWaBtrNGvtCdKxET4oabo20tAzh6wphnxHD1IP8loSDKi68T27+Eo7U9kG +pq2RWCOOzszQO/3QZfb+atvvSEbiAtBHpJINaCTVoHMMZpseBexrJQUWXR04nEWpJ2KDs0 e9mnGObwbbSiCNCTWgvcQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:lDYoMkibq2o=:1dySA6yYX6itqIEuDBElwO l1X1YMMMbthw5RsvjIDT2loxeUGORdnsWG35oBzX9XHK+1VrwZG65nmu9AuKCHjExWxTz0k0h deL5tdKeQcfRVlc1fYKaO3sIv57DJM+4b8YwA5QS4MagKLQQZx13mcJ5aKL0CsWCm64HRTemL cJATPXmRT5DDWhBosqx0zrqoI06ksPqozjMardAF2isNuV4PO1HR/mPa8I5aWsQrFjqBAL72O 2NTIuAYj0pI177cqNNq0c5RosNptUBU7ut4kgSumfBU3iWooaK6YmBTvKQzrIRAzR0JQhLsLb Ej/6i7BriwFVWKjgW/bqhbBNutAW6ztmcLcA6mq7JlVtpYQXFYpsIh4BkzlO8qDPKNiqCD7qX WIuceyn117j/LBAKcGJIJq1AvU+UbNUjxD5Fq9P9S+rOwJr8/1M1xBh4cic1RuK1/DQu+KhzY qssm0sOTwEN/Ua5Nj2uKOE5uRY4u7Bw2T5WHVI3QuWR+vCOKEsk0vi70CBhgNoi6uj/FfR4Vb 9ofjN15LvKC/qhOkyVzy/Foq0zkNxRZCpoIV/9pN77EkllkuiqiMOpaOmfvxu8Gd9RKEjc3FC xGYjUnANxUqq9UFhb3w7KuOCdtZCLbrfshD1I08QzT6cNay2gpK5YEzzZxQ4ytZCJPw6WCRJa Q0GqQxvzRDKZx8HNVjvl3TTkgOczWEo1NjCDS+X9mwuOb17WCv7mjwYOJgk676xgNlQo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [2 2/2] linux-user/sparc/signal.c: Remove unnecessary comment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Remove a comment suggesting that we need to call tb_flush() after writing the SPARC signal frame trampoline insns. This isn't necessary in QEMU, because (even if the guest architecture requires explicit icache maintenance) we ensure that memory writes result in invalidation of translated code from that memory. Signed-off-by: Peter Maydell Message-Id: <20181009184017.15675-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index b4c60aa446..e44e99993c 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -258,10 +258,6 @@ void setup_frame(int sig, struct target_sigaction *ka, __put_user(val32, &sf->insns[1]); if (err) goto sigsegv; - - /* Flush instruction space. */ - // flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); - // tb_flush(env); } unlock_user(sf, sf_addr, sizeof(struct target_signal_frame)); return; --=20 2.17.2