From patchwork Mon Mar 10 12:22:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 25957 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 56C86206A6 for ; Mon, 10 Mar 2014 12:24:15 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id r5sf17328619qcx.9 for ; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=flMUS2fszWFT6DanmCn2VgVIvAyclfspKv2R/WnFYtY=; b=YSkHIOyx/EvNla0TUO1fnMNbDh5SaacDTrRJsOleja7wURHBUnnhPelKlcxjEt0zbC Eqf5zlkIVm1Opf9g2GpImh2DshBnFdqWh4OF6h/mvFvImAbe/H+uK8uuGmNdxH1C6tTn URbIATCK7dLrgm1MoiVADXetmndl9fZegAk2ukluOYv+Cclfw994ys7H/P08X/T7GK/L yvHDv/vG/BJT6Odo77U7pgzX+ciRcj4nEI/Lgb/VjVVFkPWVDyiupDYFG0WZBs9g0F2G 2JgtsKTB0/WQHfz6V0UmOFBpB5vD2XFUxf1aJwbQuZHTvqtbGW4nceUA+xbNAWaw5jrp p4xA== X-Gm-Message-State: ALoCoQlzcVuPNS2nfDl10eGdJ+9iPMMqSCLKvX1WMsFW7/cQSiLCnpVpIwdASmMb0VF/6UAam7hA X-Received: by 10.58.111.202 with SMTP id ik10mr11487895veb.4.1394454255114; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.175 with SMTP id 44ls2090994qgp.12.gmail; Mon, 10 Mar 2014 05:24:15 -0700 (PDT) X-Received: by 10.220.133.80 with SMTP id e16mr22435509vct.13.1394454254991; Mon, 10 Mar 2014 05:24:14 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id f7si4619426vcz.132.2014.03.10.05.24.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Mar 2014 05:24:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so7025514veb.32 for ; Mon, 10 Mar 2014 05:24:14 -0700 (PDT) X-Received: by 10.220.12.140 with SMTP id x12mr22098473vcx.19.1394454254896; Mon, 10 Mar 2014 05:24:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp114650vck; Mon, 10 Mar 2014 05:24:14 -0700 (PDT) X-Received: by 10.140.29.38 with SMTP id a35mr38625012qga.55.1394454253613; Mon, 10 Mar 2014 05:24:13 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s10si8685750qas.19.2014.03.10.05.24.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Mar 2014 05:24:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:48394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzFc-0003xE-2o for patch@linaro.org; Mon, 10 Mar 2014 08:24:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzEc-0002oo-Bk for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:23:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMzEU-000846-Vj for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:23:10 -0400 Received: from afflict.kos.to ([92.243.29.197]:50037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzEU-00083i-Og for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:23:02 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id A78BA26562; Mon, 10 Mar 2014 13:23:01 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 10 Mar 2014 14:22:54 +0200 Message-Id: <8a3ae9109eb45dd77b182a4953ef9e636f665296.1394453724.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Michael Matz Subject: [Qemu-devel] [PATCH 2/8] linux-user: AArch64: Implement SA_RESTORER for signal handlers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Michael Matz Implement support for signal handlers with the SA_RESTORER flag set. Signed-off-by: Michael Matz [PMM: minor tweaks to make patch apply to current master] Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio Reviewed-by: Richard Henderson --- linux-user/signal.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 29734b2..c8a1da0 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -1273,7 +1273,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, CPUARMState *env) { struct target_rt_sigframe *frame; - abi_ulong frame_addr; + abi_ulong frame_addr, return_addr; frame_addr = get_sigframe(ka, env); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { @@ -1290,15 +1290,19 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); target_setup_sigframe(frame, env, set); - /* mov x8,#__NR_rt_sigreturn; svc #0 */ - __put_user(0xd2801168, &frame->tramp[0]); - __put_user(0xd4000001, &frame->tramp[1]); + if (ka->sa_flags & TARGET_SA_RESTORER) { + return_addr = ka->sa_restorer; + } else { + /* mov x8,#__NR_rt_sigreturn; svc #0 */ + __put_user(0xd2801168, &frame->tramp[0]); + __put_user(0xd4000001, &frame->tramp[1]); + return_addr = frame_addr + offsetof(struct target_rt_sigframe, tramp); + } env->xregs[0] = usig; env->xregs[31] = frame_addr; env->xregs[29] = env->xregs[31] + offsetof(struct target_rt_sigframe, fp); env->pc = ka->_sa_handler; - env->xregs[30] = env->xregs[31] + - offsetof(struct target_rt_sigframe, tramp); + env->xregs[30] = return_addr; if (info) { if (copy_siginfo_to_user(&frame->info, info)) { goto give_sigsegv;