From patchwork Fri May 27 13:00:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9138349 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 D4BB260467 for ; Fri, 27 May 2016 13:23:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6E8626FC9 for ; Fri, 27 May 2016 13:23:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBD4B27E3D; Fri, 27 May 2016 13:23:05 +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 5063526FC9 for ; Fri, 27 May 2016 13:23:05 +0000 (UTC) Received: from localhost ([::1]:45797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HjE-0003Gu-Cb for patchwork-qemu-devel@patchwork.kernel.org; Fri, 27 May 2016 09:23:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNq-0007WK-OV for qemu-devel@nongnu.org; Fri, 27 May 2016 09:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6HNm-0001Cl-MH for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:58 -0400 Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:36530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNm-0001CW-EW for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:54 -0400 Received: by mail-lb0-x229.google.com with SMTP id h1so31608045lbj.3 for ; Fri, 27 May 2016 06:00:54 -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=TheANDtthSBfQjvSTAlf7JD6bhJdqq3OTSbloTV+ftw=; b=Z+8VeQBclZZKT+1gmytmZ3r5amGCmwPNMjRV0/AAjCPRlpBAw4r1qJuXVqxlAiP1f/ pEiOQBsPkgKUSA9wLAtabTsMq5LGsRT2hDajklU02Dkqh+hkN51+qlelhCKRcGlWUSJ6 LFRPvrooC30WTVQ5PqxV0vqRxIx0DiYVBzSmo= 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=TheANDtthSBfQjvSTAlf7JD6bhJdqq3OTSbloTV+ftw=; b=BQ3Hn01/uhXsaqrnGWygopM49RqxuTjaJIppjQe3yTIhvfYo00uxBbRB2SaGf/INC+ j5pz2lEM9ZdpiQcvU6raZABEsFyujkLOL/o4kaY2fbc4NY/irgFgvYQ1mYq2ck+4TiiM TTX+AcsdxMtm664RU39vLByl3W8ewmNezSsipJlVItyjxSP6avNsj4gRBTD3yR3f8dFW 8yk4g1mjdCPxECrOf107l+jPrkOuYKM+OA1CDkWPLpwgmxlUHSjHqD8EzBfG1pttwaig PoH1xaFQ/BwvJ3a1AEHcNg2ZiN83M5cazNghD+TXm8ifL01mSYJsrriEvGP2X8+ZMRFm ygNg== X-Gm-Message-State: ALyK8tLD3rPqS2mI5nlr9avlxgJYVPjCf5kbHzW9OlxsiYmson89FnV6COwinbiSY6TWsQiN X-Received: by 10.112.25.106 with SMTP id b10mr4327769lbg.5.1464354053541; Fri, 27 May 2016 06:00:53 -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.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 06:00:52 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 27 May 2016 16:00:08 +0300 Message-Id: <6205086558955402983f1c2ff9e4c3ebe9f1c678.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::229 Subject: [Qemu-devel] [PULL v2 17/38] linux-user: Support for restarting system calls for CRIS 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 CRIS main loop and sigreturn code: * on TARGET_ERESTARTSYS, wind guest PC backwards to repeat syscall insn * set all guest CPU state within signal.c code on sigreturn * 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-34-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell Reviewed-by: Edgar E. Iglesias [PMM: tweak commit message; drop TARGET_USE_ERESTARTSYS define] Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/cris/target_signal.h | 1 + linux-user/main.c | 6 +++++- linux-user/signal.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/linux-user/cris/target_signal.h b/linux-user/cris/target_signal.h index 5611840..e0f1382 100644 --- a/linux-user/cris/target_signal.h +++ b/linux-user/cris/target_signal.h @@ -26,4 +26,5 @@ static inline abi_ulong get_sp_from_cpustate(CPUCRISState *state) return state->regs[14]; } + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/main.c b/linux-user/main.c index c16d7ed..a532221 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -2914,7 +2914,11 @@ void cpu_loop(CPUCRISState *env) env->pregs[7], env->pregs[11], 0, 0); - env->regs[10] = ret; + if (ret == -TARGET_ERESTARTSYS) { + env->pc -= 2; + } else if (ret != -TARGET_QEMU_ESIGRETURN) { + env->regs[10] = ret; + } break; case EXCP_DEBUG: { diff --git a/linux-user/signal.c b/linux-user/signal.c index 51e11c1..71a8e2a 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -3785,7 +3785,7 @@ long do_sigreturn(CPUCRISState *env) restore_sigcontext(&frame->sc, env); unlock_user_struct(frame, frame_addr, 0); - return env->regs[10]; + return -TARGET_QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); }