From patchwork Mon Aug 31 16:05:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248802 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3456869ilg; Mon, 31 Aug 2020 09:27:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyt2FL+TAmH3d4lv89TnsmQvnenGCEdbkA9+2IRpGpBsQHQCX13fhyf4TwNoLPxt17aqiF X-Received: by 2002:a67:fc49:: with SMTP id p9mr1823452vsq.142.1598891249103; Mon, 31 Aug 2020 09:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598891249; cv=none; d=google.com; s=arc-20160816; b=H92PS1wsuQDCs8SFRqou2zpKHnXa/Wm8YJdgFprpZ6g8EzzEO/SSyiqf9nOj54+7aP wk/zDBZmqgXIMH7GFGgovj268jyAZU0xl7gmBV/5WFVNrcAKojR9hlt25DdtSwrzzB58 7UyFsPTy4WaRRdPNporOJNuZnSlfyyIF0TAOk2SwmsI90kU2f/Ok1A3uIZgF31O2NdSq sDgPz2ZU8UPPNNkRn4p27Hfk1vM6CcU+FbgB12BURLUl5aVwr58N2nnExyKuMWSUXT32 LuNve2ObG7woXAEjlE9ELew4n/ldIe+ms5FNaARzsTVxNI47O+l7TiKlvEC7ba2lqbZn l0PQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2cPf8f8AdkhKlG+8ucMI1Z77vF2YecMji34EykTW4mg=; b=mNT7NkY8c/mLw/1U21ke8iB5KcKNIfjTS4e68+LqahuE/mVgxdt3Ri9kUaYKdaOJ8K ZirnRjhfE3DwTi+MG3yzdNX8b9/RUEqv74k/QcK6zS8x+PqgcwP7lxqB4+Bc36mIReOx cPGueMzj/W2Xv01y86xRG60yBPcfEQMb7WISAeICa5bYlceQAgUEnXA1mQpVFrpnAXYN 9pnl3Jm8KHFRtAs4553ixHy4J4zPSgqCmawJ3xOrpg4dNrUsy6jPKu21AHRcO7pw2KHV 195oM+Gq8vc9cgM9Ut1zTOxpXCe+mM9/7crE6dMgFpcozlMDQyUV97nxtQkWwX3ZNL88 4jRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="BckR/dk3"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id x141si1207698vkd.56.2020.08.31.09.27.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:27:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="BckR/dk3"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:46420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCmeW-0005D5-Es for patch@linaro.org; Mon, 31 Aug 2020 12:27:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmKz-0005pw-HH for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:17 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:56169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmKx-000665-PW for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:17 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 2so21065pjx.5 for ; Mon, 31 Aug 2020 09:07:15 -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 :mime-version:content-transfer-encoding; bh=2cPf8f8AdkhKlG+8ucMI1Z77vF2YecMji34EykTW4mg=; b=BckR/dk3q8enNYYRrlgBHDtOMtxv+XIONca/zQDIr8p+z7+h5rlvr3hCaLLSCLyvHz QfAdHc653Pjv2BM+Iia81ru9EJM0XEdLH5kNh3Eqz8QbGuS16VdzUmTO0Rzg0+9/ddmm FYv8sXBKiCC7zbhxPvom9ZhBit9l40Y6V91hmJYYRqa+OilH9CVzDux/JH7Pg6jWUGma Wg+0LqFFGU7poQ7hYSufwRSpCdml4mS191uMHn2zNZsbSA7vxXmFPvrtKQ/rIXCNt3on lyDUOc3ty+MS7w4izemic+Drf8pG8r8VpddWPgQ3pMbzFheFKwBpeUiZP2caHBEak0/T +ezA== 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=2cPf8f8AdkhKlG+8ucMI1Z77vF2YecMji34EykTW4mg=; b=C74eAQRn5awa5ypXEKFbFmH64FHMIhcpDyNMEUJqXYUOXLlTQk/PxL6r9kLH5EFrqp 8MIpfN0ZpVtBJIpOdo8AHyXenIyyfhjK9EhseO9Yy+BKD1LbpwoQa/MNUt2uGDmzP6rR hKBsRV85+7D1g+BTl9Mkvbtd8S7puLsRhH5F7qqnZU/swn+gqn7d63ZQjVkHyjVVsxTd d8eyol9UH6SEuf+9eAnP1YEC5ze9im/MtigFa3w1f+jctJY58iwCbNolacXaWV3+xg8i OFgSdRELmhjU05qCETmTngpLnoBxv86cXaAI6ZxSDsyWNpHOyNQcidz5gEZ6QMHJc+Id ey0w== X-Gm-Message-State: AOAM533HeQXGVDD25+t4BGxpMWIDaX2VOkhKumpboZCuxDXMCfHoHSTP gTp8H+hF5mmt+jKsgqtXwWAflJh0bpfW3w== X-Received: by 2002:a17:902:6902:: with SMTP id j2mr1558149plk.2.1598890034024; Mon, 31 Aug 2020 09:07:14 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:07:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 52/76] target/microblaze: Fix cpu unwind for stackprot Date: Mon, 31 Aug 2020 09:05:37 -0700 Message-Id: <20200831160601.833692-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831160601.833692-1-richard.henderson@linaro.org> References: <20200831160601.833692-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Restore the correct PC when an exception must be raised. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/helper.h | 2 +- target/microblaze/op_helper.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/target/microblaze/helper.h b/target/microblaze/helper.h index 64816c89e1..a473c1867b 100644 --- a/target/microblaze/helper.h +++ b/target/microblaze/helper.h @@ -26,7 +26,7 @@ DEF_HELPER_4(mmu_write, void, env, i32, i32, i32) #endif DEF_HELPER_5(memalign, void, env, tl, i32, i32, i32) -DEF_HELPER_2(stackprot, void, env, tl) +DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_2(get, i32, i32, i32) DEF_HELPER_3(put, void, i32, i32, i32) diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 2c59d4492d..a99c467364 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -389,12 +389,16 @@ void helper_memalign(CPUMBState *env, target_ulong addr, void helper_stackprot(CPUMBState *env, target_ulong addr) { if (addr < env->slr || addr > env->shr) { + CPUState *cs = env_cpu(env); + qemu_log_mask(CPU_LOG_INT, "Stack protector violation at " TARGET_FMT_lx " %x %x\n", addr, env->slr, env->shr); + env->ear = addr; env->esr = ESR_EC_STACKPROT; - helper_raise_exception(env, EXCP_HW_EXCP); + cs->exception_index = EXCP_HW_EXCP; + cpu_loop_exit_restore(cs, GETPC()); } }