From patchwork Fri May 27 13:00:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 627134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3rGRRk4Yqcz9sDD for ; Fri, 27 May 2016 23:18:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=G5Ne/2Ao; dkim-atps=neutral Received: from localhost ([::1]:45778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HfE-0008JP-Ex for incoming@patchwork.ozlabs.org; Fri, 27 May 2016 09:18:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNn-0007QI-HF for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6HNi-0001BX-2T for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:54 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:33290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNh-0001BA-Ll for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:50 -0400 Received: by mail-lf0-x22a.google.com with SMTP id s64so21620101lfe.0 for ; Fri, 27 May 2016 06:00:49 -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=YwNcgL4Ki8McgXzhxw578s34qO2mfPOO9vTcWQWl3Ok=; b=G5Ne/2AoK2zRHTF9K6a8naUYmjsOxBqxTDmUaVPYsIPDqcUbpra/UElf+ACHY+V+kT 0zTGe9JFYxE332p9GjlbP2Zz9OpNAugU8aDk5A75/PlHjN7AxKFR+7I0M7JJcg6Xft7W 90J/3gKwXdIbtrP0eYhlayRCU2uCITUu4ohXc= 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=YwNcgL4Ki8McgXzhxw578s34qO2mfPOO9vTcWQWl3Ok=; b=HFMveVpcv6IAESEjOva+vEwj+C3D3AOeoF+3YLJoKW9Y1OOJPW0nDdZZD05G9AM1ls ZrbD97whhoMpt0y8eZ3MzUNxncVsga3yfaG3UNfrS6YguCfIolA1v/Z9OBU3S4ojG2G6 S36V6nosTv9VFvbjtkuBp+YxU/kGwC4ODFPwBZ6b+BdAm4tK8KC1I6Ov0b7HS3YfVnj9 5GzOVyojtt9sTJ9J5Q12iT+xcpGlMif6C4iun2/4iLAagcXEGUb8eeC4v+ejFFUe7qxA MoTD7ffwYnJwGtuK1FujD/N9c3AMDfkeh451RrWxem+53xirSnx7/jF7qvNVy4kE21X0 sO+Q== X-Gm-Message-State: ALyK8tIj50spwAFgYKINUSFuf+3eGt/CYI07DTYSiIEU3t5DUTJSkcO/WoqZeTJJlYEm5CX8 X-Received: by 10.25.208.137 with SMTP id h131mr4287689lfg.215.1464354048841; Fri, 27 May 2016 06:00:48 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 06:00:48 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 27 May 2016 16:00:04 +0300 Message-Id: <256cb6af7f04ae385883408084b3ef989e2423d8.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:c07::22a Subject: [Qemu-devel] [PULL v2 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 cc7f2aa..9e6448a 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;