From patchwork Fri Aug 28 14:19:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248564 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1142907ilg; Fri, 28 Aug 2020 07:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAczWp5iHIoy6WBs43yG1CWwyU57sa2tSmkrmzrhn8xtw5Bq1ydi4YpFH0iCCS+1rRl/Z9 X-Received: by 2002:a25:868b:: with SMTP id z11mr2856223ybk.108.1598625855102; Fri, 28 Aug 2020 07:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598625855; cv=none; d=google.com; s=arc-20160816; b=PrHzG55SEra+PTdkykrdxYBaItcK1uBWz8ZnFDI/RhJ/gWBOssWE76qC6FCKc4w2WV 9kz0DpQRpN1E/pkWznzZiMtO7AWqNk+tTd33/ItTqvtJ0D7sbrUTaybDVo9SDF+QRy28 vpz1CRdQh5U0Y9nFpv11Y1V+Q+tF/LtgqbCIRw4iOj1drg+f/2WNfZIXpWDUkhBGUoZM foGohyM4G7jn0Ld7/ekhvhhx5JiiBIdqCGXdIRH/eVvsNTlOKh3UMhR4lw98C7gtNBwK 6tVKm35Srz/dpQetIUBHw2ViMbnFXQHZhOAGJ/lv1nLgABbHNt0PRO39nqYbH0WTbRB7 ufJg== 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=R2cuEf3Qt/jcGcIZclz+3Hjy1ReL2CdcRjCqzKw0P3k=; b=zLAtnLv8IwdC3cmfbl8sYe82/i6cK+Vxbli97GD0SBv9KVbfCIDuwueuV2e4e/V/L0 7fxy8q2CXeK4yQPZBumTvPSTdnQ73fpIBYIo6HsuEhu5H/Wy5CmGjHarGM7Nx0zKtTtK MHh3uZGIwI9KX/eacsnVzYxr/VuaECAHNEzKbRmhkWDOofANOLmkehWuSCHplL75Ksb+ /edMeb+QuckwDw1DaQGZVidpdpm9IoUpS3p0vxo7M1hP+nMbB+ihdpihGCYPl0b9zQZg E+Dnw2t9LwpTN1zQ0u8fPRW7xdtxbwjQEyMznEshTjeX7pl7Fn8wXXhhaVl9QBLRuCJJ IHvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWxvfLJx; 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=pass (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 s4si1162675ybq.70.2020.08.28.07.44.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Aug 2020 07:44:15 -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=pass header.i=@linaro.org header.s=google header.b=vWxvfLJx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBfby-0006Xu-IX for patch@linaro.org; Fri, 28 Aug 2020 10:44:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBfFD-0001bm-3r for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:43 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:41738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBfFA-0005IR-OL for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:42 -0400 Received: by mail-pl1-x643.google.com with SMTP id 10so524337plg.8 for ; Fri, 28 Aug 2020 07:20:38 -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=R2cuEf3Qt/jcGcIZclz+3Hjy1ReL2CdcRjCqzKw0P3k=; b=vWxvfLJxBpRPSsuqGep2SiXPgGL6pOvxL7YlkQ0SZRuQ4m6u9+R1TQQOwbWCurhaVx 8fetg63TUXNpY5LUR3Z6uo4UKuCv462o5Kbl7iSkhFNUDaRIxioscXPO5cV1d2qUNfRX MQmdSzhGa8gttSFQF06xXqGXqS49hcx7zjEyiYyIgIsa0oZmDOBkWIShyGGDp2RuJJKN Q07nD7VZtcW93bX/MHO4Rpapeu0WCDtPf1ejadxvjdw5vLpX+V3hL3+r1k/rL7ztT6Na hxs29deB5LkyH6NF5ETtqTVqPdTdlTk4z1IDBPGWIZ25VlwBvOx3vBFSNpofecoCGUeG pHVg== 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=R2cuEf3Qt/jcGcIZclz+3Hjy1ReL2CdcRjCqzKw0P3k=; b=NjfvwEgAXtTw0tXLAufKX8s+B9o+pJ6DOgenRjO4HWGNmbJVzg2sJwsKv5HwqT/P4l 8YF8EXkvjzFReO4Yvg2uU2juzYtkzL8y9d8J/mDqJBYJpK93F8NoCe/5U9/eACoGmAkT QKGd8dudfOAs1YH2Ag1zPmc4psDzb5aJGEiFzaQXrfabd0OcZYPrbZYmObhVFH0zSbjJ 67Y7esgkcToSVtroImx32TD22uikXPHo2h3U9zm0Al1GsIoTJh9ZHVdc+b89z5Dcd75R FFMKmM+IvscOK96o/tmPPapTIb6BX13HPHy3UhMsnRJDIEMhCagaPqG9Zn2luxWeOjet zcRQ== X-Gm-Message-State: AOAM532Sy0IRFJkD/vwkwbiOIOug/KYpgnog8hhkxL3VdgaV0zPTXRNo SPDP/LlUj5sILD1SRIIKWsNtaCjhVF9WHQ== X-Received: by 2002:a17:90b:4c46:: with SMTP id np6mr1434791pjb.201.1598624437388; Fri, 28 Aug 2020 07:20:37 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id j3sm1403080pjw.23.2020.08.28.07.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:20:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 52/76] target/microblaze: Fix cpu unwind for stackprot Date: Fri, 28 Aug 2020 07:19:05 -0700 Message-Id: <20200828141929.77854-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200828141929.77854-1-richard.henderson@linaro.org> References: <20200828141929.77854-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x643.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.iglesias@xilinx.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Restore the correct PC when an exception must be raised. 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()); } }