From patchwork Wed Feb 1 15:05:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 93068 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2471931qgi; Wed, 1 Feb 2017 07:35:27 -0800 (PST) X-Received: by 10.237.53.236 with SMTP id d41mr3600159qte.135.1485963327465; Wed, 01 Feb 2017 07:35:27 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j54si14664016qtc.49.2017.02.01.07.35.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 01 Feb 2017 07:35:27 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYwwR-0000hu-25 for patch@linaro.org; Wed, 01 Feb 2017 10:35:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYwUF-0007LF-6e for qemu-devel@nongnu.org; Wed, 01 Feb 2017 10:06:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYwU9-0008Ka-JD for qemu-devel@nongnu.org; Wed, 01 Feb 2017 10:06:19 -0500 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:38523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYwU9-0008Jl-E0 for qemu-devel@nongnu.org; Wed, 01 Feb 2017 10:06:13 -0500 Received: by mail-wm0-x22f.google.com with SMTP id r141so42523782wmg.1 for ; Wed, 01 Feb 2017 07:06:13 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=IaNdSFbfWqkdCZkXnUKK8o8KEPaqrbghz/IfMaCCZ24=; b=a1fy8nu1A8RdBtwEyUj2qttNkYzYH7Dq56FZzfO6fxI7yamsrtyGUzYfniIQWYo7Em FYSPSRin+GLy7tJ3nPvETwKvJv5Oi5fByPxea2fQWqX620nahvCDb5i7ut2rATrTbZfG l8dPVSuMD+ZICCDTyigzSgIqQgrK5e1xapVg8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IaNdSFbfWqkdCZkXnUKK8o8KEPaqrbghz/IfMaCCZ24=; b=mP6n+TRmkVlsSbPqaGDr5/s0pYPKVlWLWu8xMkrAU48/y6XYjXQu/jiVtEUd6n/Hpv BpQVl4VoD1QguMwV9eoznjj0ahgED1T85xOegMav0Jb5LGTNE24xNR/kDZteM7Q8Ttrv m5J40LbdMUgdYZYmEl7FRbRQP7LXJeRGTTedogiX0r2S6oFgG1t4tqFffOrgPkskDsQH j7ympq2IQK7jI/tBmJjZm3JK1YcW8KI1fpbEfCPaoDeO6A9tJwO9UJvBcosWB2OyieWI FftsbzFAwZvtBMp0+osNN6GF4srJ3PsJYbnmPRRtBQkhv/pt6XImTQYZ8Y90NtqECWxO ETTQ== X-Gm-Message-State: AIkVDXKRfIJG9VBmjNPpsRv1jxgybN2optVULdxV22SNBh/92KcNCFNPrlH+TFWgeRrbNIjI X-Received: by 10.28.140.140 with SMTP id o134mr3181130wmd.87.1485961572127; Wed, 01 Feb 2017 07:06:12 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t123sm30025785wmt.8.2017.02.01.07.06.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 07:06:07 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2BF763E0F7F; Wed, 1 Feb 2017 15:05:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com Date: Wed, 1 Feb 2017 15:05:51 +0000 Message-Id: <20170201150553.9381-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170201150553.9381-1-alex.bennee@linaro.org> References: <20170201150553.9381-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22f Subject: [Qemu-devel] [PATCH v9 23/25] target-arm: introduce ARM_CP_EXIT_PC 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: peter.maydell@linaro.org, jan.kiszka@siemens.com, mark.burton@greensocs.com, "open list:ARM" , serge.fdrv@gmail.com, pbonzini@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , bamvor.zhangjian@linaro.org, rth@twiddle.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Some helpers may trigger an immediate exit of the cpu_loop. If this happens the PC need to be rectified to ensure the restart will begin on the next instruction. Signed-off-by: Alex Bennée --- target/arm/cpu.h | 3 ++- target/arm/translate-a64.c | 4 ++++ target/arm/translate.c | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index d61793ca06..a3c4d07817 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1465,7 +1465,8 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) #define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8)) #define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | (4 << 8)) #define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | (5 << 8)) -#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA +#define ARM_CP_EXIT_PC (ARM_CP_SPECIAL | (6 << 8)) +#define ARM_LAST_SPECIAL ARM_CP_EXIT_PC /* Used only as a terminator for ARMCPRegInfo lists */ #define ARM_CP_SENTINEL 0xffff /* Mask of only the flag bits in a type field */ diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 7e7131fe2f..98d4fac070 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1561,6 +1561,10 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, tcg_rt = cpu_reg(s, rt); gen_helper_dc_zva(cpu_env, tcg_rt); return; + case ARM_CP_EXIT_PC: + /* The helper may exit the cpu_loop so ensure PC is correct */ + gen_a64_set_pc_im(s->pc); + break; default: break; } diff --git a/target/arm/translate.c b/target/arm/translate.c index 24faa7c60c..e1f4a48720 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7510,6 +7510,10 @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; + case ARM_CP_EXIT_PC: + /* The helper may exit the cpu_loop so ensure PC is correct */ + gen_set_pc_im(s, s->pc); + break; default: break; }