From patchwork Fri May 27 13:00:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9138323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27A846075C for ; Fri, 27 May 2016 13:10:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1718025D91 for ; Fri, 27 May 2016 13:10:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B343281A6; Fri, 27 May 2016 13:10:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 858E325D91 for ; Fri, 27 May 2016 13:10:08 +0000 (UTC) Received: from localhost ([::1]:45731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HWh-0007gl-Bc for patchwork-qemu-devel@patchwork.kernel.org; Fri, 27 May 2016 09:10:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNm-0007Pe-Rm for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6HNg-0001B4-Oj for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:53 -0400 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]:36520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNg-0001Ap-GJ for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:48 -0400 Received: by mail-lb0-x234.google.com with SMTP id h1so31607419lbj.3 for ; Fri, 27 May 2016 06:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wg3w9xS4/07dXLkcBktrD8NSEjR/ktZxBj9izZ9VFnw=; b=IGDdob8s5CDWhVlzUf0uOQYCnyUzqirrlsNfQB4kWveUcZRo7irM1Em65oWhBtP6Z9 +bluqoGwMLpb1pp38zz2c2cNy3ESW8aj61iNQnyli/yyznoQLWk23LQvexaqmviJMWOH RY2YMmGygMfBkkWr65dNRQE0PCChEcoFOUo8k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wg3w9xS4/07dXLkcBktrD8NSEjR/ktZxBj9izZ9VFnw=; b=jtwLFFnnq6W6Mo9ybbhzWzEOU1e22a1VAloP9yR1opuaIyBivo5GsSlqkFJLN3myQc lEZ3743XnKhtdM6m7TlDoV0+yMxHnz/NoGIUyLNWaaw1MnPqBPCLuHwAtBEnBakios2/ jt9s13dc9Kkotd8eeSuMUH5AEjNwdnCg1SV3dadDgfbZ0u5k5v2k/RZXDp8uQDf235U2 M+5iIfuiWhuMu06yztt5uzJ/+MjjKDnBMM0LM99fgz6wAkWd5N2A82fVYQdw+BBTbVms 2tEAEb/aIqyuu5AS/g28fGlnvVI0N9D9cnBCikNcBrgQM84UNlmeUELMAyxTlb/iuZNa VWkQ== X-Gm-Message-State: ALyK8tJxsD6HeFEZQ9MKM6QDpqU5Kj1Wd5qTi8z4B67OEsBbCg78Y3RT4BJR6XdCFmDUZj9F X-Received: by 10.112.9.200 with SMTP id c8mr4283188lbb.50.1464354047576; Fri, 27 May 2016 06:00:47 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id n16sm2281066lfg.31.2016.05.27.06.00.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 06:00:46 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 27 May 2016 16:00:03 +0300 Message-Id: <338c858c946017cd3ec8c2be06d817e001d94bc3.1464353863.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::234 Subject: [Qemu-devel] [PULL v2 12/38] linux-user: Support for restarting system calls for Alpha targets 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: Timothy E Baldwin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Timothy E Baldwin Update the Alpha main loop and sigreturn code: * on TARGET_ERESTARTSYS, wind guest PC backwards to repeat syscall insn * handle TARGET_QEMU_ESIGRETURN in the main loop as the indication that the main loop should not touch any guest CPU state Signed-off-by: Timothy Edward Baldwin Message-id: 1441497448-32489-13-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell [PMM: tweak commit message; drop TARGET_USE_ERESTARTSYS define; PC is env->pc, not env->ir[IR_PV]] Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/alpha/target_signal.h | 1 + linux-user/main.c | 7 +++++-- linux-user/signal.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index d3822da..4c78319 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -27,6 +27,7 @@ static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state) return state->ir[IR_SP]; } + /* From . */ #define TARGET_GEN_INTOVF -1 /* integer overflow */ #define TARGET_GEN_INTDIV -2 /* integer division by zero */ diff --git a/linux-user/main.c b/linux-user/main.c index 75552a0..cc7f2aa 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3267,8 +3267,11 @@ void cpu_loop(CPUAlphaState *env) env->ir[IR_A2], env->ir[IR_A3], env->ir[IR_A4], env->ir[IR_A5], 0, 0); - if (trapnr == TARGET_NR_sigreturn - || trapnr == TARGET_NR_rt_sigreturn) { + if (sysret == -TARGET_ERESTARTSYS) { + env->pc -= 4; + break; + } + if (sysret == -TARGET_QEMU_ESIGRETURN) { break; } /* Syscall writes 0 to V0 to bypass error check, similar diff --git a/linux-user/signal.c b/linux-user/signal.c index 8b5ddf2..559e764 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5527,7 +5527,7 @@ long do_sigreturn(CPUAlphaState *env) restore_sigcontext(env, sc); unlock_user_struct(sc, sc_addr, 0); - return env->ir[IR_V0]; + return -TARGET_QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); @@ -5554,7 +5554,7 @@ long do_rt_sigreturn(CPUAlphaState *env) } unlock_user_struct(frame, frame_addr, 0); - return env->ir[IR_V0]; + return -TARGET_QEMU_ESIGRETURN; badframe: