From patchwork Wed May 25 10:31:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9135097 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 25EBA607D7 for ; Wed, 25 May 2016 10:36:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C7AC282BE for ; Wed, 25 May 2016 10:36:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1161F282D8; Wed, 25 May 2016 10:36:31 +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 81308282BE for ; Wed, 25 May 2016 10:36:29 +0000 (UTC) Received: from localhost ([::1]:58819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5WAt-0004VO-Ol for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 May 2016 06:36:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5W71-00014n-6s for qemu-devel@nongnu.org; Wed, 25 May 2016 06:32:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5W6t-00036S-LR for qemu-devel@nongnu.org; Wed, 25 May 2016 06:32:26 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:32944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5W6s-00035z-Rk for qemu-devel@nongnu.org; Wed, 25 May 2016 06:32:19 -0400 Received: by mail-lf0-x233.google.com with SMTP id e131so16309654lfb.0 for ; Wed, 25 May 2016 03:32:18 -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=/dFDDvznkWzvBBzS5FGy+2CizmxF+4DETda/Iajy7Mg=; b=eypdmKOFvz8K7oM1pLSVagxDrsTREw0sV55Vp7C8i7DqPNMSiHlgEacVkV7QEMLExo mvq2A8TzN76uCrXT9nGybxmOzoInEA0pEa/gK1+zudczwJuzLx5UuvGsZCrkYOUaOKu7 F+an7iltfytphgNpnusAaEkZ4gqvFQiWfTToU= 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=/dFDDvznkWzvBBzS5FGy+2CizmxF+4DETda/Iajy7Mg=; b=aQs2CqQm69Jm/LrTojlbYW5qiug/u9QUxvP5lfMRZrSK5I7V6QHHNFRoohXHmLsbBu z3Kxz6ztm0v7NUxYouN2BWBItaFaFcw8bgSUJoMTzWquuUYKJ+mM3NJUPG/Nn6oDCTAc dxRJLYh2aNu4P70hp+lnEEWGYsFw5W8arCkRqvRhMu56m1cH+B6SPoOgJoe6izWhyt5Q S4iLXnM1upHHGVjFrF75mkBA0ss+28x8g02lIu8s8oQeFxFGSKT1THiWlnsjGUh+cCzo 4kp4/PnjLDfYoFFCItyM7k/fLDjglmKSR6Cr1xl3wjOOww0/pLYVn1E6TejplOrdIRaY kDbQ== X-Gm-Message-State: ALyK8tLxPMcl3ggvmXavbpJWxNHBeGUxiu1LqmMvMJmAKMM6qLAw26sKV44lRBd8OYd+/Y9U X-Received: by 10.25.125.194 with SMTP id y185mr592080lfc.75.1464172338048; Wed, 25 May 2016 03:32:18 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id o75sm1379610lfi.9.2016.05.25.03.32.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 May 2016 03:32:17 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 25 May 2016 13:31:45 +0300 Message-Id: <7ffc4258144ce88b139c09d40e2305792fa8bcd1.1464153942.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:c07::233 Subject: [Qemu-devel] [PULL 13/38] linux-user: Support for restarting system calls for UniCore32 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 UniCore32 main loop 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 (We don't support signals on this target so there is no sigreturn code to update.) Signed-off-by: Timothy Edward Baldwin Message-id: 1441497448-32489-30-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell [PMM: tweak commit message; drop TARGET_USE_ERESTARTSYS define] Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index eeea8f5..2d7e700 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1171,7 +1171,7 @@ void cpu_loop(CPUUniCore32State *env) cpu_set_tls(env, env->regs[0]); env->regs[0] = 0; } else { - env->regs[0] = do_syscall(env, + abi_long ret = do_syscall(env, n, env->regs[0], env->regs[1], @@ -1180,6 +1180,11 @@ void cpu_loop(CPUUniCore32State *env) env->regs[4], env->regs[5], 0, 0); + if (ret == -TARGET_ERESTARTSYS) { + env->regs[31] -= 4; + } else if (ret != -TARGET_QEMU_ESIGRETURN) { + env->regs[0] = ret; + } } } else { goto error;