From patchwork Fri Dec 7 10:36:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153124 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp343852ljp; Fri, 7 Dec 2018 02:48:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/WbgY2B906fc5I33RkbnAxujR7GboWN8y1vpUX1b/ouee1aJA2JFC8usbc6p7itDPdZgWef X-Received: by 2002:a37:bb82:: with SMTP id l124mr1292791qkf.188.1544179727051; Fri, 07 Dec 2018 02:48:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544179727; cv=none; d=google.com; s=arc-20160816; b=H6RF4Z8ZITyI4D9Ra8EZIzOOdEEfFtjPK4mEa8DAjZjtKeAuWxFsTDigomTQQ7LDaf gx7whbd/p3FO5bC6fXwbZtqXNgA5aHAGk/HZC5yPh6ck00MQjzwmX1m7L4MktXthDWGe 6aFruWbM/2iSe6n3bJDYtR18IfCEMQ7VCiNrvERAGLcUgkKLdmLI39Pn1WchxTJNQDU0 I3yitC0DJMkCOh2TPwgFx17tOREWMuU6a9ikVw3/2Tyf9fVr+sDg68aX9SDWX1WyVzZw 1FHLTh1skKSEdL300C9q2KUxZyxa9JfXg0OibHVJwTr8CYE+b4z/28w0Qu0I26qow6qA ha4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ZD9KhKx3yNscJBn17/oGmZfC0wUnvUG9NK9ZtliH2Gk=; b=f88og5lY8ZvaC8s6yslXVrwPdtXgWdA6PHbbBcrpOpz3D62yTuh4UoGK+R7GohgqzG 6xxTuhZkpjcheXgVxnN6aYJ8Xh0pXQQsmwm0w4swfb1EuPLuIhu831gJAI3/5ct1F5Xz ghs6WNA3imc5cLgz4bUA+tEbnKaGRER6G9i8uuWK/fURzIRrKdFHXbZjmk7liIqrnESb gEIPd8RyYRSXwFRvIjaWcLdgiVFNODRu/vtVHHyTaQXF4jhPNBJaThZ2DlRYmyBMjsv/ NcY6n5xQyQ9YxycbeSy9S52qQtkNE142mxdOKsMGFMTBRCC/SkFT2XwyP+8Dr1s9FHKJ Wrig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dqP6wre9; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 25si905196qkz.65.2018.12.07.02.48.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 07 Dec 2018 02:48:47 -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 header.s=google header.b=dqP6wre9; 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]:45312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVDgc-0005Qb-Gg for patch@linaro.org; Fri, 07 Dec 2018 05:48:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVDV7-000872-Fa for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:36:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVDV6-0007aT-LJ for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:36:53 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:46420) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gVDV6-0007ZM-AK for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:36:52 -0500 Received: by mail-ot1-x32c.google.com with SMTP id w25so3309511otm.13 for ; Fri, 07 Dec 2018 02:36:52 -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; bh=ZD9KhKx3yNscJBn17/oGmZfC0wUnvUG9NK9ZtliH2Gk=; b=dqP6wre9sLtxPn49hSZrgbjxiJO+A0+TCeZ8viQgRUYjNc5Wom11Zye5FfwDx2BBwz mdcUFMuS04+dMRocZlB91reUVTj4mK/GGzsqBq8omjWhIOOMuQ3k/w4Ou3sXD+fTULXt y5YYGkADfj3+b6tFxSAU32/afRVicnRyeSYHc= 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; bh=ZD9KhKx3yNscJBn17/oGmZfC0wUnvUG9NK9ZtliH2Gk=; b=qG9xeo1Vq//t3mnmzZLxfXAiuOOH5aZ4ifW2QgZVrnt8lmvLlI5Pnb4ZUeDrVjjKkr u72x5Juf9ARXPL1zhD+PQA5nG7XOGfxMJa+hi2Ctwdl/uMJDZcwUHN+Vjt2TKVRbYHBA U5NBniJPcN3zQsekv8PClJPZu+XwOwcA/4TNxDxtEpBgjzj94Oic1RCBsJTk9rc7JJtD TbCirXDPsYCIgH9ttFkDS71OiNSVhspVyp/gcLjF3xewSUrU17cARR/Rps67WYohGiZp BJz1YoPEvDBp0Ucnr418wDEwolCuptemJhDlHHQEW/nOGaYnvelmFkyHBMyr9Kq+cb5D NB/A== X-Gm-Message-State: AA+aEWZGbStdDP11eC48e29y7puoAtipPJh3Jlge87BTW7vr4BWgrcBC mOzmZoVs+PFCLeL4GK2V1glXCpNCaEQ= X-Received: by 2002:a05:6830:110f:: with SMTP id w15mr1049230otq.222.1544179011183; Fri, 07 Dec 2018 02:36:51 -0800 (PST) Received: from cloudburst.twiddle.net (172.189-204-159.bestel.com.mx. [189.204.159.172]) by smtp.gmail.com with ESMTPSA id c19sm2037594otl.16.2018.12.07.02.36.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Dec 2018 02:36:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Dec 2018 04:36:15 -0600 Message-Id: <20181207103631.28193-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181207103631.28193-1-richard.henderson@linaro.org> References: <20181207103631.28193-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32c Subject: [Qemu-devel] [PATCH 10/26] target/arm: Add new_pc argument to helper_exception_return 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, ramana.radhakrishnan@arm.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-a64.h | 2 +- target/arm/helper-a64.c | 10 +++++----- target/arm/translate-a64.c | 7 ++++++- 3 files changed, 12 insertions(+), 7 deletions(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index cb7209eb31..b54ce59c48 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -86,7 +86,7 @@ DEF_HELPER_2(advsimd_f16tosinth, i32, f16, ptr) DEF_HELPER_2(advsimd_f16touinth, i32, f16, ptr) DEF_HELPER_2(sqrt_f16, f16, f16, ptr) -DEF_HELPER_1(exception_return, void, env) +DEF_HELPER_2(exception_return, void, env, i64) DEF_HELPER_FLAGS_3(pacia, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(pacib, TCG_CALL_NO_WG, i64, env, i64, i64) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 92e751fa07..0818fd5451 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -925,7 +925,7 @@ static int el_from_spsr(uint32_t spsr) } } -void HELPER(exception_return)(CPUARMState *env) +void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) { int cur_el = arm_current_el(env); unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el); @@ -991,9 +991,9 @@ void HELPER(exception_return)(CPUARMState *env) aarch64_sync_64_to_32(env); if (spsr & CPSR_T) { - env->regs[15] = env->elr_el[cur_el] & ~0x1; + env->regs[15] = new_pc & ~0x1; } else { - env->regs[15] = env->elr_el[cur_el] & ~0x3; + env->regs[15] = new_pc & ~0x3; } qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " "AArch32 EL%d PC 0x%" PRIx32 "\n", @@ -1005,7 +1005,7 @@ void HELPER(exception_return)(CPUARMState *env) env->pstate &= ~PSTATE_SS; } aarch64_restore_sp(env, new_el); - env->pc = env->elr_el[cur_el]; + env->pc = new_pc; qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " "AArch64 EL%d PC 0x%" PRIx64 "\n", cur_el, new_el, env->pc); @@ -1031,7 +1031,7 @@ illegal_return: * no change to exception level, execution state or stack pointer */ env->pstate |= PSTATE_IL; - env->pc = env->elr_el[cur_el]; + env->pc = new_pc; spsr &= PSTATE_NZCV | PSTATE_DAIF; spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF); pstate_write(env, spsr); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index d034a5edf3..c84c2dbb66 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1981,6 +1981,7 @@ static void disas_exc(DisasContext *s, uint32_t insn) static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) { unsigned int opc, op2, op3, rn, op4; + TCGv_i64 dst; opc = extract32(insn, 21, 4); op2 = extract32(insn, 16, 5); @@ -2011,7 +2012,11 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } - gen_helper_exception_return(cpu_env); + dst = tcg_temp_new_i64(); + tcg_gen_ld_i64(dst, cpu_env, + offsetof(CPUARMState, elr_el[s->current_el])); + gen_helper_exception_return(cpu_env, dst); + tcg_temp_free_i64(dst); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_end(); }