From patchwork Tue Apr 3 10:35:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 894503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fltn42tVz9s0n for ; Tue, 3 Apr 2018 20:38:41 +1000 (AEST) Received: from localhost ([::1]:51294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3JKp-00019R-IM for incoming@patchwork.ozlabs.org; Tue, 03 Apr 2018 06:38:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3JJr-0000oy-1Z for qemu-devel@nongnu.org; Tue, 03 Apr 2018 06:37:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3JJo-00043P-2c for qemu-devel@nongnu.org; Tue, 03 Apr 2018 06:37:39 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:46193) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f3JJn-00042H-QE for qemu-devel@nongnu.org; Tue, 03 Apr 2018 06:37:36 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LdQdm-1ecXKw2S14-00imOH; Tue, 03 Apr 2018 12:37:24 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 3 Apr 2018 12:35:38 +0200 Message-Id: <20180403103540.7303-2-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403103540.7303-1-laurent@vivier.eu> References: <20180403103540.7303-1-laurent@vivier.eu> X-Provags-ID: V03:K0:eD6JMdZGYkE7kqEQcGEDw5dingdeJh4RbqF14NHXyoORpfxDodO Kri87dmknej+dJAw4e6TMhjxBfWBp9+myM+LBKrcmNeTOfkJNH2XrzOB8NxyR0cuTFw0qC3 X904RheEICcHITq2SJpjgwuf9ZpfBB1i/4B4jSL+JDZAVNEAhTJrQDlafX5wvCVwES8G9p2 6ZPtctVpVhxuwaZWZfEAw== X-UI-Out-Filterresults: notjunk:1; V01:K0:r1NLoVsOBUo=:foWCcKh9NAj98ne0SqaMeR X4U1skCA6efqILKBBjlAuQsBh8vImtKYnxXTMGytGkaYR9sFskAHKvmQ/PiLIyt02D1jAT6sJ UctUf/y0ppY2UlzlhJl4D6IZ+UafS07d6Rjg4WZAE473j4886CQ1BbXkG/S2/zyDQ4HFo1Nnd ANrA4ICyOx7wYwFXAioP9plQ0tFMc1iz4tTOlrLBFR0h4NbyXkKI4M4ll/coTr+uTKEjg6zmf wufyQoOxpCBxBhIW1UORmSMUugvLuQD1LcefK1VYVUmwlRRE/m9hglqaBcG74L/H3aO/3I1c9 x5GtuRoj6/wT4fjUJMwcZcz9z+tLFLX6Ho6zh7c/6dGSMdxC1XuCIrdFDUzeGIfcjXDYjP+N2 2YRBHWobJnEd3q1bRysXzMHvON7HMKzOqxJkXmVrRtRQSSVNR5oYPYXxHF1xQEg9vRzrcD8nJ WWAwWpgvNNmlE9VQONibjKHtVMkVDMl2Qc+76LiNESpsTJKkf1oeJmOfQtJFFG+Ur1se3nzKn qGGZYRDxIHVUMMTU+5bxW9ct6OgRXMB/fOTlkKQYH3FoWzrGncA+UCbaqsmycgR09Ak79acib +rwVxQI8CMKQ+FmUAmfHo2dicH4j4Qw7PVtLQ3ZjLybi0QxMuMALDYptUmkPtTLJt8F8bahAJ Smy9kM2B60bU48fcs8cWgbXcf28f4xnEPYCm5qtfbdUlnmgomnp9oLrUKb77fLcGJZZyf8aHV lmAI/CPZ/7QUhTA6t+Nr9e/oULTQYl8VUHtsog== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [PULL 1/3] linux-user: fix alpha signal emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" setup_frame() doesn't set correctly the address of the trampoline code. The offset of retcode array must be added to the stack frame address. Signed-off-by: Laurent Vivier Message-Id: <20180401204653.14211-1-laurent@vivier.eu> --- linux-user/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 2ea3e0321f..9399f0ec47 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -6367,7 +6367,7 @@ static void setup_frame(int sig, struct target_sigaction *ka, &frame->retcode[1]); __put_user(INSN_CALLSYS, &frame->retcode[2]); /* imb() */ - r26 = frame_addr; + r26 = frame_addr + offsetof(struct target_sigframe, retcode); } unlock_user_struct(frame, frame_addr, 1); @@ -6424,7 +6424,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, &frame->retcode[1]); __put_user(INSN_CALLSYS, &frame->retcode[2]); /* imb(); */ - r26 = frame_addr; + r26 = frame_addr + offsetof(struct target_sigframe, retcode); } if (err) { From patchwork Tue Apr 3 10:35:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 894504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Flx60KYvz9s3p for ; Tue, 3 Apr 2018 20:40:40 +1000 (AEST) Received: from localhost ([::1]:51345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3JMj-0002vO-Ub for incoming@patchwork.ozlabs.org; Tue, 03 Apr 2018 06:40:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3JJq-0000on-QZ for qemu-devel@nongnu.org; Tue, 03 Apr 2018 06:37:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3JJn-00042m-NG for qemu-devel@nongnu.org; Tue, 03 Apr 2018 06:37:38 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:53915) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f3JJn-00041V-CN for qemu-devel@nongnu.org; Tue, 03 Apr 2018 06:37:35 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LhXNZ-1ehBuG05RJ-00mt86; Tue, 03 Apr 2018 12:37:25 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 3 Apr 2018 12:35:39 +0200 Message-Id: <20180403103540.7303-3-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403103540.7303-1-laurent@vivier.eu> References: <20180403103540.7303-1-laurent@vivier.eu> X-Provags-ID: V03:K0:dL0zXMgkzMLTv23XUxqoE6CDYvTUl+BKKnhEibArGBi0TtA/EE5 gGm2+hjOcPRPTPs0c+X3AIlpLohcwaZHfVOCTA7DD/6vBFyLcFfsHsSpu8m7Usg/zN7D/ck vP1oB8gMpfydg+CjmBTmCyYAoS7uk5vLZ2GJIMLvmh3wICEmT0TTH9FV7Az1Luk4ldnloxV qzSMK1vZgN04R4NCfQrsg== X-UI-Out-Filterresults: notjunk:1; V01:K0:7MyPtoaXv7s=:Ns3nEG3TcnUjh63J+KDd2e usZnSiooOuFul0dLsTBR9bvDV1pbk04ef4216PT6ks66oAtGo454lze0Ycx/WBpwwihdbxXrb pf+pZxYfRoMRh1LoFM8dQY7HuazgdUEgAGb8430MidxM38yuZ3XGrxh0NxUvHqz7zemhE2r3O +PaG0GWSfmVxBEYKIxzqL98cONBrvTUd/JjbhIqNd3Eo3neD1DkTn6nX0dd4ly4ARGvHrSywv tSjWJrw61d2wxpKZqbWV4q8l+jEukswA9KlbFy1/XThdhnvthE/LyBg+6prBaeoz48e65JoDO hdh0uzfTGrwbyNL4PdEvzU8dOreES8Ws0m6Hyx+rud8IZ+dpQK6gFhvGjO569yLbV8uhx7Mh/ U4mGl5MX/ooCFtm9gdzWNGTa94DsbXF5LoRcQiXi3GkwfKLnWNh6XHoX2IOIvHiK8kYvxMPOM xSscGKvkPpxOpTNDFtFmnsudXQZ8Ttine9ofo5B5oPXOSu9jjnyMv5CXhSrS6tqp9om5Qcgb2 BgqKA5peRjaHBtp9g69n5sELYRIQJVjKm9j6ULh4cprWzZ2cWBhQ7W9M3H7vlG6BC5n9aHxuW aATbqYufdhFGzRTLhg+2TSK2iEYXd9anvPDuuV/SIZ+oycQh9Ph9pKiIuUOqEGCVS2b5MNAmi gmNyJDdwzLlu/62DN/1B/NhbZhlg/4ZVukN696PIXXY+PYiG8sgg26QOz7ewMzENJ6EVfKdyx ByUTuJaqSoWajtaneSSz+NXyUa1mi8IqmOxlhg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PULL 2/3] linux-user: define TARGET_ARCH_HAS_KA_RESTORER X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Sparc as an extended sigaction structure containing the field ka_restorer used in place of sa_restorer. Define TARGET_ARCH_HAS_KA_RESTORER and use it with sparc. Signed-off-by: Laurent Vivier Message-Id: <20180402102453.9883-2-laurent@vivier.eu> --- linux-user/signal.c | 4 ++-- linux-user/syscall.c | 7 +++++-- linux-user/syscall_defs.h | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 9399f0ec47..5febe6aedf 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2920,8 +2920,8 @@ static void setup_frame(int sig, struct target_sigaction *ka, env->pc = ka->_sa_handler; env->npc = (env->pc + 4); /* 5. return to kernel instructions */ - if (ka->sa_restorer) { - env->regwptr[UREG_I7] = ka->sa_restorer; + if (ka->ka_restorer) { + env->regwptr[UREG_I7] = ka->ka_restorer; } else { uint32_t val32; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 889abbda1e..b8353d8f13 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8699,6 +8699,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags = old_act->sa_flags; act.sa_restorer = old_act->sa_restorer; +#ifdef TARGET_ARCH_HAS_KA_RESTORER + act.ka_restorer = 0; +#endif unlock_user_struct(old_act, arg2, 0); pact = &act; } else { @@ -8773,8 +8776,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { goto efault; } -#ifdef TARGET_SPARC - act->sa_restorer = restorer; +#ifdef TARGET_ARCH_HAS_KA_RESTORER + act->ka_restorer = restorer; #endif } else { act = NULL; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 13fe840239..7473be518b 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -435,6 +435,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, #define TARGET_SA_NODEFER 0x20u #define TARGET_SA_RESETHAND 4u #define TARGET_ARCH_HAS_SA_RESTORER 1 +#define TARGET_ARCH_HAS_KA_RESTORER 1 #elif defined(TARGET_MIPS) #define TARGET_SA_NOCLDSTOP 0x00000001 #define TARGET_SA_NOCLDWAIT 0x00010000 @@ -742,6 +743,9 @@ struct target_sigaction { abi_ulong sa_restorer; #endif target_sigset_t sa_mask; +#ifdef TARGET_ARCH_HAS_KA_RESTORER + abi_ulong ka_restorer; +#endif }; #endif