From patchwork Tue Aug 25 20:59:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248293 Delivered-To: patch@linaro.org Received: by 2002:a17:906:6447:0:0:0:0 with SMTP id l7csp6395ejn; Tue, 25 Aug 2020 14:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm3XW/XAcHgNDfWOURc1MzOhO7uvD54hYipEQI//Y/MQj/EfsAp6FDc/JkE/vJl34Kdsiz X-Received: by 2002:a25:bf86:: with SMTP id l6mr15910940ybk.323.1598390280135; Tue, 25 Aug 2020 14:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598390280; cv=none; d=google.com; s=arc-20160816; b=fmbAQHzeSTB3p8UYlSNlsykXOoM689QpJeLcd/BQK84T59JXawrP4GMkuO5zet9ZMp CSflC25QRev2xPg863COgkTbriMAWAiAEcnqGsYBePnm9RXo44Rby3x8AWz9JzhWqODh EL7IfSfkYI5HXk2q0hQOgH9oxq7EtFUBuwjqC5MomKoTwRokMZlXRVNZNhOXDFPLwr0+ /W+tm3JY2vY393CA7fLWhowLB5ULUwk7O4RqP0Swvaj72ihXV2nHVJI803r6HN7F7JNS Wflf5LfvxduInXr9AUFTX6c/y7zoZHP9JXi1HQZ1gD+0FW+MuCwkQyC9kK9KJUaAaFwG TaaA== 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=SC8/kFN19KD10q9p+XR6vzzP0TRrCZvssvieZNU11GWMb7mjkM/c66Kk02pVvriane f4ZXWWFVZsrl0TJb/pR5lui3LygTafYGNVDidRnlj+MP4DNwy/HutkueW5nPOl2lHOkH yMxXTXr/KF1sxjlKlsQh5HeOH6sa6N7NIhl3PdF/Yeqv3tMumTbCPPzdIwnhKvjom3kD 99TrtM/Ax81cjYL0NFBEoE60oyeXfkZUFztAYpT17wvKkY0gj0QJ305Z0jrMQvb/1Ggv bgICJ2DGGRehNfXeLDT4aMjxXuRzIlM/sX0fbcv/Sb9KeXfj3U2//z61QYz/ObbIiFwR j2EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y7j3LQ8y; 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 b18si55411ybr.89.2020.08.25.14.17.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Aug 2020 14:18:00 -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=y7j3LQ8y; 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]:52416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAgKN-0001FJ-BB for patch@linaro.org; Tue, 25 Aug 2020 17:17:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAg3y-00005t-JF for qemu-devel@nongnu.org; Tue, 25 Aug 2020 17:01:02 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:37544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAg3v-0001zQ-KZ for qemu-devel@nongnu.org; Tue, 25 Aug 2020 17:01:02 -0400 Received: by mail-pg1-x543.google.com with SMTP id g33so7674102pgb.4 for ; Tue, 25 Aug 2020 14:00:58 -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=y7j3LQ8ylTbYEThvqr4pjXq1SJaaM+ejNwiqt3pPalI8eEIngELZet7AzpvhZUCIbK UT6kcLnuLzCRpKJRaBEdQg0CcQvOLN94WxIrWx2kpQR5BSHISh6qtmzN+WsMPJfR+y1x jn1CJcegAJ5ULs+cEubVud5X6T2oBxqqLmttC4WRSk68hmNvf8UjIJZPCkGCcw2bVWS8 Dc23wCLpbwcU4EIbdUhCF+HhMrPF33Tf6colk+3SZrJkbh6tZ8IYeBBQ62NF4hiXlLV4 /HYz1tGyinXNirsETo5+N6meIcqpl4qWVM6YmQscBTpqMCjzhjuYoN1dPPW+8U8YR7Fn Uo9A== 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=fmFI8FhhTutP0rb1JhMT2so9Jt5TklK/1pHPW9hDsCx2jPl3fCJNjZ1A5iVzn8wHOd jjJJryiI8thdRZ46RwliHz4KEe2xfW8rOM3VGW8IkRyUocVaCA8PAItM+VbWSPkALJaR CiKFnHABaPJpsjMSm7EQBTX7Id9ucU+fKsiHBtNviJrLCywEAyfL5pK7CvHPJ5TCMCYx JZ7WpiSqTvklmM/tVphHXiHZYjfJj4mHL3C6TU/lFvCfpjuyqX42iqvPJDjClP4zhhJe czYy4Tre5Ifl9YHAC1m/tb/KzjBQVhnYJEcIvdfKAQyiG4CPNlcZQ1r6ehVoYODqAARa YR9Q== X-Gm-Message-State: AOAM530sWTwx/oEVAOOoiTKYj3XEiPcZQ6s1lJMGFmLoNWPZv9LNZOHk lS0tw5BQDUSCxtJfh/4hGUrDUVN4IeMyEA== X-Received: by 2002:a63:ec04:: with SMTP id j4mr7979363pgh.393.1598389257218; Tue, 25 Aug 2020 14:00:57 -0700 (PDT) Received: from localhost.localdomain (h216-228-167-147.bendor.dedicated.static.tds.net. [216.228.167.147]) by smtp.gmail.com with ESMTPSA id k4sm16074pgr.87.2020.08.25.14.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 14:00:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 52/77] target/microblaze: Fix cpu unwind for stackprot Date: Tue, 25 Aug 2020 13:59:25 -0700 Message-Id: <20200825205950.730499-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200825205950.730499-1-richard.henderson@linaro.org> References: <20200825205950.730499-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.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@gmail.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()); } }