From patchwork Tue Nov 5 18:11:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476ySJ0DJ5z9sP6 for ; Wed, 6 Nov 2019 05:12:32 +1100 (AEDT) Received: from localhost ([::1]:47130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Jd-000629-D5 for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:12:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52027) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ir-0005wc-Iy for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iq-0004gv-3A for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:41 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:58771) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Ip-0004fk-Pu for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:40 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MK3iK-1iEMhF11Q6-00LUJj; Tue, 05 Nov 2019 19:11:27 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 01/13] linux-user: Support for NETLINK socket options Date: Tue, 5 Nov 2019 19:11:07 +0100 Message-Id: <20191105181119.26779-2-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:4+7uD1XNKyCPZXTebgGuW6OFwtVt3y1MSzqcsSn3RkX6tUN4jcg 3LSd/RXtU5Ksmrw6/hRzK5wzjBAVNQiGz5q7l6/eyMbmWCsEa5sI/hyzbgYJXl/F/8ix1tA 9ojm8cfdl9RCNGWkGIKDYRyE4iK0dxoe8DMKeSNfcfDEQ+RNAu+teRjEECagOo+SWzSRI4I ALjbf/mUdF0BaIFtCyQkA== X-UI-Out-Filterresults: notjunk:1; V03:K0:C1MOBssoNAc=:g+3d/6hhcrM6yHFvdBqZ+q DNsxP+yHPNVLeG+D8/wWe0Hn34x0Dbu0h76ld736WKT7XU4gUDJtm/5HpdCKdeQuxqwmw4XfP k0jF+W+w5h98vquM4NxGQ94jPZuBJZHfOXLl5SMMxybrwV1zUQgOpnbFPLxNgYLkjKQ8jr6+P bY5fSgVtSEoA/mJUK6eIQnPFQfcT4qEZYwc2DM32SGEhG9VTjFhKPav4IQYAte+r5htI6tTEt JsP/QQf3Mg3qWYOkYF/sRBs2MS8KYuAQh4P3bnc7F2ovEDs6OTxH8gKb+BIgH+SwyRAf7PIMJ FEykTJV7lx76+CmuoLxpkN0Vw79l1SNwVZ4RCECDHV6tgzYMzw2V2N+Y+lpW+VWjHJ5CTuvqq StHkdjXFZiX/UKf3QO5sNqScwaBKkWHZdsMEoxdendzb0elhXK1Z+WXDlxXiJbiCVx73PIvZi p+eR3k9og9YMWzfsUMPU4eU/lvm6vkl11pwtfrk/X5bCuu7Zv5L4wX249C10eqHeVsmiBo9Le OR/ne1aBy+3pYVCmCwuXYMGRymfbSt+lLM0vh0cCvBr1e504yuGXsdL016y+XTmCN1Dihpzre q+Qctv1jNYgF4Q8U2H8Et2WbcUdX6/xwXuXnQHNws5H2fmur+p2yC3EG68+pilv35GPyRUkY1 9mWYY2d6RszxLkWjuKUPyallMYbJBi/FHhX4bSJK6bptyXpEI7NLUifdZ7kDlVgbH3FZEI8Px VVp1jbVDA9f/4E+wycEFyLAWB2w7ajgPr69f20bTGTGf9qOXQM3kYUJxfrOX6Si9leXk6ef34 yfLIZ399J2q/qiieKlulcFeqotZGN3BfKBNz9hM08lVJpnBjLKkzIj6cJRcVBP1GmPBWK+jUc ZXu6Kfl0FnyB+T1G87zQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.73 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Mark Cave-Ayland , Laurent Vivier , Josh Kunz , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Josh Kunz This change includes support for all AF_NETLINK socket options up to about kernel version 5.4 (5.4 is not formally released at the time of writing). Socket options that were introduced in kernel versions before the oldest currently stable kernel version are guarded by kernel version macros. This change has been built under gcc 8.3, and clang 9.0, and it passes `make check`. The netlink options have been tested by emulating some non-trival software that uses NETLINK socket options, but they have not been exaustively verified. Signed-off-by: Josh Kunz Message-Id: <20191029224310.164025-1-jkz@google.com> [lv: updated patch according to CODING_STYLE] Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 101 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f6751eecb78c..247883292ce5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2248,6 +2248,39 @@ set_timeout: return -TARGET_EFAULT; ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname, &val, sizeof(val))); break; +#ifdef SOL_NETLINK + case SOL_NETLINK: + switch (optname) { + case NETLINK_PKTINFO: + case NETLINK_ADD_MEMBERSHIP: + case NETLINK_DROP_MEMBERSHIP: + case NETLINK_BROADCAST_ERROR: + case NETLINK_NO_ENOBUFS: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) + case NETLINK_LISTEN_ALL_NSID: + case NETLINK_CAP_ACK: +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + case NETLINK_EXT_ACK: +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + case NETLINK_GET_STRICT_CHK: +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */ + break; + default: + goto unimplemented; + } + val = 0; + if (optlen < sizeof(uint32_t)) { + return -TARGET_EINVAL; + } + if (get_user_u32(val, optval_addr)) { + return -TARGET_EFAULT; + } + ret = get_errno(setsockopt(sockfd, SOL_NETLINK, optname, &val, + sizeof(val))); + break; +#endif /* SOL_NETLINK */ default: unimplemented: gemu_log("Unsupported setsockopt level=%d optname=%d\n", level, optname); @@ -2532,6 +2565,74 @@ static abi_long do_getsockopt(int sockfd, int level, int optname, break; } break; +#ifdef SOL_NETLINK + case SOL_NETLINK: + switch (optname) { + case NETLINK_PKTINFO: + case NETLINK_BROADCAST_ERROR: + case NETLINK_NO_ENOBUFS: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) + case NETLINK_LISTEN_ALL_NSID: + case NETLINK_CAP_ACK: +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + case NETLINK_EXT_ACK: +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + case NETLINK_GET_STRICT_CHK: +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */ + if (get_user_u32(len, optlen)) { + return -TARGET_EFAULT; + } + if (len != sizeof(val)) { + return -TARGET_EINVAL; + } + lv = len; + ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv)); + if (ret < 0) { + return ret; + } + if (put_user_u32(lv, optlen) + || put_user_u32(val, optval_addr)) { + return -TARGET_EFAULT; + } + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) + case NETLINK_LIST_MEMBERSHIPS: + { + uint32_t *results; + int i; + if (get_user_u32(len, optlen)) { + return -TARGET_EFAULT; + } + if (len < 0) { + return -TARGET_EINVAL; + } + results = lock_user(VERIFY_WRITE, optval_addr, len, 1); + if (!results) { + return -TARGET_EFAULT; + } + lv = len; + ret = get_errno(getsockopt(sockfd, level, optname, results, &lv)); + if (ret < 0) { + unlock_user(results, optval_addr, 0); + return ret; + } + /* swap host endianess to target endianess. */ + for (i = 0; i < (len / sizeof(uint32_t)); i++) { + results[i] = tswap32(results[i]); + } + if (put_user_u32(lv, optlen)) { + return -TARGET_EFAULT; + } + unlock_user(results, optval_addr, 0); + break; + } +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */ + default: + goto unimplemented; + } +#endif /* SOL_NETLINK */ default: unimplemented: gemu_log("getsockopt level=%d optname=%d not yet supported\n", From patchwork Tue Nov 5 18:11:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yVw0rNpz9sNx for ; Wed, 6 Nov 2019 05:14:48 +1100 (AEDT) Received: from localhost ([::1]:47152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Lp-00015z-R0 for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:14:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52046) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Is-0005yB-D0 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iq-0004hb-VL for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:40125) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Iq-0004gQ-Kz for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:40 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N3bGP-1hkDxE3pLP-010ZAo; Tue, 05 Nov 2019 19:11:28 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 02/13] scripts/qemu-binfmt-conf: Update for sparc64 Date: Tue, 5 Nov 2019 19:11:08 +0100 Message-Id: <20191105181119.26779-3-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:1hQ3nX100RX96hZx8enwA+ZvhdtzI9F57RrS11tUsa3lt4Yz66W VKv3/VM8xE/uqzid/UvN9KQVrLGkKqo3KUhkEtiP99gkU59U6rwUIdZLWEFLJ1RIEdLnt3O U4rTbxitotTfMijSd9uHZGdpRgDML6jzPiREE3fXEIC9pFVLE8kl0LBCadQA3PmKKCU1/an VFVVIMEfZdPwR/J5Bvv/Q== X-UI-Out-Filterresults: notjunk:1; V03:K0:Bbflqga9EnM=:DG1o574tI/gXTnV795wlIf WP5SB6rU0ZfVkfFN8v07csNcyEHGjfrU+m52dI5L61zlJZNA+5jJh7icBw/Oj18qANR9F0ZXJ aTucdjbiPDfzYXEC6o32YXLCt7C4v7GSeqD3mI6KQj9hfvtS0JWO+cYuH9n47ttXGxmAd/LHr MgnXi6tuqseoZSmumRFTLrCMoyjio6EKbxvuiy1UyvU5hzkUxAVr/a3Wh1l0abRtsnicma9Zr 9WHoxc/GYuJbAhtFvnXlkkeICp6srNNPYkKQIIvmVuErW/zWw2/upCqk4J5TSkJ/eKY2dk7IF HOvDYeglBLKEqDOs7gCAYwsENuWEalHZjWlW4s1VW0Q88Pe1yAK5Zl8BV4gw3MkEYAKIHdx27 VVmxh4dxnmFCHKWdw5MUx9ePvqu0S76qs2Z+/T3XJOZOHUlP0llEwEQRbX6JyHzD5oBh/N8FW Yem7KcNCgCgfXWM0O0oSzodFOaXvgLAaMAuJw6piCpDQI3fRJXx3YTP3I6ZaPlFAMJbbo8Vaa pfE3iHAM7VZ0+svT399rhL2U212cswF3Zg+NTSKDLLsrxDNxXeKxy/NcJLSa9BwtImR3fTFPz L/mXL/AuaBi7FZeG9qU9Fs4bMa9lzo/eoogPv6MP6+vtjtVf33GDwpQ69ekGyLH6Y0ro0V0hS I9VM/C95R/BwwazgIAJr0TvTOiH6S4ClKERkXJ7eNJc+HIzNhPf7topW01pYCBD/pmKK5hFot 7G99pVCig6cgrn3j1MQqfRKrPWHxSAteed1q0s3pi4FIt2RU5vIZO0zEsIDEPcPWl+93zoyca Q1i72N4XT7BoK2qnErYpgEpdQLjxWzjM9VpAlm+RafZTZZix7/0ECC2Pr1SxTGSmpBAelnqUi Ua92zgbyI+kAV+Msadng== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Also note that we were missing the qemu_target_list entry for plain sparc; fix that at the same time. Reviewed-by: Laurent Vivier Tested-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20191025113921.9412-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- scripts/qemu-binfmt-conf.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index b5a16742a149..9f1580a91c7d 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -1,8 +1,8 @@ #!/bin/sh # Enable automatic program execution by the kernel. -qemu_target_list="i386 i486 alpha arm armeb sparc32plus ppc ppc64 ppc64le m68k \ -mips mipsel mipsn32 mipsn32el mips64 mips64el \ +qemu_target_list="i386 i486 alpha arm armeb sparc sparc32plus sparc64 \ +ppc ppc64 ppc64le m68k mips mipsel mipsn32 mipsn32el mips64 mips64el \ sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb \ microblaze microblazeel or1k x86_64" @@ -38,6 +38,10 @@ sparc32plus_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x sparc32plus_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' sparc32plus_family=sparc +sparc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b' +sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' +sparc64_family=sparc + ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14' ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' ppc_family=ppc From patchwork Tue Nov 5 18:11:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476ycK33pgz9sNT for ; Wed, 6 Nov 2019 05:19:29 +1100 (AEDT) Received: from localhost ([::1]:47204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3QN-0006C5-55 for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:19:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52124) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Iv-00063j-Ca for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iu-0004kZ-80 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:45 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:46583) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3It-0004jr-Ui for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:44 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MKbwg-1iDojs3Nng-00KwLt; Tue, 05 Nov 2019 19:11:29 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 03/13] tests/tcg/multiarch/linux-test: Fix error check for shmat Date: Tue, 5 Nov 2019 19:11:09 +0100 Message-Id: <20191105181119.26779-4-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:guFf6kPoCev83970K61xUpTlYtpwIv48BL2vM28Yn6KhRBNECBn YR70Je6cEpMeOXp025Yoodu8WGSKnNgxNhWcqQ6u4lvUl2wmhQK1ujxhrWi5Gk1NGt/wHSK Su8wAy+e+HdOGB8FG8iEGnTnsmltEIJeWfAGf9LBdfLvoIA5pfDA+7N840HAVoCa6YRrKzO Nt4HZCIh1szLx6iCycfOg== X-UI-Out-Filterresults: notjunk:1; V03:K0:RbszguFOBm4=:4mHeeaEiSRAWMqaQWXEwMk KhHhTMd0v0mQ8cgw9SUQayU6jyt+ViAox4TDsTjZoV+bmztIS9oXYOccO/OPLzGtS635hQBjp NCipTPK7qbkXgSawtyiRSsdgn3Pb/ech+wQG4KkaTiUkBEfMADxads9jRYwULUMoePFO++OL+ HvTedJ3iRCDGYJ28hg1zV4r/IGASWgG1F12RZTOCGRH29qtByNJxO78CpLpI+UDuXq5wXHzbY U5IGRM0dJzeSRaBfPW9u3cZge8pIGYu34enH/iB0dpDsRKFMoPi8XAB0e6RFw/u2kkHl/k6PM ukTNSFmC5IoDiA7MVLxB97USkUPrOOLEJY+bJiLxP8f8WDG+PR3xHQ+POl9v/7ez5vPoi8B1k 0+x3IWPKxddHG1biN1HUdXmpRKC0EYwuEqRcCWibUyZ2fyMslDmsvX/uu/T7CSYojPW3yVWwh bf+nlMpZvRi1RvOeqbwkKfAo3hAfnmMqZ2JKCAFHUP+2rzFMNXGWW3yRPou3W2tap/rIcNaZJ 4E5ljQoy0qptqNubL4hAIsHVZr39zuBNCLXAxM2gUSu7o9aUqqNrcHxUqsHRw8n3WaOxJ0ADC CJ4BSX1+xploak7/JzPAr7jF1GnZ7ZQ10YzKjp7TJt1qlf3B+AzBM0+R0BRSM55e4fJzeltEV RCdKfyyXzYVcMSeLn659Ag5Vsn6ilEHXvCXIIGu6RFjk/VBcsM3H7H3dWrggQzp3YfU7ht6V8 +2i3h3sbm9Lk+/+QSlw3q9xVoP8OTy1h2jsV6w8doT2/b+sNn/ujjWZZJDcAU8Mw7nA4qqJmS EFx1i8X6sYmJHsEZqo0BI0s+hnjA99k4L/FhDx0rk+BfbfmaWbgHMDDdWI3l6/YJTx/RWujm0 XZ/L5qDSmxz20yD0MA03KX7JTQ+FYj+Z3jaznOEfk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.24 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The error indicator for this syscall is -1, not 0. Fixes: e374bfa35bfb ("shm tests - disabled clone test") Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20191025113921.9412-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- tests/tcg/multiarch/linux-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c index fa4243fc0426..673d7c8a1c25 100644 --- a/tests/tcg/multiarch/linux-test.c +++ b/tests/tcg/multiarch/linux-test.c @@ -503,8 +503,9 @@ static void test_shm(void) shmid = chk_error(shmget(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | 0777)); ptr = shmat(shmid, NULL, 0); - if (!ptr) + if (ptr == (void *)-1) { error("shmat"); + } memset(ptr, 0, SHM_SIZE); From patchwork Tue Nov 5 18:11:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476ycL5GYvz9sNx for ; Wed, 6 Nov 2019 05:19:30 +1100 (AEDT) Received: from localhost ([::1]:47206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3QO-0006DZ-E7 for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:19:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52087) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3It-00061K-Ud for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Is-0004jN-MG for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:60255) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Is-0004i4-C4 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MdNHa-1hsiY51wJ6-00ZRvt; Tue, 05 Nov 2019 19:11:29 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 04/13] target/sparc: Define an enumeration for accessing env->regwptr Date: Tue, 5 Nov 2019 19:11:10 +0100 Message-Id: <20191105181119.26779-5-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:bi2y0XCclKSXkLno3NhKccQ1iRsLgjLWD+Lke1xU57HFW/eXj/q O5mzEQ3JLwj+WXtL2zcZnihcNSBKUHdu6gdr2s0PCJ7mfqlyTko3JC31+vSeNbd4x/oGJge DL09/n55xdNzraUyIe9FmSzGO6FJC6SO3bq6UBhxx9Uy2hsxObJ7fv/zsW6gUNFi3hLIPCn H8ySu1Si0BxGW1GDKiBbQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:G1m2rGcYx+8=:KBMxrc2wdILnvSGlC+B5CI CZkSVzJNBO3Mw/d7ZJaCZYSb772TfWFxTfMWxStKBuSWpnpn1tmzG+zpIMLRkcp/PROe16q+v E2avjPje09T8/wgHnR1SnnhDEa1nA+u2hlcK3oCmEDdnxoO5trXZHik16C8ZFbxtwWdiCJ7v4 AkQMzBqpYHG8vn1YRwnhA3yjB17FmSL6FyNddpU4ZAKmmTtYl28+L1zLD+xu9Qb2SSTLO5MDm oOdasOhhaYnpgSUMKbQS2Y1fzpmwAk7EnuAwpevgtUEmv2JI9n5ui96PYrSx4t5SYy48ipydo 4/2jXFz2ogK+LzSq1n3LXMSJCEwT9t6k8wCaewpzDy6YxbSLnK9rrYWEtFjDxf5IBBkm3oM6f o+WTPEC9Uax6KVTrBuly7kKQgxT0x3jmUrZ1aIIPGcao+jUW9HgAahK/6Z7Z3wAimC0qFsIVD kVX+AKIfNSRGGu/V0C/LhuNVgM1GExQxfbhXVsjkV48F8gytIGsZz/WG7jHAyZnIAUzBwfhI2 55PDqyOUJE+tdIeFUp4A7sFNiRlsHOYYXMryBbBAtkCke8fuIRHcgX93cc7/y5Dw33s0iVP4A iFZzWH4Vcxv0AWrc1Rt4WpBy2qxM7WH6EHjCXNA4bLN40F3iPJUWpJ5Afe3y7seR9HOxJHwMG /jFbsOcRvqnvF5UmAjQuh+MEtX0ADeLAi4syHPNuDk0yCcGkyOQsYoS+P0mtkZRvk0i+0e89k wyS6hT+jMh/Gnxs6RxALUzX3KvtUsEBeYbGBrcytuDeXxYPpkjThM3pikmLoyJhG5LCdLxIFf C3c5TbMxtRPMiS6imyhTo7xhlfaFTtPmLuoSi17DtiyjkdakfYDH57ad7+Zq4I5gpcuIqNHw6 1FV4LlWYRo3dK8CCRCyg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Message-Id: <20191025113921.9412-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- target/sparc/cpu.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 778aa8e073c7..ae97c7d9f799 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -13,6 +13,39 @@ /*#define EXCP_INTERRUPT 0x100*/ +/* Windowed register indexes. */ +enum { + WREG_O0, + WREG_O1, + WREG_O2, + WREG_O3, + WREG_O4, + WREG_O5, + WREG_O6, + WREG_O7, + + WREG_L0, + WREG_L1, + WREG_L2, + WREG_L3, + WREG_L4, + WREG_L5, + WREG_L6, + WREG_L7, + + WREG_I0, + WREG_I1, + WREG_I2, + WREG_I3, + WREG_I4, + WREG_I5, + WREG_I6, + WREG_I7, + + WREG_SP = WREG_O6, + WREG_FP = WREG_I6, +}; + /* trap definitions */ #ifndef TARGET_SPARC64 #define TT_TFAULT 0x01 From patchwork Tue Nov 5 18:11:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yYp3D8qz9sNT for ; Wed, 6 Nov 2019 05:17:18 +1100 (AEDT) Received: from localhost ([::1]:47174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3OG-0003tA-37 for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:17:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52086) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3It-000618-SE for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Is-0004jS-Mm for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:43417) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Is-0004iA-CY for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MVubb-1iK7Cp0WWb-00Rmv6; Tue, 05 Nov 2019 19:11:30 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 05/13] linux-user/sparc: Use WREG constants in sparc/target_cpu.h Date: Tue, 5 Nov 2019 19:11:11 +0100 Message-Id: <20191105181119.26779-6-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:KXxJLT3KNr6WlN9g2QmbVLh3fKF01ZX6oWM+L1NoEM2yYQh4uHR xRL2SiIiznF7/I81463rKtj1ZWRoTcTuu75MwbnBp0xkW+GL09AHH6YFjtgEo0cgBcgFPkd STZFstoGCnuKG6ItcXjiCGtJnWYO558KcwOzFjWiKCNCDeI+xj6++Y1+R/JryNGgeeGIlwK zZ8DEXXOykQog5Jxr/6Hg== X-UI-Out-Filterresults: notjunk:1; V03:K0:x1c/+OwZYeY=:F12phl1ePT9YhVW7AuWKGJ GfEzAYcaLv7jjYuREV9CbAn1ltABmCwoMr5eZ1jSytrNHxYdqVMG/RoZhmHywrWWto+MnBFCb rq+jmyFDHwwXWwWuebAFIsDVnqp0i3bBABF1+d39jYD/Fu6PeqN50HBgdWcEE/jYwRF60N0Da ad+9/IuuQeyvW0r4WLO1qM6snxSZ3PDQdFOWCrU8zosRzh8kG5v3OZBF+YIu2fv7AwoKQUP7/ 57Hes6bB+1mxXA6nXvL6zdEutwKse08CwKL28RK85UZfbcxRSeMpUHsrFzVVevluVq6GgGp+K 1Dzf+EeVU4EaquGvYFjuLIWpiBJt0YJUKVm3B65Dm44dvPdkQy71RHWCLqguujEhBniuUipFk pVNkJXGNXFa13u0gohXUT2fvGOJlM7oGhuFSCOBRl0fdQjLPtmll6fupiXc3PmhY6Sao/SNzn uq0besAVj1lz5DMDRmzrUyg9tgzqNjfFzjPBdgbdkRe4fP/+oyyGfVOaAM1R89qRxYFZfxS2S En+Q1RfiDhgFs8dxZoUeuPagWypz+YF78Cf8n/BTGVoI3UFMBNK6YEkkHO8ULYV1fMVUitqiV hD/K6hOZs+teTmnL2VMPdObdMCXNFzmvQAXvTpXhaknmj4qbH3DNzOt6oyeQGZDOkRfZV80PV 68tBcyMYUgyRC5uKwBReEJSinE7WJhFuMk/LF69oO9Q7e/KTZwTeEypjT33KRcawPsKgdh3c9 ZPS32gH3K+D+3YbcVjrtw7S22pWCNdhTWqg9TB3wjZFsbA07uPz5yWXjMMW0cnEeaClbC+Oaj vNrL8+mZ2bT0m+y2/wJZuh21Pcz0UgJIeyTR7fBg1bzzbfdwX56ibwhYhk8+IuwJYwwg3SnBG 4+GzL3AZEFSeLiQSHldQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This fixes a naming bug wherein we used "UREG_FP" to access the stack pointer. OTOH, the "UREG_FP" constant was also defined incorrectly such that it *did* reference the stack pointer. Note that the kernel legitimately uses the name "FP", because it utilizes the rolled stack window in processing the system call. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191025113921.9412-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/target_cpu.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/linux-user/sparc/target_cpu.h b/linux-user/sparc/target_cpu.h index 1ffc0ae9f2ec..b30fbc72c43b 100644 --- a/linux-user/sparc/target_cpu.h +++ b/linux-user/sparc/target_cpu.h @@ -41,15 +41,9 @@ static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls) env->gregs[7] = newtls; } -#ifndef UREG_I6 -#define UREG_I6 6 -#endif -#ifndef UREG_FP -#define UREG_FP UREG_I6 -#endif - static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) { - return state->regwptr[UREG_FP]; + return state->regwptr[WREG_SP]; } + #endif From patchwork Tue Nov 5 18:11:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yW11XXfz9sNx for ; Wed, 6 Nov 2019 05:14:53 +1100 (AEDT) Received: from localhost ([::1]:47154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Lu-0001D8-GY for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:14:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52091) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Iu-00061Y-3M for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Is-0004id-45 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:58463) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Ir-0004hi-R8 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N7hrw-1hosme3EeY-014i2F; Tue, 05 Nov 2019 19:11:31 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 06/13] linux-user/sparc: Begin using WREG constants in sparc/signal.c Date: Tue, 5 Nov 2019 19:11:12 +0100 Message-Id: <20191105181119.26779-7-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:V+fMpwnoYzTTgf1onjGYlxWDzf33P6dvVgBz4B8DooybvGI5e6H kNtP6lOsnSCYzt2nCPtIeanq3z7AiQkbbyZTCa3XF9yHAamfCIBqTlMmAbXROzBB+Lpma1A kPKTeOPHm9WL4ts2nbK7uYubWkalZQUtZ2NTGApHVlrGmIwFdaya/ZkuQWw6wbdR1C1WBgg L7I/qBbVS6KgOJi4kjRBw== X-UI-Out-Filterresults: notjunk:1; V03:K0:D7QOHjf8zck=:FbdQF/mLE9fqalFLbQjpy9 c791meJtH/G+8Hf9mhbtXPiNUga+gUzc7PGdIw5Jbzeq5BA7cD67HCZ/3/y8YEQKOuS+vdo1z yVte88frT9YgIq1Y8wl4oMdLrqB0vGCTgB104nfvhm0W4hESs0txGT1iHU+MtlI4HKGJq43jH xQMJU0XIT1bhhSt3s7G3steB/DSELsxqXi8fk8+MoOLF2cANyUQ98J8weWBYvFYZuw8gi95h9 UYjB1uBK03QR5AO3o2L7nl8aESc0qo4/XIAyRIqlZ1SZdHW9LusiDXwlQ6KYu5caE6Qz0f8YS dZxg3d3KjDcW1K1PymzJFF9BjLsw+eLRRgvQcppNoN1iH2mestefQAJJe2Uw18peoIwkfbSUq ZzR7pnQp8ysEb6AmjGj5OFCAp7sHE8+/N0pyGxf7+Pq5KOIcHB/yOkUG/A8CXvBDhDVaJ094A AnHffhuq9bJ2PBFBj9SlCCDlYGYBR8yQVGUPYBclw9m4X5mipMyyQTRfetWEPY1nlpki1kpBb n825AKw52uFyiCOTClj/SwcBswxUJE6EGklZ88d5kaX9EEN3xKMuiwVkfG4ZOixw9I1YbzPAp FuUUd/idOY2Tv5oI3cvOa+LDC8XjZZGyIxKkkGRTGEtXH8vZYKW30Ve85IU+T724ly8NhRgip vLCAYhw8M/wpVNe1EdxEXphvQ1Unhr0GUF3EY8rgR7162/aPwQ/1niTbM9B2lz2ugjp1dH3WL k4jS03/wZ/w213gIna4NGjmI1eq/B+c+Dts/ZvETUXW65QTCHiA3ZlzoRYbsUSCoNTmAl3A2h H8qykL6zqCQwU9DHDaN8H0jPDS7/b8P7AUmeIJ1En9720yKi+/hMxewIfpohFMI8qWCLXEwgg mlQbuOCQJmiS26jMmeJQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.24 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This is non-obvious because the UREG constants are in fact wrong. s/UREG_I/WREG_O/g s/UREG_O/WREG_I/g s/UREG_L/WREG_L/g These substitutions have identical integer values. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191025113921.9412-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 95 ++++++++++++++------------------------- 1 file changed, 33 insertions(+), 62 deletions(-) diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index ead169fbaa26..a967e2db7307 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -104,19 +104,8 @@ struct target_rt_signal_frame { qemu_siginfo_fpu_t fpu_state; }; -#define UREG_O0 16 -#define UREG_O6 22 -#define UREG_I0 0 -#define UREG_I1 1 -#define UREG_I2 2 -#define UREG_I3 3 -#define UREG_I4 4 -#define UREG_I5 5 -#define UREG_I6 6 -#define UREG_I7 7 -#define UREG_L0 8 -#define UREG_FP UREG_I6 -#define UREG_SP UREG_O6 +#define UREG_FP WREG_O6 +#define UREG_SP WREG_I6 static inline abi_ulong get_sigframe(struct target_sigaction *sa, CPUSPARCState *env, @@ -159,30 +148,12 @@ setup___siginfo(__siginfo_t *si, CPUSPARCState *env, abi_ulong mask) __put_user(env->gregs[i], &si->si_regs.u_regs[i]); } for (i=0; i < 8; i++) { - __put_user(env->regwptr[UREG_I0 + i], &si->si_regs.u_regs[i+8]); + __put_user(env->regwptr[WREG_O0 + i], &si->si_regs.u_regs[i+8]); } __put_user(mask, &si->si_mask); return err; } -#if 0 -static int -setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/ - CPUSPARCState *env, unsigned long mask) -{ - int err = 0; - - __put_user(mask, &sc->sigc_mask); - __put_user(env->regwptr[UREG_SP], &sc->sigc_sp); - __put_user(env->pc, &sc->sigc_pc); - __put_user(env->npc, &sc->sigc_npc); - __put_user(env->psr, &sc->sigc_psr); - __put_user(env->gregs[1], &sc->sigc_g1); - __put_user(env->regwptr[UREG_O0], &sc->sigc_o0); - - return err; -} -#endif #define NF_ALIGNEDSZ (((sizeof(struct target_signal_frame) + 7) & (~7))) void setup_frame(int sig, struct target_sigaction *ka, @@ -221,20 +192,20 @@ void setup_frame(int sig, struct target_sigaction *ka, } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + UREG_L0], &sf->ss.locals[i]); + __put_user(env->regwptr[i + WREG_L0], &sf->ss.locals[i]); } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + UREG_I0], &sf->ss.ins[i]); + __put_user(env->regwptr[i + WREG_O0], &sf->ss.ins[i]); } if (err) goto sigsegv; /* 3. signal handler back-trampoline and parameters */ env->regwptr[UREG_FP] = sf_addr; - env->regwptr[UREG_I0] = sig; - env->regwptr[UREG_I1] = sf_addr + + env->regwptr[WREG_O0] = sig; + env->regwptr[WREG_O1] = sf_addr + offsetof(struct target_signal_frame, info); - env->regwptr[UREG_I2] = sf_addr + + env->regwptr[WREG_O2] = sf_addr + offsetof(struct target_signal_frame, info); /* 4. signal handler */ @@ -242,11 +213,11 @@ void setup_frame(int sig, struct target_sigaction *ka, env->npc = (env->pc + 4); /* 5. return to kernel instructions */ if (ka->ka_restorer) { - env->regwptr[UREG_I7] = ka->ka_restorer; + env->regwptr[WREG_O7] = ka->ka_restorer; } else { uint32_t val32; - env->regwptr[UREG_I7] = sf_addr + + env->regwptr[WREG_O7] = sf_addr + offsetof(struct target_signal_frame, insns) - 2 * 4; /* mov __NR_sigreturn, %g1 */ @@ -316,7 +287,7 @@ long do_sigreturn(CPUSPARCState *env) __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } for (i=0; i < 8; i++) { - __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); + __get_user(env->regwptr[i + WREG_O0], &sf->info.si_regs.u_regs[i+8]); } /* FIXME: implement FPU save/restore: @@ -433,7 +404,7 @@ void sparc64_set_context(CPUSPARCState *env) abi_ulong fp, i7, w_addr; unsigned int i; - ucp_addr = env->regwptr[UREG_I0]; + ucp_addr = env->regwptr[WREG_O0]; if (!lock_user_struct(VERIFY_READ, ucp, ucp_addr, 1)) { goto do_sigsegv; } @@ -443,7 +414,7 @@ void sparc64_set_context(CPUSPARCState *env) if ((pc | npc) & 3) { goto do_sigsegv; } - if (env->regwptr[UREG_I1]) { + if (env->regwptr[WREG_O1]) { target_sigset_t target_set; sigset_t set; @@ -474,19 +445,19 @@ void sparc64_set_context(CPUSPARCState *env) __get_user(env->gregs[5], (&(*grp)[SPARC_MC_G5])); __get_user(env->gregs[6], (&(*grp)[SPARC_MC_G6])); __get_user(env->gregs[7], (&(*grp)[SPARC_MC_G7])); - __get_user(env->regwptr[UREG_I0], (&(*grp)[SPARC_MC_O0])); - __get_user(env->regwptr[UREG_I1], (&(*grp)[SPARC_MC_O1])); - __get_user(env->regwptr[UREG_I2], (&(*grp)[SPARC_MC_O2])); - __get_user(env->regwptr[UREG_I3], (&(*grp)[SPARC_MC_O3])); - __get_user(env->regwptr[UREG_I4], (&(*grp)[SPARC_MC_O4])); - __get_user(env->regwptr[UREG_I5], (&(*grp)[SPARC_MC_O5])); - __get_user(env->regwptr[UREG_I6], (&(*grp)[SPARC_MC_O6])); - __get_user(env->regwptr[UREG_I7], (&(*grp)[SPARC_MC_O7])); + __get_user(env->regwptr[WREG_O0], (&(*grp)[SPARC_MC_O0])); + __get_user(env->regwptr[WREG_O1], (&(*grp)[SPARC_MC_O1])); + __get_user(env->regwptr[WREG_O2], (&(*grp)[SPARC_MC_O2])); + __get_user(env->regwptr[WREG_O3], (&(*grp)[SPARC_MC_O3])); + __get_user(env->regwptr[WREG_O4], (&(*grp)[SPARC_MC_O4])); + __get_user(env->regwptr[WREG_O5], (&(*grp)[SPARC_MC_O5])); + __get_user(env->regwptr[WREG_O6], (&(*grp)[SPARC_MC_O6])); + __get_user(env->regwptr[WREG_O7], (&(*grp)[SPARC_MC_O7])); __get_user(fp, &(ucp->tuc_mcontext.mc_fp)); __get_user(i7, &(ucp->tuc_mcontext.mc_i7)); - w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; + w_addr = TARGET_STACK_BIAS+env->regwptr[WREG_O6]; if (put_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { goto do_sigsegv; @@ -534,7 +505,7 @@ void sparc64_get_context(CPUSPARCState *env) target_sigset_t target_set; sigset_t set; - ucp_addr = env->regwptr[UREG_I0]; + ucp_addr = env->regwptr[WREG_O0]; if (!lock_user_struct(VERIFY_WRITE, ucp, ucp_addr, 0)) { goto do_sigsegv; } @@ -580,16 +551,16 @@ void sparc64_get_context(CPUSPARCState *env) __put_user(env->gregs[5], &((*grp)[SPARC_MC_G5])); __put_user(env->gregs[6], &((*grp)[SPARC_MC_G6])); __put_user(env->gregs[7], &((*grp)[SPARC_MC_G7])); - __put_user(env->regwptr[UREG_I0], &((*grp)[SPARC_MC_O0])); - __put_user(env->regwptr[UREG_I1], &((*grp)[SPARC_MC_O1])); - __put_user(env->regwptr[UREG_I2], &((*grp)[SPARC_MC_O2])); - __put_user(env->regwptr[UREG_I3], &((*grp)[SPARC_MC_O3])); - __put_user(env->regwptr[UREG_I4], &((*grp)[SPARC_MC_O4])); - __put_user(env->regwptr[UREG_I5], &((*grp)[SPARC_MC_O5])); - __put_user(env->regwptr[UREG_I6], &((*grp)[SPARC_MC_O6])); - __put_user(env->regwptr[UREG_I7], &((*grp)[SPARC_MC_O7])); - - w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; + __put_user(env->regwptr[WREG_O0], &((*grp)[SPARC_MC_O0])); + __put_user(env->regwptr[WREG_O1], &((*grp)[SPARC_MC_O1])); + __put_user(env->regwptr[WREG_O2], &((*grp)[SPARC_MC_O2])); + __put_user(env->regwptr[WREG_O3], &((*grp)[SPARC_MC_O3])); + __put_user(env->regwptr[WREG_O4], &((*grp)[SPARC_MC_O4])); + __put_user(env->regwptr[WREG_O5], &((*grp)[SPARC_MC_O5])); + __put_user(env->regwptr[WREG_O6], &((*grp)[SPARC_MC_O6])); + __put_user(env->regwptr[WREG_O7], &((*grp)[SPARC_MC_O7])); + + w_addr = TARGET_STACK_BIAS+env->regwptr[WREG_O6]; fp = i7 = 0; if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { From patchwork Tue Nov 5 18:11:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yVv2GCrz9sNT for ; Wed, 6 Nov 2019 05:14:47 +1100 (AEDT) Received: from localhost ([::1]:47148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Lo-00013F-Sc for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:14:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52034) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ir-0005xC-Sl for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iq-0004hM-NH for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:41 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:37767) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Iq-0004gG-47 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:40 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N6bwO-1hsB6j20XG-0180M3; Tue, 05 Nov 2019 19:11:31 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 07/13] linux-user/sparc: Use WREG_SP constant in sparc/signal.c Date: Tue, 5 Nov 2019 19:11:13 +0100 Message-Id: <20191105181119.26779-8-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:G1qwgjrVD/d014NPw/Znbc3n9rLZQAeSIeoYcryBJz/i/v6DCpm xLG01cL3zJmQtVtIfqtfuAhcQtPWTtU3TrhZDW0Ql/y71wIAg0Eq472DnCnbGvj2KmPF0pV NJaw8iJEHiphyG4bD//XL0IvZZVHVkmvvjlija9ngwsM92t5M8k4ekQ//nuugEk1o7djQuc VThywpqWFpzvhPgiop/Cg== X-UI-Out-Filterresults: notjunk:1; V03:K0:HJ60+S/KvfU=:RDwwPbS3NLI6V8kSI77lL+ z+JgxAN+DgTOCYhhPyBulpLAFPut2XzIOETeXJw+86xBosLSXvoXF51l0rfCGRAqkTBENy6Gr u+SeLxfUwGIyOEK0pMbdDjEUdx3obQsZsrw9G3duQ48iBSPa94ia9dJv6QIWjOUlgfJSGya9I qb0yhw5sUUh5L4SxljXCyKwVQbwQ+wsUj/nEZHwVSiEMUbfB2zfA24pCRYon0NZVAI8mmFefI UoVHtzpsw/GPRh7v9ISniCPTR2aU9TyreWND9OgRkPcmvpPrfUjwBXDuzg8Pr75bYYoLFLIGj EeYgCllFgum2G1KEvX25rYnZLn3LpJ/GVYQpqM5AuveFFcQV0LbSig/Fdjn2fZJQUi+suUPzP 27qaoUZH3AXlq8HPVHjrngrq+9JARkPt56EkCseed0jzLbGqnHAi/AEsSCHSwnfByxYcrmEWn LdFb7LJpZQ9u+j5bVj6F/5fyEKNdKTWhnGFpQWsr8prkoXkV6Vr2lg/6LBjTwRklqJ7vrzcI5 wkF2C9Fw1VkZM6U/I91Xi5vdCpn0lAHEZAyZqNOHWJ9t64mpWAjc0PVtq/tO4QSM9lIBMbi9l vJJ8VXdGbpiHtyh/5Jli6zeY8euyUvAOGscwcNJ5Sfz8FSj+XAZS3zXkkvUGH2SyuSDIeOxbe aSj/i5FwR1UUcBCd0I6JF5uGdLIP58Hq+KrkH+pJqVLUo4wusowJ0TUxcqYMgNNq8qkZu2nOQ GH6QcYjSKHS0NgCiMbQ79vAxQhj4dNf8pgbUPYS31N15vEecCIbLzVpGZUrSqsTzs/CGMWM3S tuHJecfPaEI9R03B5SYi/Y5l0+FnXBrNypcLUOMqaDzcUUOIjiHs2VI22STVfb0fRSb23U/dm P+ds1RD7eXSBGa1uFxrA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.73 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson s/UREG_FP/WREG_SP/g This is non-obvious because the UREG_FP constant is fact wrong. However, the previous search-and-replace patch made it clear that UREG_FP expands to WREG_O6, and we can see from the enumeration in target/sparc/cpu.h that WREG_O6 is in fact WREG_SP, the stack pointer. The UREG_SP define is unused; remove it. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191025113921.9412-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index a967e2db7307..0db4c5f84fe4 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -104,9 +104,6 @@ struct target_rt_signal_frame { qemu_siginfo_fpu_t fpu_state; }; -#define UREG_FP WREG_O6 -#define UREG_SP WREG_I6 - static inline abi_ulong get_sigframe(struct target_sigaction *sa, CPUSPARCState *env, unsigned long framesize) @@ -201,7 +198,7 @@ void setup_frame(int sig, struct target_sigaction *ka, goto sigsegv; /* 3. signal handler back-trampoline and parameters */ - env->regwptr[UREG_FP] = sf_addr; + env->regwptr[WREG_SP] = sf_addr; env->regwptr[WREG_O0] = sig; env->regwptr[WREG_O1] = sf_addr + offsetof(struct target_signal_frame, info); @@ -255,7 +252,7 @@ long do_sigreturn(CPUSPARCState *env) sigset_t host_set; int i; - sf_addr = env->regwptr[UREG_FP]; + sf_addr = env->regwptr[WREG_SP]; trace_user_do_sigreturn(env, sf_addr); if (!lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { goto segv_and_exit; From patchwork Tue Nov 5 18:11:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yf82M1Cz9sNT for ; Wed, 6 Nov 2019 05:21:04 +1100 (AEDT) Received: from localhost ([::1]:47222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ru-00082c-4o for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:21:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52144) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Iw-00065N-9S for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iv-0004l1-4D for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:46 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:52091) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Iu-0004kT-Qs for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:45 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MoOpq-1i83Z60YPY-00op4j; Tue, 05 Nov 2019 19:11:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 08/13] linux-user/sparc: Fix WREG usage in setup_frame Date: Tue, 5 Nov 2019 19:11:14 +0100 Message-Id: <20191105181119.26779-9-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:0DoNR5fwugDlgAqxhCD9lhbRLQ2oXfce50dKpyFaWJT51JDiFSK COW20gXNKjeZgykCDzKnyYd4/hjTlVPGDGtQ+mzQSrk7A8SlBOtCV1NtrEbfalEg9zolqgw yOhbEaPyViy50J4E9OXiWvKjmjX8/KCdCuoymVsO904AFnC92o0XYhZ4ycpFS+B3qT9LtgI ONj99oGcaw8X+80lrayAQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:gQhxm5rs/Uc=:JNxFxc8YM0iO8rzluI1/q+ xvRohACWaykUGoPPgizrKttTlX7NkDW1FS/TKKJSDVPantb8t+ZS+pGB5cnDFlVjtyDeNDKNP 6t94UxT77Xl2zl+wj+/8msC558/XhT3IeuvkLHukw0xglEf08J/uPF5pRcqgUAiyd/OK2n2Qz vjbvIOKO8nwwepPknnpeNj0NpdsbNptXiJ/fNlw598QaQbIfJCtsJDtP+71PHfxmo2e4+RPBy mCn/FTH4bX3cm0B6Xf0p193840OxcmVHKCaReJL3NDNvPLMUe4oAXX+02pb5sM7Ex82y5ZFXz EBfeHYOUUL6CRjSyIUCplRB49phpNc5gDI0bAUxS1M7beGmUbjwWr6JF/d/FFNTn7C4d5TCxW QaPn3gGjaaoQnB7+AnhCU/4kmhxm8OMpA/RON8OC5PPf8YUWSkBXtEBvmv+ak4v1/AKA/3SSO 8wbkqluQWl4W7pXwwBvpPyavxP52MV1s4iQ3WmLiq2ZxJiktU3EDW0e9BW/Hig9znMyys6WBX hQ6tpzrAh8nRpZRP7BJx0X2/3HANwTetD7w1x/BVDWvYjQ1hUEUeeXj/snXMtjTKUzVI8ErNH vK0SYL9nW6ySL1svmfmp6JBEodFdUzl6zmTyinoPpuHKyF2xLaOxG/AKvddaHHibCsc+wsdn3 332udlbUNVRxgqgymNpkFi6rCzZNZv8HTfWykNBQE2S9FmeXnvbSH+3kWxd2ArWX9ZuiJQAXh pA3MmoaloZMktuCssXTxZJHzYrNzgQ3+3RZ5FyAqLONymBuQudam/R1TtfYBGJPtYtLaZevWb euSPD84rC5h0IV4Us2N4cewjQkyDy8hDX1m/O5jIvhPeBYXjyghM+DyfzI+fmtwReXyfrrMHL lT9pYP+/x3oHgdJQbQdg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use WREG_I0 not WREG_O0 in order to properly save the "ins". The "outs" were saved separately in setup___siginfo. Signed-off-by: Richard Henderson Message-Id: <20191025113921.9412-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 0db4c5f84fe4..efb0df7e2b2d 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -192,7 +192,7 @@ void setup_frame(int sig, struct target_sigaction *ka, __put_user(env->regwptr[i + WREG_L0], &sf->ss.locals[i]); } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + WREG_O0], &sf->ss.ins[i]); + __put_user(env->regwptr[i + WREG_I0], &sf->ss.ins[i]); } if (err) goto sigsegv; From patchwork Tue Nov 5 18:11:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yYt32JRz9sNT for ; Wed, 6 Nov 2019 05:17:22 +1100 (AEDT) Received: from localhost ([::1]:47176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3OI-0003wf-8D for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:17:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Is-0005yZ-Jm for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Ir-0004hw-Er for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:42 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:37959) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Ir-0004h5-5n for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:41 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MORR2-1iIkPq3Dsk-00PuA3; Tue, 05 Nov 2019 19:11:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 09/13] linux-user/sparc64: Fix target_signal_frame Date: Tue, 5 Nov 2019 19:11:15 +0100 Message-Id: <20191105181119.26779-10-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:aaiuIS3g4IUmiBZLTQ3MtB761qKtMPZvu9Wgucdg87lqHFiHQ1o nFSTQ41vkPzzPB/X6Ij7+2XjrPve9bTDmbTXCNPPXmkU6/PAE0zMma3YuJ3pXiINDZEZ7gA DRIt52K8L5DY3WC6vRaHAJmeUda3C468u5VXmjwOUzMgjThXKEjyUkRE1F4zauLkKVggIQp F41N9qinFnWYVl+nzEheA== X-UI-Out-Filterresults: notjunk:1; V03:K0:1T3xwkgqo/I=:Uo1qkAcGUCQd+A8p5ckc3I mbjHi1JyCOnCeN6WfyFXGI3zT2z3STAa99StNIZDGSGWN9HO0wfYPVGYQYdk/9SPUhN3LeM4C IqTs0cGctopxEK8rlk2i3cTy8/muZIlH5bHA3Hu0hQbExqSQ3GMTBrAn18pQ5uxZ8ZjCep6rs zv7ZMWxRIJslMgNw5WXnPg/0bpdbjkOgi32sn53qF61hlOg3k2tWzXtSsF/6glbODaNFAHfnw kBDU/QroSAZuBkvvkYcRhAfY2Y0hGwxgXs3P07wgfUZxIBMZJH+9SRn4zm7Kdn8DyfVJk+Otn HxRoYKuC8USA1AnGLr2+vpW12vfkphfjQG4kzBkbM5DZYpOwH7CUreEnAyucuzG5+eda9LfsG 3QLyDx6eeBdTSawNUjRxsYL/P0LJGIHASuDwRzVQ6OcfCwleW2YeNR1EQbgpbJoQ424CckEdP YjVJ8alJegk10oMb8wtj5E5bXrSpH5k6TlB/Pbd+uJVTJx+dAUYlBxFKCeRLFIz8fqO7Ed+Ld V2NjMFctHSmLUvAVPRxvZ53Use1kPAJB1eEHilPf8MXVF062BgUiRH2ikijH+a4kz9aWFW1LA qrIulBCqdoThj/Ku80uF3EE0Fo23JH7A8AEKC4n+GhFmq9Q5cEteZskncCHeMuAhbwsiJXDKi WTurMVT4Q2EMHKPeedoHe3xpuTS9lQJJxU929GqasxFedT2+AGFjXsIsug/d1rADBax0wl1za PgiKBEEoAC+bu0hw6fW1NUyjhWI4PjkL2yHVHOz4NnWFDxtCPnSd48ybW/ZGGtJAFehATnKey K4EVeDjaQV8hrUaf8NTLy94A7vLV5XYz8vcGjeYaiYR+dx4RksENZuCffPcoawvUhVJEU3AEK weFWfuJCh53R3pyT6eQQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.73 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Instructions are always 4 bytes; use uint32_t not abi_ulong. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191025113921.9412-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index efb0df7e2b2d..ecfdf937e47b 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -87,7 +87,7 @@ struct target_signal_frame { struct sparc_stackf ss; __siginfo_t info; abi_ulong fpu_save; - abi_ulong insns[2] __attribute__ ((aligned (8))); + uint32_t insns[2] __attribute__ ((aligned (8))); abi_ulong extramask[TARGET_NSIG_WORDS - 1]; abi_ulong extra_size; /* Should be 0 */ qemu_siginfo_fpu_t fpu_state; @@ -98,7 +98,7 @@ struct target_rt_signal_frame { abi_ulong regs[20]; sigset_t mask; abi_ulong fpu_save; - unsigned int insns[2]; + uint32_t insns[2]; stack_t stack; unsigned int extra_size; /* Should be 0 */ qemu_siginfo_fpu_t fpu_state; From patchwork Tue Nov 5 18:11:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476ySM2GLRz9sP6 for ; Wed, 6 Nov 2019 05:12:35 +1100 (AEDT) Received: from localhost ([::1]:47132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Jg-00067M-Kw for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:12:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52031) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ir-0005x0-Px for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Ip-0004gc-QP for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:41 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:33527) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Ip-0004fc-Fr for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:39 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N0WLC-1hgfq51yKK-00wV5h; Tue, 05 Nov 2019 19:11:33 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 10/13] linux-user: Rename cpu_clone_regs to cpu_clone_regs_child Date: Tue, 5 Nov 2019 19:11:16 +0100 Message-Id: <20191105181119.26779-11-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:z1OVwN1/7yWMYtmB9SgCSZ15RHD917OPC0DUFAVUiTjBbXQx3Sl JVMm+wupe5i3oiQUM9Dm8KgAmxiZ0C9XQieJmdfLiLPnHLse8fIXiej5jwZqbOxJD+WJuWg t3w8CdSZSJTp3DF3PAoI8IeKpuVBdCXI2VK+UruuIPb5H/ni/bM0Ktg3QWuSk2FLmwt4jpO 0qf4gA1hEptCXzR5f2nbQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:LhD+djBbke8=:yrLJ5qHqnrhEgBf96u1va3 covi9x07XjNxteNKlvZA8fFuZ+v5lcfOihOFQYTtj2MEMGkUHZjn9tUWRcfhi/p8ZkE8fVfwY SS/MZ89QIPbDqLHTcFSoi8gUF3gYXrr2tV9rn1wWfhXAb2cWRf/zXMq2pNPBntzLvpMqCoFRl t90gTOdq+m6MHIMjUQ9dw/vjspBAsw5+EwVdgTPAWj0w2yAXwCtj0v1SZOF9Z7IIxxA66BqaH MsLHBkAQVsvV+rLCqVOLRBGAeLvL4lByJ/zG2kigR7jI1jLY7CwlhxFKc36j7Jbw+mPN2NjH0 wcxM5VVpXF1I6Vk4R4Tqu6Be2/GFurIVdcplDfIQAxGDmNfXSTEPWxhusAs35WY66mXn/u8uq 8SN6vKPSvaV7isjijHtJz4JDMlDtl+X4MT/HQDEwK209ODhS6XkMoINSL1QzRPUPs0vR29iMv DGK5JakHdwdHDGSt7k/uB4vjU4Vf5gV5SidOiSqg1x/MH/bpwQS909+Esd3Q/RgV/gRAwiuJ5 A0h9Bhc5fv0aAaBtlmy1IiHkwrescngIg9zkqU9O0EUb6Yhkp4nnsx8VHzYDDarUHzUdbiDle Bv81SpfRwZiWHECIvrGaVMSU5647HORxw1ebik0nMpReCJvr7/nWuV+YMHU/m/S/QxW3UPMAX RBw1euQDUub4KLS3u9hS0QrCgxq2OwCzCIlauC25nDkzTaUzliTi1fzup5eSgSIhNvKrL/zlA JWCbrA+F0uPLUNxsIkxN0YiAMhoQMuzjPoWJa2pKbSQWsan2LVY94M0VvRmrYAImiaLsKupsN 3Rjph0vSwp4ymqWYl7BMZHszk4dWJ8LWCpCcOlVH7B3mWgcQqdfaeG9gMvFQsfZuKSXHtF59v DgMpIQ9yPgYXFURI2FJ65l4P4E1/RdI9yhY++puGs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We will need a target-specific hook for adjusting registers in the parent during clone. To avoid confusion, rename the one we have to make it clear it affects the child. At the same time, pass in the flags from the clone syscall. We will need them for correct behaviour for Sparc. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20191025113921.9412-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/target_cpu.h | 3 ++- linux-user/alpha/target_cpu.h | 3 ++- linux-user/arm/target_cpu.h | 3 ++- linux-user/cris/target_cpu.h | 3 ++- linux-user/hppa/target_cpu.h | 3 ++- linux-user/i386/target_cpu.h | 3 ++- linux-user/m68k/target_cpu.h | 3 ++- linux-user/microblaze/target_cpu.h | 3 ++- linux-user/mips/target_cpu.h | 3 ++- linux-user/nios2/target_cpu.h | 3 ++- linux-user/openrisc/target_cpu.h | 4 +++- linux-user/ppc/target_cpu.h | 3 ++- linux-user/riscv/target_cpu.h | 3 ++- linux-user/s390x/target_cpu.h | 3 ++- linux-user/sh4/target_cpu.h | 3 ++- linux-user/sparc/target_cpu.h | 3 ++- linux-user/syscall.c | 4 ++-- linux-user/tilegx/target_cpu.h | 3 ++- linux-user/xtensa/target_cpu.h | 4 +++- 19 files changed, 40 insertions(+), 20 deletions(-) diff --git a/linux-user/aarch64/target_cpu.h b/linux-user/aarch64/target_cpu.h index a021c95fa418..cd012e0dc1c8 100644 --- a/linux-user/aarch64/target_cpu.h +++ b/linux-user/aarch64/target_cpu.h @@ -19,7 +19,8 @@ #ifndef AARCH64_TARGET_CPU_H #define AARCH64_TARGET_CPU_H -static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUARMState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->xregs[31] = newsp; diff --git a/linux-user/alpha/target_cpu.h b/linux-user/alpha/target_cpu.h index ac4d255ae752..37ba00cf41d1 100644 --- a/linux-user/alpha/target_cpu.h +++ b/linux-user/alpha/target_cpu.h @@ -19,7 +19,8 @@ #ifndef ALPHA_TARGET_CPU_H #define ALPHA_TARGET_CPU_H -static inline void cpu_clone_regs(CPUAlphaState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUAlphaState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->ir[IR_SP] = newsp; diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h index 3f79356a07fc..6e2ba8ad4b8e 100644 --- a/linux-user/arm/target_cpu.h +++ b/linux-user/arm/target_cpu.h @@ -41,7 +41,8 @@ static inline unsigned long arm_max_reserved_va(CPUState *cs) } #define MAX_RESERVED_VA arm_max_reserved_va -static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUARMState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[13] = newsp; diff --git a/linux-user/cris/target_cpu.h b/linux-user/cris/target_cpu.h index 23093439790c..eacc4d8d13e9 100644 --- a/linux-user/cris/target_cpu.h +++ b/linux-user/cris/target_cpu.h @@ -20,7 +20,8 @@ #ifndef CRIS_TARGET_CPU_H #define CRIS_TARGET_CPU_H -static inline void cpu_clone_regs(CPUCRISState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUCRISState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[14] = newsp; diff --git a/linux-user/hppa/target_cpu.h b/linux-user/hppa/target_cpu.h index 1c539bdbd6e9..f25077079088 100644 --- a/linux-user/hppa/target_cpu.h +++ b/linux-user/hppa/target_cpu.h @@ -19,7 +19,8 @@ #ifndef HPPA_TARGET_CPU_H #define HPPA_TARGET_CPU_H -static inline void cpu_clone_regs(CPUHPPAState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUHPPAState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->gr[30] = newsp; diff --git a/linux-user/i386/target_cpu.h b/linux-user/i386/target_cpu.h index ece04d096675..1fadbf57c367 100644 --- a/linux-user/i386/target_cpu.h +++ b/linux-user/i386/target_cpu.h @@ -20,7 +20,8 @@ #ifndef I386_TARGET_CPU_H #define I386_TARGET_CPU_H -static inline void cpu_clone_regs(CPUX86State *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUX86State *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[R_ESP] = newsp; diff --git a/linux-user/m68k/target_cpu.h b/linux-user/m68k/target_cpu.h index bc7446fbafdd..57b647bc0753 100644 --- a/linux-user/m68k/target_cpu.h +++ b/linux-user/m68k/target_cpu.h @@ -21,7 +21,8 @@ #ifndef M68K_TARGET_CPU_H #define M68K_TARGET_CPU_H -static inline void cpu_clone_regs(CPUM68KState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUM68KState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->aregs[7] = newsp; diff --git a/linux-user/microblaze/target_cpu.h b/linux-user/microblaze/target_cpu.h index 73e139938cc6..e9bc0fce6547 100644 --- a/linux-user/microblaze/target_cpu.h +++ b/linux-user/microblaze/target_cpu.h @@ -19,7 +19,8 @@ #ifndef MICROBLAZE_TARGET_CPU_H #define MICROBLAZE_TARGET_CPU_H -static inline void cpu_clone_regs(CPUMBState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUMBState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[R_SP] = newsp; diff --git a/linux-user/mips/target_cpu.h b/linux-user/mips/target_cpu.h index 02cf5eeff7c2..8601f712e086 100644 --- a/linux-user/mips/target_cpu.h +++ b/linux-user/mips/target_cpu.h @@ -19,7 +19,8 @@ #ifndef MIPS_TARGET_CPU_H #define MIPS_TARGET_CPU_H -static inline void cpu_clone_regs(CPUMIPSState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUMIPSState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->active_tc.gpr[29] = newsp; diff --git a/linux-user/nios2/target_cpu.h b/linux-user/nios2/target_cpu.h index 5596c05c9c0f..fe5de7a9e3c7 100644 --- a/linux-user/nios2/target_cpu.h +++ b/linux-user/nios2/target_cpu.h @@ -20,7 +20,8 @@ #ifndef NIOS2_TARGET_CPU_H #define NIOS2_TARGET_CPU_H -static inline void cpu_clone_regs(CPUNios2State *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUNios2State *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[R_SP] = newsp; diff --git a/linux-user/openrisc/target_cpu.h b/linux-user/openrisc/target_cpu.h index 32ff135089e0..309cf3eeb73e 100644 --- a/linux-user/openrisc/target_cpu.h +++ b/linux-user/openrisc/target_cpu.h @@ -20,7 +20,9 @@ #ifndef OPENRISC_TARGET_CPU_H #define OPENRISC_TARGET_CPU_H -static inline void cpu_clone_regs(CPUOpenRISCState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUOpenRISCState *env, + target_ulong newsp, + unsigned flags) { if (newsp) { cpu_set_gpr(env, 1, newsp); diff --git a/linux-user/ppc/target_cpu.h b/linux-user/ppc/target_cpu.h index c4641834e794..028b28312c51 100644 --- a/linux-user/ppc/target_cpu.h +++ b/linux-user/ppc/target_cpu.h @@ -19,7 +19,8 @@ #ifndef PPC_TARGET_CPU_H #define PPC_TARGET_CPU_H -static inline void cpu_clone_regs(CPUPPCState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUPPCState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->gpr[1] = newsp; diff --git a/linux-user/riscv/target_cpu.h b/linux-user/riscv/target_cpu.h index 90f9a4171ee7..26dcafab1c77 100644 --- a/linux-user/riscv/target_cpu.h +++ b/linux-user/riscv/target_cpu.h @@ -1,7 +1,8 @@ #ifndef RISCV_TARGET_CPU_H #define RISCV_TARGET_CPU_H -static inline void cpu_clone_regs(CPURISCVState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPURISCVState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->gpr[xSP] = newsp; diff --git a/linux-user/s390x/target_cpu.h b/linux-user/s390x/target_cpu.h index aa181ceaee83..0b19e42f758b 100644 --- a/linux-user/s390x/target_cpu.h +++ b/linux-user/s390x/target_cpu.h @@ -19,7 +19,8 @@ #ifndef S390X_TARGET_CPU_H #define S390X_TARGET_CPU_H -static inline void cpu_clone_regs(CPUS390XState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUS390XState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[15] = newsp; diff --git a/linux-user/sh4/target_cpu.h b/linux-user/sh4/target_cpu.h index b0be9a2c1bb0..857af43ee3aa 100644 --- a/linux-user/sh4/target_cpu.h +++ b/linux-user/sh4/target_cpu.h @@ -19,7 +19,8 @@ #ifndef SH4_TARGET_CPU_H #define SH4_TARGET_CPU_H -static inline void cpu_clone_regs(CPUSH4State *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUSH4State *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->gregs[15] = newsp; diff --git a/linux-user/sparc/target_cpu.h b/linux-user/sparc/target_cpu.h index b30fbc72c43b..029b0fc5475a 100644 --- a/linux-user/sparc/target_cpu.h +++ b/linux-user/sparc/target_cpu.h @@ -20,7 +20,8 @@ #ifndef SPARC_TARGET_CPU_H #define SPARC_TARGET_CPU_H -static inline void cpu_clone_regs(CPUSPARCState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUSPARCState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regwptr[22] = newsp; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 247883292ce5..245ed315c834 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5820,7 +5820,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, /* we create a new CPU instance. */ new_env = cpu_copy(env); /* Init regs that differ from the parent. */ - cpu_clone_regs(new_env, newsp); + cpu_clone_regs_child(new_env, newsp, flags); new_cpu = env_cpu(new_env); new_cpu->opaque = ts; ts->bprm = parent_ts->bprm; @@ -5899,7 +5899,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, ret = fork(); if (ret == 0) { /* Child Process. */ - cpu_clone_regs(env, newsp); + cpu_clone_regs_child(env, newsp, flags); fork_end(1); /* There is a race condition here. The parent process could theoretically read the TID in the child process before the child diff --git a/linux-user/tilegx/target_cpu.h b/linux-user/tilegx/target_cpu.h index d1aa5824f292..0523dc414cc5 100644 --- a/linux-user/tilegx/target_cpu.h +++ b/linux-user/tilegx/target_cpu.h @@ -19,7 +19,8 @@ #ifndef TILEGX_TARGET_CPU_H #define TILEGX_TARGET_CPU_H -static inline void cpu_clone_regs(CPUTLGState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUTLGState *env, target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[TILEGX_R_SP] = newsp; diff --git a/linux-user/xtensa/target_cpu.h b/linux-user/xtensa/target_cpu.h index e31efe3ea090..84f67d469ec0 100644 --- a/linux-user/xtensa/target_cpu.h +++ b/linux-user/xtensa/target_cpu.h @@ -4,7 +4,9 @@ #ifndef XTENSA_TARGET_CPU_H #define XTENSA_TARGET_CPU_H -static inline void cpu_clone_regs(CPUXtensaState *env, target_ulong newsp) +static inline void cpu_clone_regs_child(CPUXtensaState *env, + target_ulong newsp, + unsigned flags) { if (newsp) { env->regs[1] = newsp; From patchwork Tue Nov 5 18:11:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476ygw1Stwz9sNx for ; Wed, 6 Nov 2019 05:22:34 +1100 (AEDT) Received: from localhost ([::1]:47238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3TM-0001N8-3y for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:22:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52190) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Iy-00068v-AQ for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iw-0004lc-96 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:48 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:40047) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3Iv-0004l6-Uc for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:46 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N0nSN-1hgOix1IIv-00wm4a; Tue, 05 Nov 2019 19:11:34 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 11/13] linux-user: Introduce cpu_clone_regs_parent Date: Tue, 5 Nov 2019 19:11:17 +0100 Message-Id: <20191105181119.26779-12-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:fX4kCBJfxuYxyBVHh2AKxjQ20aaDaX/gykJJ/OSq7UiLeUs7/vw iQdStf2yrEIQtRuVMkZcCWPvc1YVkSgS0Q9IJ4iqNWsuhWdEUuCU0qab4ZV8ltQ8Oq6uakc Ekc0paWTbCzJEhnB9iLZV0k2p0JGy4BdwInt2sewXA5loGveCrG0qjzOYbRfS0S8sbfnNr6 l4uin5tZdh9Prso+PQ3iQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:kvsxuWna+9A=:Qyr/WwnSewUlNuFu+4p+kh vwA4p5mji6o6rsv/R4IKvAJOJeqB+pc8Lbt3krgnOsAYA9B/o2BAoU56d/BX1BpspM2BQ5/mT svSupATwUtRjxxvke0cKshLKZmdxOtYbvvvqYNP4GpdPx+sY7qMvfsE9/HlsAcIoySn/OWAuc xySSyGu+UZw5hHYjtWcOUduOOSqA/pywtbadvMJD1YeyXHQsDjFOaEX/0SeN6cualafdqXwQg yfNS029/s/h/5OIZpQl2oBP3zLS+YJ1eV/eGs2q+rqxwBpxqyztqFHlUoG1Cp6wI1B+siiiBB EabmvfQ6Tw2tIWCLMR+G/TfPKrZ2Mv3j9hcmwS8FTrPz+poKXNHSV2XGkKLO20DlPaKud+9NB WUxNChSo2ZbXAWe+oIdeT/cyRG+AIGDDvGr+MOtcol73vlkceoXoVae1I/fdI6/DEWU8+gBdV cDkBgKgrCgfDcN3iNaLrzNZ3MwUIQxTYEr8u4s53P0sZ3xiNshwOuZSXYKb7PGneSLxECHxeX V0p91zFuM5LydGFbQNceWTraozK6pjlYVN0weR8Cw1GUtW5cb39xODH+I3wZM3n5/W1LktVyW 13RlQFXLAJnW9zqrFE2ucvlWNhEPgroljvzYj4XiCqej1b/L8mXmdSia+grIX93hKkCpZ6Btj /GOc4lbzEfYxo2ZCCjWURksGLotaV6LmGaIlaI0wVQql5Ufa2LDDeEbulBMMpWLgn4g67oU/c sIliP8xMO/mqNnK3yogMOKR+PstygyoyPY7iJoKPLKaoUyWNmWmEBMVmHBgQgA2PR2RgE5tK3 EiH0y4xfsJXqc/mj3qw0wlAJLwuj+TiYpANq9GPs5jzCehxpbAPs5Vpa4uRyBkwzs1TZdX24a DZsfPy/OqdMq/HXdMSAs7ybQFcc7zntBwUF669GP0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.24 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We will need a target-specific hook for adjusting registers in the parent during clone. Add an empty inline function for each target, and invoke it from the proper places. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20191025113921.9412-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/target_cpu.h | 4 ++++ linux-user/alpha/target_cpu.h | 4 ++++ linux-user/arm/target_cpu.h | 4 ++++ linux-user/cris/target_cpu.h | 4 ++++ linux-user/hppa/target_cpu.h | 4 ++++ linux-user/i386/target_cpu.h | 4 ++++ linux-user/m68k/target_cpu.h | 4 ++++ linux-user/microblaze/target_cpu.h | 4 ++++ linux-user/mips/target_cpu.h | 4 ++++ linux-user/nios2/target_cpu.h | 4 ++++ linux-user/openrisc/target_cpu.h | 4 ++++ linux-user/ppc/target_cpu.h | 4 ++++ linux-user/riscv/target_cpu.h | 4 ++++ linux-user/s390x/target_cpu.h | 4 ++++ linux-user/sh4/target_cpu.h | 4 ++++ linux-user/sparc/target_cpu.h | 4 ++++ linux-user/syscall.c | 2 ++ linux-user/tilegx/target_cpu.h | 4 ++++ linux-user/xtensa/target_cpu.h | 4 ++++ 19 files changed, 74 insertions(+) diff --git a/linux-user/aarch64/target_cpu.h b/linux-user/aarch64/target_cpu.h index cd012e0dc1c8..6cc02e7dcdfb 100644 --- a/linux-user/aarch64/target_cpu.h +++ b/linux-user/aarch64/target_cpu.h @@ -28,6 +28,10 @@ static inline void cpu_clone_regs_child(CPUARMState *env, target_ulong newsp, env->xregs[0] = 0; } +static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls) { /* Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is diff --git a/linux-user/alpha/target_cpu.h b/linux-user/alpha/target_cpu.h index 37ba00cf41d1..dd25e18f47fb 100644 --- a/linux-user/alpha/target_cpu.h +++ b/linux-user/alpha/target_cpu.h @@ -29,6 +29,10 @@ static inline void cpu_clone_regs_child(CPUAlphaState *env, target_ulong newsp, env->ir[IR_A3] = 0; } +static inline void cpu_clone_regs_parent(CPUAlphaState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUAlphaState *env, target_ulong newtls) { env->unique = newtls; diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h index 6e2ba8ad4b8e..2747211b24ab 100644 --- a/linux-user/arm/target_cpu.h +++ b/linux-user/arm/target_cpu.h @@ -50,6 +50,10 @@ static inline void cpu_clone_regs_child(CPUARMState *env, target_ulong newsp, env->regs[0] = 0; } +static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls) { if (access_secure_reg(env)) { diff --git a/linux-user/cris/target_cpu.h b/linux-user/cris/target_cpu.h index eacc4d8d13e9..74ead55c8114 100644 --- a/linux-user/cris/target_cpu.h +++ b/linux-user/cris/target_cpu.h @@ -29,6 +29,10 @@ static inline void cpu_clone_regs_child(CPUCRISState *env, target_ulong newsp, env->regs[10] = 0; } +static inline void cpu_clone_regs_parent(CPUCRISState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUCRISState *env, target_ulong newtls) { env->pregs[PR_PID] = (env->pregs[PR_PID] & 0xff) | newtls; diff --git a/linux-user/hppa/target_cpu.h b/linux-user/hppa/target_cpu.h index f25077079088..71654b3cd4c0 100644 --- a/linux-user/hppa/target_cpu.h +++ b/linux-user/hppa/target_cpu.h @@ -32,6 +32,10 @@ static inline void cpu_clone_regs_child(CPUHPPAState *env, target_ulong newsp, env->iaoq_b = env->gr[31] + 4; } +static inline void cpu_clone_regs_parent(CPUHPPAState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUHPPAState *env, target_ulong newtls) { env->cr[27] = newtls; diff --git a/linux-user/i386/target_cpu.h b/linux-user/i386/target_cpu.h index 1fadbf57c367..0b44530854c8 100644 --- a/linux-user/i386/target_cpu.h +++ b/linux-user/i386/target_cpu.h @@ -29,6 +29,10 @@ static inline void cpu_clone_regs_child(CPUX86State *env, target_ulong newsp, env->regs[R_EAX] = 0; } +static inline void cpu_clone_regs_parent(CPUX86State *env, unsigned flags) +{ +} + #if defined(TARGET_ABI32) abi_long do_set_thread_area(CPUX86State *env, abi_ulong ptr); diff --git a/linux-user/m68k/target_cpu.h b/linux-user/m68k/target_cpu.h index 57b647bc0753..c3f288dfe83e 100644 --- a/linux-user/m68k/target_cpu.h +++ b/linux-user/m68k/target_cpu.h @@ -30,6 +30,10 @@ static inline void cpu_clone_regs_child(CPUM68KState *env, target_ulong newsp, env->dregs[0] = 0; } +static inline void cpu_clone_regs_parent(CPUM68KState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUM68KState *env, target_ulong newtls) { CPUState *cs = env_cpu(env); diff --git a/linux-user/microblaze/target_cpu.h b/linux-user/microblaze/target_cpu.h index e9bc0fce6547..ce7b22ece7c4 100644 --- a/linux-user/microblaze/target_cpu.h +++ b/linux-user/microblaze/target_cpu.h @@ -28,6 +28,10 @@ static inline void cpu_clone_regs_child(CPUMBState *env, target_ulong newsp, env->regs[3] = 0; } +static inline void cpu_clone_regs_parent(CPUMBState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUMBState *env, target_ulong newtls) { env->regs[21] = newtls; diff --git a/linux-user/mips/target_cpu.h b/linux-user/mips/target_cpu.h index 8601f712e086..758ae4d933fe 100644 --- a/linux-user/mips/target_cpu.h +++ b/linux-user/mips/target_cpu.h @@ -29,6 +29,10 @@ static inline void cpu_clone_regs_child(CPUMIPSState *env, target_ulong newsp, env->active_tc.gpr[2] = 0; } +static inline void cpu_clone_regs_parent(CPUMIPSState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls) { env->active_tc.CP0_UserLocal = newtls; diff --git a/linux-user/nios2/target_cpu.h b/linux-user/nios2/target_cpu.h index fe5de7a9e3c7..50f03810675a 100644 --- a/linux-user/nios2/target_cpu.h +++ b/linux-user/nios2/target_cpu.h @@ -29,6 +29,10 @@ static inline void cpu_clone_regs_child(CPUNios2State *env, target_ulong newsp, env->regs[R_RET0] = 0; } +static inline void cpu_clone_regs_parent(CPUNios2State *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUNios2State *env, target_ulong newtls) { /* diff --git a/linux-user/openrisc/target_cpu.h b/linux-user/openrisc/target_cpu.h index 309cf3eeb73e..74370d67c45d 100644 --- a/linux-user/openrisc/target_cpu.h +++ b/linux-user/openrisc/target_cpu.h @@ -30,6 +30,10 @@ static inline void cpu_clone_regs_child(CPUOpenRISCState *env, cpu_set_gpr(env, 11, 0); } +static inline void cpu_clone_regs_parent(CPUOpenRISCState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUOpenRISCState *env, target_ulong newtls) { cpu_set_gpr(env, 10, newtls); diff --git a/linux-user/ppc/target_cpu.h b/linux-user/ppc/target_cpu.h index 028b28312c51..76b67d2882bf 100644 --- a/linux-user/ppc/target_cpu.h +++ b/linux-user/ppc/target_cpu.h @@ -28,6 +28,10 @@ static inline void cpu_clone_regs_child(CPUPPCState *env, target_ulong newsp, env->gpr[3] = 0; } +static inline void cpu_clone_regs_parent(CPUPPCState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUPPCState *env, target_ulong newtls) { #if defined(TARGET_PPC64) diff --git a/linux-user/riscv/target_cpu.h b/linux-user/riscv/target_cpu.h index 26dcafab1c77..9c642367a362 100644 --- a/linux-user/riscv/target_cpu.h +++ b/linux-user/riscv/target_cpu.h @@ -11,6 +11,10 @@ static inline void cpu_clone_regs_child(CPURISCVState *env, target_ulong newsp, env->gpr[xA0] = 0; } +static inline void cpu_clone_regs_parent(CPURISCVState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPURISCVState *env, target_ulong newtls) { env->gpr[xTP] = newtls; diff --git a/linux-user/s390x/target_cpu.h b/linux-user/s390x/target_cpu.h index 0b19e42f758b..7cd71e2dbab3 100644 --- a/linux-user/s390x/target_cpu.h +++ b/linux-user/s390x/target_cpu.h @@ -28,6 +28,10 @@ static inline void cpu_clone_regs_child(CPUS390XState *env, target_ulong newsp, env->regs[2] = 0; } +static inline void cpu_clone_regs_parent(CPUS390XState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUS390XState *env, target_ulong newtls) { env->aregs[0] = newtls >> 32; diff --git a/linux-user/sh4/target_cpu.h b/linux-user/sh4/target_cpu.h index 857af43ee3aa..5114f1942482 100644 --- a/linux-user/sh4/target_cpu.h +++ b/linux-user/sh4/target_cpu.h @@ -28,6 +28,10 @@ static inline void cpu_clone_regs_child(CPUSH4State *env, target_ulong newsp, env->gregs[0] = 0; } +static inline void cpu_clone_regs_parent(CPUSH4State *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUSH4State *env, target_ulong newtls) { env->gbr = newtls; diff --git a/linux-user/sparc/target_cpu.h b/linux-user/sparc/target_cpu.h index 029b0fc5475a..8ff706adcef7 100644 --- a/linux-user/sparc/target_cpu.h +++ b/linux-user/sparc/target_cpu.h @@ -37,6 +37,10 @@ static inline void cpu_clone_regs_child(CPUSPARCState *env, target_ulong newsp, #endif } +static inline void cpu_clone_regs_parent(CPUSPARCState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls) { env->gregs[7] = newtls; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 245ed315c834..ab9d933e53af 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5821,6 +5821,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, new_env = cpu_copy(env); /* Init regs that differ from the parent. */ cpu_clone_regs_child(new_env, newsp, flags); + cpu_clone_regs_parent(env, flags); new_cpu = env_cpu(new_env); new_cpu->opaque = ts; ts->bprm = parent_ts->bprm; @@ -5917,6 +5918,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, if (flags & CLONE_CHILD_CLEARTID) ts->child_tidptr = child_tidptr; } else { + cpu_clone_regs_parent(env, flags); fork_end(0); } } diff --git a/linux-user/tilegx/target_cpu.h b/linux-user/tilegx/target_cpu.h index 0523dc414cc5..316b7a639c3d 100644 --- a/linux-user/tilegx/target_cpu.h +++ b/linux-user/tilegx/target_cpu.h @@ -28,6 +28,10 @@ static inline void cpu_clone_regs_child(CPUTLGState *env, target_ulong newsp, env->regs[TILEGX_R_RE] = 0; } +static inline void cpu_clone_regs_parent(CPUTLGState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUTLGState *env, target_ulong newtls) { env->regs[TILEGX_R_TP] = newtls; diff --git a/linux-user/xtensa/target_cpu.h b/linux-user/xtensa/target_cpu.h index 84f67d469ec0..0c77bafd66f7 100644 --- a/linux-user/xtensa/target_cpu.h +++ b/linux-user/xtensa/target_cpu.h @@ -16,6 +16,10 @@ static inline void cpu_clone_regs_child(CPUXtensaState *env, env->regs[2] = 0; } +static inline void cpu_clone_regs_parent(CPUXtensaState *env, unsigned flags) +{ +} + static inline void cpu_set_tls(CPUXtensaState *env, target_ulong newtls) { env->uregs[THREADPTR] = newtls; From patchwork Tue Nov 5 18:11:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189884 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476yf84Q22z9sNx for ; Wed, 6 Nov 2019 05:21:04 +1100 (AEDT) Received: from localhost ([::1]:47224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ru-00084q-9G for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:21:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Iv-00063a-6y for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Iu-0004kP-0N for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:45 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:40493) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3It-0004jc-Mn for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:43 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N18I8-1hmgvt0OEc-012U31; Tue, 05 Nov 2019 19:11:35 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 12/13] linux-user/sparc: Fix cpu_clone_regs_* Date: Tue, 5 Nov 2019 19:11:18 +0100 Message-Id: <20191105181119.26779-13-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:r0fsDaXcjdF5yek/2ye+ffad8EIzMItAXWG2mxZr0KG49yKk4bM r6x5+0N/PsYIKpypyw/IcyzyxzEDV8HuJGD93ticAO5401fkuqNp9E+ppiSfAqi7o71wz/7 508IDhZdOiFAa1XcyU49aG3qUFueGBIfTEP1mTu921+aEAVAvtqzb88wqzMR3oseiuYXyuR LMKSyIFMOpw32BbUVvu4w== X-UI-Out-Filterresults: notjunk:1; V03:K0:7vuyFv4tAO0=:E1kQfaPBg84H11y3SJxux9 Q8oqQUHY3ABsFvwqbbo3gw82DhqjvG3t7z6adjbDb//RYAWdcO0aYcsdnO45ZOQXG9GXCHy+k h7Z6NiCTVCoguq+6hJSrr4kaHMlehvPz0dwNZEzoG3Z36Ug1BvJaccsWMrdzu3PBaeq7NK4jE A/ZFmCtdL1HhZw/wagK0/MmEJjxERd2AYmIHungteXIIlsrkpTmfBdZLmeHqFXdnpFiThD1k1 qSDMcM8NE6bdfTCRDkvpAdZtIIdT0JfRhsuVfexSsFXuuFYPI3FyB2nygm9HT4PCvSArEGeWi 7hI1QipPgORitrxShIHNXy0YltW7zqWgUJkKSBwnW/beifWP2tjvvjQBNqwDbeU5C6GZ8TKd+ 29ABBi2o3oFtmfmmtA31J+qzhUhBmU2RlG8sPaLjTZTZ6fjX5lgPggqqyNPJ3WgG7moNgQebe PJY7RcSI3Us2yBzHA9vTX0wYA+yrAn+R5pIDKDMoQFWqr9fx1hrCcKd09bCTRW/WEG8mFxzYi wO8PedrBkViRYltXdfIEisvyIpWSkKKNXlcasfv8QP0D59Q5BvEcQviDCFvH2UCwHrrCIBR6M bo4hgEKqwBVfDg11kcWTBH80Pur12Y8jw/mYalakU5d7HuIEUTJNz8m3HnW3udKNc1XWEQGWj AZk4AWbkaVGmiYqIpMYcNTB+VcJXf61x988U8gLz/g4djL0hM2ONcjLVyaakd836Rbxaw4sk3 fsOI8T08hKd94P/tXsZeb8XaEVX+8k1jQYmz5fiISdHw31t+4t6ItmHXJIASbUk8k1HX8tHLF KLra5I8zkS8MlkJkNWxQyCIN57KcFPGZou75i4Iwi7GGBXZlWkHPQ+wTWQ69E0MlYq8ZCjIES 82+TS8OQxuPbcipeiR5w== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We failed to set the secondary return value in %o1 we failed to advance the PC past the syscall, we failed to adjust regwptr into the new structure, we stored the stack pointer into the wrong register. Signed-off-by: Richard Henderson Message-Id: <20191025113921.9412-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/target_cpu.h | 43 +++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/linux-user/sparc/target_cpu.h b/linux-user/sparc/target_cpu.h index 8ff706adcef7..14b21589699b 100644 --- a/linux-user/sparc/target_cpu.h +++ b/linux-user/sparc/target_cpu.h @@ -23,22 +23,51 @@ static inline void cpu_clone_regs_child(CPUSPARCState *env, target_ulong newsp, unsigned flags) { + /* + * After cpu_copy, env->regwptr is pointing into the old env. + * Update the new cpu to use its own register window. + */ + env->regwptr = env->regbase + (env->cwp * 16); + if (newsp) { - env->regwptr[22] = newsp; + /* When changing stacks, do it with clean register windows. */ +#ifdef TARGET_SPARC64 + env->cansave = env->nwindows - 2; + env->cleanwin = env->nwindows - 2; + env->canrestore = 0; +#else + env->wim = 1 << env->cwp; +#endif + /* ??? The kernel appears to copy one stack frame to the new stack. */ + /* ??? The kernel force aligns the new stack. */ + env->regwptr[WREG_SP] = newsp; } - /* syscall return for clone child: 0, and clear CF since - * this counts as a success return value. - */ - env->regwptr[0] = 0; + + if (flags & CLONE_VM) { + /* + * Syscall return for clone child: %o0 = 0 and clear CF since this + * counts as a success return value. Advance the PC past the syscall. + * For fork child, all of this happens in cpu_loop, and we must not + * do the pc advance twice. + */ + env->regwptr[WREG_O0] = 0; #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc &= ~PSR_CARRY; + env->xcc &= ~PSR_CARRY; #else - env->psr &= ~PSR_CARRY; + env->psr &= ~PSR_CARRY; #endif + env->pc = env->npc; + env->npc = env->npc + 4; + } + + /* Set the second return value for the child: %o1 = 1. */ + env->regwptr[WREG_O1] = 1; } static inline void cpu_clone_regs_parent(CPUSPARCState *env, unsigned flags) { + /* Set the second return value for the parent: %o1 = 0. */ + env->regwptr[WREG_O1] = 0; } static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls) From patchwork Tue Nov 5 18:11:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1189870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 476ySF3jWRz9sP6 for ; Wed, 6 Nov 2019 05:12:29 +1100 (AEDT) Received: from localhost ([::1]:47128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ja-0005xN-Nf for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:12:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51999) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Ip-0005p4-9r for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3Io-0004fM-6v for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:39 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:44091) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iS3In-0004eW-To for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:11:38 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MadC8-1hvSNJ37dK-00cBkp; Tue, 05 Nov 2019 19:11:35 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 13/13] linux-user/alpha: Set r20 secondary return value Date: Tue, 5 Nov 2019 19:11:19 +0100 Message-Id: <20191105181119.26779-14-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191105181119.26779-1-laurent@vivier.eu> References: <20191105181119.26779-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:G5Qvq9AUwF43EHf2Ts0+hSE4/ieC4dEfMCGuVPb0+S4cAhx+CkS Bviyb1VDatREu20ezQcBca1qCqm+S4F76Q/14raGATNDrE+++zvwwhb00BNbd0nxN+5X/zw irnXI5HaYSCC6644dJmIRXuCX51+eC6EfPvdKQ4vonEaPTsZvPIz9nZvq4P/c3zs9ykTNdn aA6jVitt8v6p9G+0qrddA== X-UI-Out-Filterresults: notjunk:1; V03:K0:GzKNXf/4V7U=:VYgqIR3/Si08vGcYzOt/oS nPOzcPW3TikWKAZ/GBGmgObmfZzI3O0Y0age/3tcH9AVSX3IUgK1jih+Ym8pGVItS6fusDUjQ QLFinTukIidQ2aMYwX9oXOxqhybI07gg2XO/SPDZHNDrQ1miphRFQRcQK0GHgJ0+6aUaGwG2d aZWOSgZogbWtcNmM4XkgU3X9bDha4T5C77fA3OpfuEP/y9kQR7IXsVvgNq2gvWDgZXqZE8WV9 juU7jCLbopWgLF8nxQF+sIfQb7JIP1oejokRIaeth0an28OZM3F67yqWsddgBChf+NKmnFJLA 8lwEFrN0U7Dz1Ad6dN8gpCrYUQyDkJXt5TCiCUe35X4ThDOvwzCJxwNmZMT1Ii8x/XJ23SPmb MHTBNJesUZwWbpq6TSp7QF6JljPRa/KZVzmP5cRLUDxp0TOV51OnVBFBt+YNdm36GpDLlHah+ 4oPPoHIDb87n1WdA2N1c19SpjpAYVAxGqqOITZvCyYOTw1mJPAzzRU1oH7qxA5usUxTWkI+S1 z9fy96sH8K6B2rKWoh/2/YrOamFeeM3bytn4knGwIyMzkqWXmcA7VbBQ8PQg6Rob2nIZ9n9l8 SuRdxE3aqqLKbzj+Jbe7MGubdUmusi/Jdm7z5mmmvE4l799ABKyry73IP98gt0Ob5H7EuM3sl 4uCYfQIZoAp2VLdt/V9rxk1j/HAzZgqMbQv2mViMoWxE2kdrb02nl0vvduylRFh8qkZTlSk7v s6LPxqaoan5wnPl6xP4xYsdPQQPDFXmDsLmapDPSmev5TlrnYlbbOwEq6va61dLJA3MP4tAJz ddgoQR8lHbGlITYQd0uJddY+/d6iO0xhg5kf7lNdGXr8eKhTD3N+ZLFjlOEATXaR601pqCeEi kPIvH5X7V/KOitiC2ThQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This value is not, as far as I know, used by any linux software, but it is set by the kernel and is part of the ABI. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191025113921.9412-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/alpha/target_cpu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux-user/alpha/target_cpu.h b/linux-user/alpha/target_cpu.h index dd25e18f47fb..ad408ab5cc8e 100644 --- a/linux-user/alpha/target_cpu.h +++ b/linux-user/alpha/target_cpu.h @@ -27,10 +27,19 @@ static inline void cpu_clone_regs_child(CPUAlphaState *env, target_ulong newsp, } env->ir[IR_V0] = 0; env->ir[IR_A3] = 0; + env->ir[IR_A4] = 1; /* OSF/1 secondary return: child */ } static inline void cpu_clone_regs_parent(CPUAlphaState *env, unsigned flags) { + /* + * OSF/1 secondary return: parent + * Note that the kernel does not do this if SETTLS, because the + * settls argument register is still live after copy_thread. + */ + if (!(flags & CLONE_SETTLS)) { + env->ir[IR_A4] = 0; + } } static inline void cpu_set_tls(CPUAlphaState *env, target_ulong newtls)