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: 178535 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1116389ilf; Tue, 5 Nov 2019 10:16:16 -0800 (PST) X-Google-Smtp-Source: APXvYqw5+GfjuyGM0KL3ez7BHkWosoDB3BVuYprnlI93uj+Q+z1FE2by3PQZlgGMOqOucFepmrwR X-Received: by 2002:a50:a7a1:: with SMTP id i30mr3002818edc.94.1572977776530; Tue, 05 Nov 2019 10:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977776; cv=none; d=google.com; s=arc-20160816; b=BFMrZCF+m4/YSK5T+SyhHyGt0Ub97i9Tsltwuo8qB6OoqC11x6sS3bvdAPXf4C5LjX UpTvP1tVxH0TpZHpNTemg8+8TluybyICahNR3J4d2C5DSsnmQZLuIQyjvUDt2nCD+DO8 ac94r3QP4b8TyPXc/3x3tt8qReVDADuJTgmSto4Ws+AJSLCbyEcqplLyG2JUUM3/pFa8 ACqmlKyJzQoxPS2k63wVWkENDpkpzJJoyCgwdNJm6q7ITXUtfUeY1khL2nog4CTzo7gL +UIgp24btbk6uOxsJGioKiV2WWUggQtJqWy+8ifd4Jb46Jo2gFjTiGmPFwOIqX+94puR A61g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=o1LAazBP9Xr2BsB/zczyAKWcxaOHiJZGTnGNHsL41ic=; b=S8UHn5O4qSdnCzB3OD2NYR3/76iX8QoQzjeLRaV+w/3YcNgYFOtTLS032Bbx4X4O0I 5x4hLM/Ey+mkRbqVvmPd1Xa2+zeWVUB9fzoLczYLWfxKGzg5UWz503pLleQC203RP+2X h2zezxPo/X5aqQSqIb1WKwxEFApnyAj6ty0ZeMT87LAkYjGe+nIL+SlwDdPBQ29Z9+g3 hIjgAmN3TgmAr55O3E/kOgoxQvaXiyu0NUWNnlaKe9t+/zPkCX4zWa9c7MpJYYMiJGYa HAAoOVbQwW0lx1JrDDeWFmMDvp57zFleq39LFvvlbd+MbQvmDUBYK2C+BrwTc97RiT1w 48og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b29si10744838ede.118.2019.11.05.10.16.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:16:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3NH-0003of-1l for patch@linaro.org; Tue, 05 Nov 2019 13:16:15 -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+patch=linaro.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(-) -- 2.21.0 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: 178539 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1119798ilf; Tue, 5 Nov 2019 10:19:15 -0800 (PST) X-Google-Smtp-Source: APXvYqz8/sbB8QyIc3uQn/HmTGLe/PyejtfvNnFnvVAU/kqZtTsiNLrMdxfZrRm21Xi+lZe899oU X-Received: by 2002:a37:4f83:: with SMTP id d125mr21244885qkb.205.1572977955484; Tue, 05 Nov 2019 10:19:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977955; cv=none; d=google.com; s=arc-20160816; b=ftuvzx0MjD91oWwrOozn3SmRDW8+UvphHIer4joU9EgjjXA2ChsRHetTtmGk/zBbcF BOA06HnKYscT8lBkTQMh61M+AsAVJwZyyTyMT1ETW0TRyiyjCac0NqGs24oPU4qgS8uY 6xZGOI0w5XcT1jKChA7RSygSa+sSQaEfvQQR/S/U9m0KoiEHdGVBSVQGhfegoeNtMiSi LaQLmiJ2JL7HoG3idZGilHROJYHHyE5k5OmDtFUFdjR3GHzDCTNO++wXD2wjqH5VPShJ npDvEbUm1gyAju9azflNEHn5ga018FGyxYyFrlgJN0HlvFPTOD8dTyrburKVoYeYqOZX IG9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=lPemnGQGksT0K3hjuTUKc7M2IcF8hx0rZE/s64UA7BY=; b=XGDXsczQAWOizM2gvPYFXtJHmjkLsPsdYVb4Tvpoea9a0Eu8ntK6SfOajJf5rSh6db gCs1S4V1YenKbklMS7Gi21OVeDlkipRjo6ZjRxnrJF6fMn36vmYfty7Wv4kJFAEkPylb EPLKj2JwZHxGPwhLvgmEOlE8TYt+A2gAATqhUuySxSXUD9M6bKjgalzscJODOHqnlz1F hvS8m4ChtIVODUTVOGz60vp1DeTo2Xh4CnYeOXrGlWioxBah8KR9p0ZpfY7WHJ15UK4u /4d/s47P+on2w7K6VbnNKj9S+R5SVuPjGHpc/Oh+QZUybW/xCtHQtThFOUA6W0DFWKQf sKcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w9si13326486qka.21.2019.11.05.10.19.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:19:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3QA-0006C5-SV for patch@linaro.org; Tue, 05 Nov 2019 13:19:14 -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+patch=linaro.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(-) -- 2.21.0 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: 178540 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1119825ilf; Tue, 5 Nov 2019 10:19:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyq5oECDWq4AuGxsKkA+QJnazYyy44bzRVrAEowwbnLcYOh2P1/umU0dYW1Qv0/Q5AEeanm X-Received: by 2002:ac8:2fda:: with SMTP id m26mr19639420qta.374.1572977956556; Tue, 05 Nov 2019 10:19:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977956; cv=none; d=google.com; s=arc-20160816; b=OUl+ZAMnKkXFS/Tkknysb4tIxfF5Ar6iSEYzvz1Oh2XoXVmJUqPdUOa5nEwQMiqoe9 FSGBvJSKuX3Q8MH4zIfIpUc6xhMeqS0NxPHhoj3qKRpLtmEzHPiB8JRck/nYSzrrEEQy TozwuQ8k2iCbML+Yl7Ag1jknFh87iuKkb1Ga35J3VNpfALg1QYoU960VYxLd8Gxl3B85 v5YCBivhzakIzCxCQvXE0qOm7ZS9h0siuFvWvOOpNk+l8uWvwydq4UA4xRCrWQPucR2S JlnAo5iG/+X7PaYXCt6OIdbvfBaWe6mtGTqSuuuYfKCr/3oNCdnNW/1jlduNU/OLyFU5 cnjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=JqS0i8yaqlRlmq4fyYnby3BErG5d/xl1UcPg3CNJw+A=; b=tVwI8O3+FTisuKPa6zCUZheTLkX5qz4AdJJXm5CXhkgN9YOGzzsSiS42IJ+JU1c1Sw pxfwwqmUl+JGTM0OcHXHRIBV7wI8NDtslMcIGgMeMFrFedICCOVBRbRS6Ev+IQUOxId8 zpf84c6Psh4iqH+GLQijnlpP4NZ54yu7yCuEFUwrbKS00eUxNBk+u3YOKSKEkRDU2gLB n6OHIavRctQ0pKsRGiEfy6zg07fSgRC4TwJhQRniSraakDM+GjNhHNraOV32NMy9106t ZKG80+wSxYPsH+J1vggG68ywZ5esBvzW2LGSjn8kab11iDFVpUpgTuHW+Ezl/3FQoEcK rprQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g2si16255988qtk.72.2019.11.05.10.19.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:19:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3QC-0006DZ-0n for patch@linaro.org; Tue, 05 Nov 2019 13:19:16 -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+patch=linaro.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(+) -- 2.21.0 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: 178537 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1119154ilf; Tue, 5 Nov 2019 10:18:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwGKTpRHDUozJkJfszs8usmFPmWOl7PnjZSPPZzu2qpl2SBJh60BmEm+00rUkOo0qHyDjgM X-Received: by 2002:a0c:d645:: with SMTP id e5mr28860010qvj.176.1572977921541; Tue, 05 Nov 2019 10:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977921; cv=none; d=google.com; s=arc-20160816; b=fI87S/x089nfCTTK/vaOq4PPIQGVH/+7YhPmil7DlZnD+dAsky04MjLY5PThF6lgCD VWxazbpLbsU2C4sEmW6uu3jgf+GpDnq0MagmOC41txVGUinaShhItC09AjBF1HATJQxi KKQI9b+hhhqfvRRJ6ZuNmCsR3W0D1KomdnQoxBi+eqIo9/K0jVY4Zxeq1x6s8WizPziE xQ4STws78J0lPEtW7H2tAiZB3uIXuKmOUI+gz2P7EjGSTD/qZR/u7lO+u5afyJ1aZd7w +cppzfwgUA5cZGlU2KvYCCZXqVZ94pGmb87tx2azH4tzUNcAtIdxNdyKTG48j9825BaX 71jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=WcqYyGOfjwKQW1yEfAJm7lob0jDkw4Dwr2phsaDTbJQ=; b=VFMeqBgGPuET8sIIySr3UHUo6qEcNEk5JwK5efR4E9lEaopmtg94BaSzzm1nmLz19B WHV5gPTwM0+sczjICncgwDiuH5of0CtOFfKtQvcQmyNyajIo7+l6mbNtbEJVyw4QTUTD /TP15+x0m1BFNGYh1/5dsSkvVipLYiFgbBKpc1pwTI0IaMbpna+xXy6y2ViEU9HtIerk PlaDxjXCjVli/SgEdK4nXJCPP1NHMi+zzZzl20YjymDA+vZRLgDwyE9Vl9OGfYsYiWAX 0Zy0AGsZYB9JGhfcD0Jpnnogk0psHiQYpmp+NCtuaTIIy5IylBIqhXXQQrtb8y6VZM6z HdQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n200si14496159qke.286.2019.11.05.10.18.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:18:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Pc-000656-Cu for patch@linaro.org; Tue, 05 Nov 2019 13:18:40 -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+patch=linaro.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(-) -- 2.21.0 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: 178536 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1116534ilf; Tue, 5 Nov 2019 10:16:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyZtUMWcChVvjFCxgIHWL4rGuitWFjMXf8TelP5eA8HkLxwGhYjhQRSRKnAEHiKVZGBDYpi X-Received: by 2002:a05:620a:744:: with SMTP id i4mr9267434qki.52.1572977782873; Tue, 05 Nov 2019 10:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977782; cv=none; d=google.com; s=arc-20160816; b=NSaSFioENzBxMFjec9kIykva4cW/wRG89fkDiFMd/hawgCjeHP7zzSiFu8CL9SZCIE CnhVO8YuYQ3uERjJwAxnIWiIXsV7xUPTDwJRalpk2gbGn2TbwWZnIBbswIR/WbEroj/W VZpS3Y0ZfdSIfrm/JVdERmUTLpbMf9LXhdeFRB9RzfK6NaHu79aAuvM14ZAHf7Q1q19X uygpQWgYKTz04FwaG2TBnFUV7zz0k8ashaOhWoO59VLo8DCpZaamzpXiRkToackeqEYE hKARqjHN36kPeDTY1SRnxpC/vB/iFqCU8scOBKMqkf+z85W/le/RbIm+SU6ccW3EYe8h zeRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=nEehSVjBFsYQjKGwmrTZkz3d3DIZATSm8kvvHaYX0+4=; b=zZiOynzNnuBf1c7xYKZCfb3XMNIgTNKHDZ/NQwz0opsHXAf36N726BjHutN+kBczrT c/eEFecf7fa9conLtAIyw7k0A96ABaWACuk96eSpRAhSEwa2WgP4z2NgGNJrno6BNNCk mJ9IUnbvd1ujovso257wQzAIumU3caeLTDvhELpF42+G9T5VD9uxj75/cUcb00rzpfgB JNm4YT370j/LHuX9USo+FKuVcEk/s9X0F4fqLpzOYrJJqU1zNziEABGOYRiNpaxYgMzE 9DiC9Z/WETZOu2TQON1EX/Msd2Bgn01TfhB3C7KZthcPXt7DBYb1ngWhbk/TCBcopIEO duLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z20si4808642qkg.6.2019.11.05.10.16.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:16:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3NO-0003z0-5D for patch@linaro.org; Tue, 05 Nov 2019 13:16:22 -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+patch=linaro.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(-) -- 2.21.0 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: 178534 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1114254ilf; Tue, 5 Nov 2019 10:14:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx+llueEkqIuSsWJOhQ9s77Df8CWuwveES5vPCsR3ZAUdWiQ1NTgxkhOa9oTVReKdsRxl1U X-Received: by 2002:ac8:2c99:: with SMTP id 25mr18815815qtw.147.1572977670421; Tue, 05 Nov 2019 10:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977670; cv=none; d=google.com; s=arc-20160816; b=woqPpZIRTXm4QazX97Kg0KrxOCUkI1UN6fGuWaibj/h4ZVfYm8ryZZMDrrJ4wgRgKX BtidepCFeoU57/ru8AkZjSqEeZ6kaWP6G0dI4kMEril0b8UXkAZ1uDLncgpeNu3YqXn1 z+VpDIYsqrz98zyU9HLuhkYijioiRMWYdUiDU87ynyr5Uzq9RPG9jzYaGHNFFqaLuH4y fgxKFQZyTnGzphYEq3YsAAc9Q0HZz+oMZ7kkUzy7mmv4Ah8zDyKOiNTqVs8qmXHS157B MYwDh0ttrmdGh7b/B7zfTJjNAGXqmKBIVzF1IzHyKy/z8VX/dvyUuTZbydVwW0dgEsjy wqsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=q8ax5OAHJUCcqXvgxxwdlXd87XxIzNwdhnysQ3asJd8=; b=wV1JjtTmcVJU2uQX4J0uoDDvN7vWW7g0Z+e6nrfbBdxKMokixjbdyAEw8VtBqSXy+y k3U+r+LOMUF89cjD7DEdNV3uzg6TAFQIeAe38ySBmwiIQdB2WrcW7PjZIxv24Sic1Qkk TDzU+fiQDWr4Z2/273JpugyWotXAR4vNqF4joVk0s/CzLrIfzV90Sq5K2jQ94yQWVdvo hU1HoZYimLPFKZcZmU+gOUiMcDKRufN1xkgAinzTCbfKLA5LEWbHiJiYbz/oqLrAL39M 8l5aBMl9SHOZDVzu1QPvzNaPE7l19ybN6IksON0h7xZNdeYPkziSvkXD/ImdTt4pHTK+ St2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o15si17224658qtl.280.2019.11.05.10.14.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:14:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3LZ-00013F-Ln for patch@linaro.org; Tue, 05 Nov 2019 13:14:29 -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+patch=linaro.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(-) -- 2.21.0 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: 178543 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1121653ilf; Tue, 5 Nov 2019 10:20:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzH/8wBvULWnnzLykPDpYta6HKxs/tZnq+N3V/OLG668Zln6R32gPcnCDbZCn7uvwUl/MEQ X-Received: by 2002:a0c:fe45:: with SMTP id u5mr28581836qvs.17.1572978049350; Tue, 05 Nov 2019 10:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572978049; cv=none; d=google.com; s=arc-20160816; b=XXNC5BLPNt3rS9Gqn0rQ/jOt5+yHPJllapobfCVQx7p4xn/AJl8uBwu0UG9Bjm2tiE 09n7Ob7e5gmV/JnsLYMbWHt2qlNCeT6nKDnxorqZVrn1Zrcjhsve+0+R+WfMzHizelc9 Qs9r2v/98BOZ3a/7bO5ENusjkxvVpmBnAWZ+oFTGlWR9yF9ArG8BpFr22mej/+hWNOWd EwRtULF0xRK+ZjDGj64qIDyhoIZIzY64Jeta39haH2AlJOId8kfDGwuhakZgfGe8vL1m IVdaGqJPU0q/qFmhDg3YKCJqNESQ6ciyFpwd3h+0I4KEwwm1meduLmBJhvV9eRAU8Zaj VRxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=zl+ytEI8x53YwOn/JYDRdEWjpKfWxMFe7TQAwj9AMNE=; b=0QZtlg+uebvTiLxzHaHTPqCsy/tALzDtKRiYOVaSbmbRgyQCfAkUVi5nuw1VXgQ4j1 UGGcktlyIFm692Ifa0j6R9Rtts1O0czuZ5X1rB4LZXkOUk9VQQXsqxbin4O2cbI3bdg5 4xwC9nF2qwjUUIZjKPJk9KByBhG/rggZsl0YfCdzfpRvpODZFwModkxwhtJ3bSfAU4TU rfaLggrUiw6c2kY0g9E5yL/sSG5P9GkLRRNO+CTzAjR8Y66hKBX1J35hhUCZlu5Xs92X XQm+mZgBfzh6qRUr9oyLfW7d7HzD6RxrpqPBVfzXYql3UBrMs91tp7OJEmqnNGTo1gQT 9f6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 14si15908039qva.16.2019.11.05.10.20.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Re-00082c-QJ for patch@linaro.org; Tue, 05 Nov 2019 13:20:46 -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+patch=linaro.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(-) -- 2.21.0 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: 178538 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1119160ilf; Tue, 5 Nov 2019 10:18:41 -0800 (PST) X-Google-Smtp-Source: APXvYqy0cG5WQTxlll1StbQhxhdCdhclZd/74p5JiUQsrGh0mL2smRKML4llk/UhhpMQ997EjtXi X-Received: by 2002:a05:620a:20c5:: with SMTP id f5mr3206104qka.226.1572977921818; Tue, 05 Nov 2019 10:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977921; cv=none; d=google.com; s=arc-20160816; b=pSYsMo5kVOsn7AwwQf+nU8j6+4uhYKqoHpRIzhMorwYwaK9S6IsSez2sLN6g7Mr2Q+ GOdQ0mJ5oWCGlRBiyABRVFJGINA6Cc1PRIX3A9k7JdJwfZ7VfSBe1SbwimK+/Wlt7oWL 3HUC7jJNayasXUc0EN/ZzbPc/C4/bdUiLP8Y4m4ciFxD26BqIiQc7quljdIs5pqPe10E kLuHrbBf0tj0gDtOXU6H27wTsMa8iZP3JhGV8eQ7oA2F7zPe6T3phOcwx5vcjY3DcOCN FZJcJ4hFpepnjeUQzTcroKRCuulTo3EX5J0XUBcIBoLFy4TQNsU6sXc+Qi2VZm5vWeqY Pzrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=TMy7SZ8AgkffKAPdKNcqCWTmQGOBqQuoNgqkSPW5XuI=; b=FLWUPuAjMxIAESBhpQ2zxkxHTO3ShfHkkK3RRjPdpkf8ZK3RkLKmAzaFaZlYKCjY4D vv8twcWaUtlwlJlyOgYp16hZZthk6/9n/EVs+iq4BUtWlukTN1QQt2+2MnN/0/A9IIuS e1RALGWlhdBul47Wg8+kqyEcBA7lDrK8ar9Apo7pvJPeRisQ5kUez5ZF90bvxTQWt9Cc y6uN5Fzlh6YDgbSo78TtnKIfgOXF177h60lOyrt60A/bzktrIaHfcami3L03FYXGNKzJ YyjqYFyWsoRVumU8jGgglqt47RMApM3k6hJzPKrJVzYkDiScTfLuWJZqiKZ0wrGKd5+H z8Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p19si15194568qtn.80.2019.11.05.10.18.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:18:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47203 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Pd-000672-5d for patch@linaro.org; Tue, 05 Nov 2019 13:18:41 -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+patch=linaro.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(-) -- 2.21.0 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: 178533 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1111537ilf; Tue, 5 Nov 2019 10:12:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxZDMb4pnFkYpawawIZedBe7Lezzno00DE1EcYq0SwiO8+CSG4RmukGoHdxS+/dDrOmmr6F X-Received: by 2002:aed:2392:: with SMTP id j18mr19059552qtc.296.1572977530187; Tue, 05 Nov 2019 10:12:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977530; cv=none; d=google.com; s=arc-20160816; b=kUyVPH8dwZ3RPaAH2lK7lN3aXcvKpuyd1XEjCuUBK1rE+B27ZBBtFMP/PDAgRCQXRp vRDpr1W9GdsR6ifphtGoVt2uppteuZ9RwH6WzDfiIvvnNZJSZMkh+ckC0IjItLKvBbee 9lrF6mIdcGuk8gFgwthVQnmLMGn1BbfVYZr1cVds3eJnR+NHMZbKYZEHM2QyKE8X2bwe rc2+t1Ro8SVePbjh0RhCUl5q37dxFle4ZEPMNKxOIUQlfXgQefAPcIQrchUmlk1PHyNg 1v7q3K4uvDAdwYpyB9QC43cDPm59NPwdn6kh+Fsf7cwHBxe0jq6PKLnHy/kmvAZu6L8y cnzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=ohWz1yYrsymqeLR4U5xp79aUBFZZHzqc9dvzrOAnsbo=; b=S4+s7UtAEnaexUGgrwOUFKQGZlcKsgM/d/sDMbIv6WKBEbHYa0SXDg1CGTVgSu1chn txwS96Sff3QdII2UYtyBWP5ALn+qNX7QgKKF5GA8qnFWYo2kBD81cKDQUUuIeFpniESb 3XPSfgNrSoUvgTcIK4fZo/RDKBycwWxn5rEV7o+nZrBIdNQYtCesuZj+8/N9+K+2uZxV q6w2as1VlJpYGXYD/Wm7mufdkD4TTTQN7uDtnoeo8XRbCzkIgb6+ApV0N4oaM3IkK/cW LZJBWsMEww3Xwend1axhkFMSeTiHQEp/LFOhaUfXzq8PWZuTm02X/O5G3oJal35hoK8i xP9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u57si15852005qtj.99.2019.11.05.10.12.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:12:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3JH-00067M-MV for patch@linaro.org; Tue, 05 Nov 2019 13:12:09 -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+patch=linaro.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(-) -- 2.21.0 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: 178545 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1123269ilf; Tue, 5 Nov 2019 10:22:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyAuyVjzi5d1CjaBmF0He8ycfOt/s878LGSzotE1AW5RHlBmLZSd0dTSgCOLqdfuuOst8tj X-Received: by 2002:a05:6214:7b1:: with SMTP id v17mr27462870qvz.111.1572978130644; Tue, 05 Nov 2019 10:22:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572978130; cv=none; d=google.com; s=arc-20160816; b=OigmjJt/fSFjHJlAbiDa/ekjSPemd6owgKdd9vSj6mvz24aLxbAby/Iy8oDxDu5HBE +3uNZ+GUlVJNW4PutXe1XnZd0vclTo9nCq588rRfkhEP3C6sCx3Lu7Q+YRRR4Gl3oDk/ YLc2QR6tcpE9/gLrJFaX6GAFjkmgMw5Gvud/UOZomQvW8vSj5vliZyrzohZmMQpyEHku raJFyEjOWEwbxb5DwNt+gNVJsM1dSGnKxSuknxUU9QWTNr4fphDgoLigU+g1jEEsnGI3 LpGc+KAjcXW1N959oxzszI35K66G8MFpFFk6dfucoOrNZkhDPr6Ie82LJQHrpzcJyMet FMdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=V8ksO5EgSH+HoUqWVN3ddO5gkymU9XNZsciIpVHkWLE=; b=II7fGpfvVYkAso+wPj4hynkuJqZaWJnX56D/iBG/KdMroigxYbnKQFMXQLUKm0qKuK UmITFpT/cxmyAhYUWYeOLFamkoIVWXfuMUMEcqwbe0zRWy3QR+VQx51kLl9UyK4Dzbeh KOSJGmd25XNWx0wltqmb92m302hLphDO3KYhYnQy3AT2VH6pdOIbteGNtbx6bBGX1yaP /OSLpsjY2SAaYN9MzFgvz/p5p+ZbjGixQ1wOdMYSMTbjzywUCI1J3iGnNM7weBD23ll4 oj+GKMrRceAJpiibgyh/d7qjuNDoMEadiVOh1nyeTzBUd0OeS4OdpxnaSjXdWxk5VKbF BdmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u5si14758727qvi.113.2019.11.05.10.22.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:22:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Sz-0001N8-RK for patch@linaro.org; Tue, 05 Nov 2019 13:22:09 -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+patch=linaro.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(+) -- 2.21.0 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: 178544 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1121652ilf; Tue, 5 Nov 2019 10:20:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzCv7POPOeZEVvOYutz0tcpau7aKFuhT24ZB5ssnqt0edQ5UnGokYhCyucUviF1bBi6KAFD X-Received: by 2002:a0c:9a03:: with SMTP id p3mr66211qvd.9.1572978049354; Tue, 05 Nov 2019 10:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572978049; cv=none; d=google.com; s=arc-20160816; b=E6PlLVfmPBqxvEGgi6deINpclV2bKDU0oUzVrJSfVKBCj4Rw0iej+aYda/M0O7Ss/b /aPTD7RiZN/rro1/w+E+GJXLzBfFxRTrcDV3FEWrruqoaDmyUWsO62hZv/LkmpMIkO7K vjao6Bc4uQ1TBEiwkWnLSgrF41AaRjkxoU0jpMXSj4BnTfdVoLO5l3tx5EkFqwyvYOaN DaOsLU/dBGC7lhrXYEyBtzoElfoxMo7JQMbCDIYMb0PYUdeFw6/yJpMLwtkxT0f+/JLt M4IY530Ijo4pRD/26goG64PkcyQ5ItVuUnhpjHd6CE3glWXq3dDiO61Q0vmhdtx+7BQ9 cksQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=/ga0EM0aRJkqi7WEwqAyteBVKV27r7OZFSY27JmrG2s=; b=0lWMAd8El186fSIRAs8k0ORzjTTvgXPFJQmNzY7k8RACW+zQ9abe5GElAE+lQnUPKo rWJvty3/cNs2cAZ42byReN1x5Nf8jLe4C9Y04w/DtjOZjrOHMQ/KRECof8FCDFrAmCpn vP4zTfUUfAIJuw1igYA8Fv7smqjqX93pY4rXtAsXdFmPTaOdtHJW5YgDKVCWGbpRID9/ AMt2GBMHS9BaEQYDGOLD9tFr8X2Pbi+5RZ0xQH36DRRBgoTeQbvw8Wu3p/DQpgwVUfJ0 dQgJ8L0yevibZXL2tttKcfHo3g+BXgU8/Lm6DdZPoP8gqEUFdppNXTSSrFvhMwUX5Tfv pjxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v16si12939389qtj.133.2019.11.05.10.20.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3Rg-00084q-6y for patch@linaro.org; Tue, 05 Nov 2019 13:20:48 -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+patch=linaro.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(-) -- 2.21.0 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: 178532 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1111334ilf; Tue, 5 Nov 2019 10:12:01 -0800 (PST) X-Google-Smtp-Source: APXvYqw0vBwZzTL/zVyXonQn6CYj8Cc1+6J+lnIVHfmZw2AXJDXtFnyPBxpq+OBOyJFXjtPSPJ7q X-Received: by 2002:ae9:f217:: with SMTP id m23mr7902920qkg.151.1572977521571; Tue, 05 Nov 2019 10:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977521; cv=none; d=google.com; s=arc-20160816; b=p9OHyfClZNiJIer6jKNmKH3daCTSf7dzoWEfqcqVOmcuG0jXgSQaYb2jVsVKTjbEyX 8X82Ugh8uegYHA89U4SLjH8ViZERrhW/TMNzeQp9oK24IBsFbmRaGtak6y6mZ5iwVW0E PCzToZSgJbybJgsOypScfSc0v8AiHJl/IgxlwaBsdydU6qSj5UpEusmQoe2f7IlQdPH9 BAazmQYWv9u0t1Ncdvwx0bCAvcE5rlaFTMMfpZjr1iAytSI8CAYSNSzrPhksPzS8rxya c5NRSdV1PdX+2w+t3U7TuBIb6SLiUuVACaACVC5kzPzqZCdIxHm3bsAynbTv/6tEXz8r t17g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=HIxiS5Yxm/FZvMW52N+PEBkTFxl2eURIf+KKsHQ5PmM=; b=JnPOZCO6gXlYPXnSGx3LYfhhfaz+93zmOdMU89qyGSvLmQoIqjE/Hi4SPOShlhh0ae 0HsraJijslJpxc8LK1ctQ+OOZQWuFq6ySPisY+WzWruVenwib7KNeQp0Ky5IPJn6PazM 7RVjpwyRWOz0uyFqCX43PPRIHCWqCKBYf8fNffZ2II/2omAK6dTs2oRl/hUrwCAJFGHN Ojnf0uSah2ATSxDjRYEfC0keRPDw9PsD/huCRQXu8uOawoAgfdpYDyc+sI6h+Zn+mqqe 85KihzfGkVq/ERRf3w/EELUb4PYNZYnB5sl0VMk48NKtbNvvx84t81E6Jo9RK6CdA78V 9U5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z14si5287608qtj.386.2019.11.05.10.12.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 10:12:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3JA-0005xN-MV for patch@linaro.org; Tue, 05 Nov 2019 13:12:00 -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+patch=linaro.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(+) -- 2.21.0 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)