From patchwork Fri Dec 14 05:23:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153750 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1676435ljp; Thu, 13 Dec 2018 21:33:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/VCptr6lTPL1+tLibIrr03nKP7F4cpce4J/L+78hshHSFhXC6hfohc2fEtQIpUNGFtu5ErE X-Received: by 2002:ac8:1b34:: with SMTP id y49mr1539382qtj.374.1544765619119; Thu, 13 Dec 2018 21:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544765619; cv=none; d=google.com; s=arc-20160816; b=W3jeHp6iZWwPVAmcQO6PscoZN7PQNxb3i5uinVfnHo3TBCUKS7BV8zM7Cjp9YlR+2D GzB7ehMDvFFybBDUzCoZcXTNPhASUOS5ryKLDwdjIPDu66OEIQwuMQyPMFNVS90UDOr7 q0SMb7/kRupBM1C7N1sePStUQl+C7Hct6VFAoGJ/5Nu45Y/XkwoRZ81G+2WquXx1TvpA GE/EmmzaitEFFrxppkGv1XUy1EWjZao8WA7WXIgBbGKGCVueU+2WErv8oQAH44p+UHou Dtz7AtOUuoFD49rc9ZgarFEptrHdhSMxFQFNgmRpc4PbPLK1qmRWW1LXjDi8WHcCUkkk aqCA== 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=mPTleWvG/khzrsFEcdVNmfNlDqu5p82Vi8rcgi/0BXg=; b=pVpXfcudLNcg1G5caIKa/PWNyAJqEve9Ya1iCXALPurR2+MIayiJ5OG24B7fipxbAl ll1c29Omk41u1qKMhB/1Rl8rd1cfoV/kktbOVIA9T/QLuepYxDCML28B/z6XJ+SIk6Uo iFGMZAYySCStF6KBp18+t6boKtf6/poUNzA5p/DV4zKTW/C5FrrbwjyrwmlSVShvxMGZ rYBC2Bqbn4b50wJcNTot3F3CTBtPgySVX5dOE2ZKgIVTCs+d5f7C1+TUyPV+Ti13T/qD wHThpdW12K0HLMiRGBHKYlUX0H8U40kbor52tUc4HrYVJlAF6I3T70rM3aNMURdcl8rZ s09w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YbP9kF7U; 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 m96si1646253qte.185.2018.12.13.21.33.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Dec 2018 21:33:39 -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=YbP9kF7U; 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]:59470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXg6U-0002ng-9n for patch@linaro.org; Fri, 14 Dec 2018 00:33:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXfxa-0004Pa-PC for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXfxZ-0005Nf-Rt for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:26 -0500 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]:34838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXfxZ-0005NL-MW for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:25 -0500 Received: by mail-oi1-x236.google.com with SMTP id v6so3644512oif.2 for ; Thu, 13 Dec 2018 21:24:25 -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=mPTleWvG/khzrsFEcdVNmfNlDqu5p82Vi8rcgi/0BXg=; b=YbP9kF7U3raS4qT7+XWQTxrBXME0Vc9tUIF0tn40mFa/5Ompa+wDVQYGPoO9HFq/wA j0MbSiea0Kg9T4M+3UuwEd3UPJOypYWQoPctnxC7T+UYhnhCyPxA2ddTEdbOjuRwEzbt 51eYyeiQ1tQZ9c+C2r1xcVh4Y8IuDZMSr9ZcU= 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=mPTleWvG/khzrsFEcdVNmfNlDqu5p82Vi8rcgi/0BXg=; b=QUy8LBqhYJOrO1hel6hmD4/Na1WN9UaPKjEm66jgsq/s+okFwWzKvg7/O75w31Hp/9 W0TsUoTaJQ+KYXRwiB5dyWNQfzkoGGSQr0Abl+NJtm9U79pl8f7arCdk6iM+ttnq2gFP nmCzTAD+/itUMJVfC/+NhbyPByOp+UtuXRHwPgSVXTU2e2qG1nqTz+F1ytAt/nK8ZIkf vOk41cFpVuRNymMCvLzg3NENlhhBMGb4G3Tm43uvqbElSLHE/eqw2ONyn4Mi4xV+cXar kxm7tMKFzNAspo8cTfyzDebnpjFvU89J0JkZq1qISmR6sppnJmbkqfohnPwlRbko9sfP Hkow== X-Gm-Message-State: AA+aEWb4w1vopfXauT4zg/4ewMhiv/7Hltxk8pTHlQMDW9NGKgotN88S 30Msmf+hSKdujmcZslDq/Lg/PUtbtJb1JA== X-Received: by 2002:aca:d905:: with SMTP id q5mr1037126oig.0.1544765064739; Thu, 13 Dec 2018 21:24:24 -0800 (PST) Received: from cloudburst.twiddle.net ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id r1sm1845379oti.44.2018.12.13.21.24.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 21:24:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 23:23:53 -0600 Message-Id: <20181214052410.11863-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181214052410.11863-1-richard.henderson@linaro.org> References: <20181214052410.11863-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::236 Subject: [Qemu-devel] [PATCH v2 10/27] 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell 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 diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index 55299896c4..aff8d6c9f3 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 f70c8d9818..79cc9cf47b 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(); }