From patchwork Mon Feb 20 03:23:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 655038 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1179855wrc; Sun, 19 Feb 2023 19:24:52 -0800 (PST) X-Google-Smtp-Source: AK7set/MBMJdeqDZ6c3jxulG4DcWzf0AGltvnm3HNP/BYizWg03A1YSpViZ2yYj5un53QJHFdxmu X-Received: by 2002:a05:622a:1821:b0:3b8:683c:40f with SMTP id t33-20020a05622a182100b003b8683c040fmr12257326qtc.30.1676863492575; Sun, 19 Feb 2023 19:24:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676863492; cv=none; d=google.com; s=arc-20160816; b=fdz2lzr/RdrFJAajbHdJyw6qUa1QQQmmivDuHy+QWJR5gGp2JDfi/JJHZsK5TmKE6B gS/S8h83wBEFkGeou+C/kxRsEst0HMZ76UH7naJeF9F1caChnJ2nb9JSEe7uLCWmFI3Y hiYxGhlaOOcFZ18RpmNDj+usbCvB5H63827bAjOETNuFqBvcbb8CTnAsc7iPvXvFWx8c zXVY3OA4PRWbhtnMuIQW/Nndj9pBg6hgJ8srQbhCfMP0wUwLrGEIix/t6nLN3veTAgpK Ydb3t/O1Dm/WTJsQ9dfrKG7q3zvsRMfl85nTVyVRQ6V3CWPyqLCVFHpd3eociiGDb7eo L8nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=JKMBaWZBGONH22d4GZ6aoQ5NI2bVoqwHKZG9lz4sA9s=; b=CvqyBAjVU7CbvVDkOFgSTO2Hcy8WiyMOjhIYFaLliYIQo6DPozmYsr46jYyT29CIjh SIh828TqX7P04WrApMcmd9QStFt1h4UKx9GNUz3X7YA4zi2/y13rd4+6FARWml2SHJAe qc28YozO4DdfI5mkyq00jdI+s2MFFOMcHFaZ0SsKw4UXn40SuP1SLy58FBwqmg/M5MAq 9xTMl3A+MtvgU8Lri3AhOuq2xV5taPD+jstWu7+VEMP6I/9BKi0/OGtGjg9oDrC4nmhL XxQrO58hzUYmWVuRtUJMXVd7+8O2fm3CoLD+c7hrzHPDKEnpSHGqQoh42bB3ogKTuBIy 5jHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YzdR1yc1; 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 i123-20020a378681000000b0073b398bbf98si8220680qkd.129.2023.02.19.19.24.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 Feb 2023 19:24:52 -0800 (PST) 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=YzdR1yc1; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTwmT-0001BK-KX; Sun, 19 Feb 2023 22:23:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTwmR-0001Av-SS for qemu-devel@nongnu.org; Sun, 19 Feb 2023 22:23:55 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pTwmQ-0005qm-9T for qemu-devel@nongnu.org; Sun, 19 Feb 2023 22:23:55 -0500 Received: by mail-pl1-x62d.google.com with SMTP id q9so2040325plh.6 for ; Sun, 19 Feb 2023 19:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JKMBaWZBGONH22d4GZ6aoQ5NI2bVoqwHKZG9lz4sA9s=; b=YzdR1yc1S5JYXOoNhpa9IxLl+hTme/WPpNSeOnX7jn5L+WlEW8z0cGhTh2AuSU9Lmx /ZelLEGc27P7c6edAhagPR/pkuTg+BKXPdiE7nTfhHI94SBIIk4m4eeFhI7gP7i8sic4 h+k8Iuvq8AgaSuEUTGNHVZOr9Z30O5Vhp6FaIX3j4WqFvK+Za/PV6Y6pQanEfgS+ZKjX VSx5m4X+h2KdUuDWrqzP66WT/+hhB4Dn3BArk7J/VT7gq3Z5PmSeM8k9BMo8Yv02u3f4 z7Qx/pljY+BH4si1CMbT7RYzXbXeNFzVV+6rE8b/OHFzj3vmrb48zTGoqpumSOosOLZ5 X3+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JKMBaWZBGONH22d4GZ6aoQ5NI2bVoqwHKZG9lz4sA9s=; b=f6Xp1cfb8LyE8kW67fy5VR3vEJwLqyj3RVss7Pi9ekLiNvNfCGlnAxJdYFF6LdmMx6 2o9RdgSo8FFGE5enj7qE1SIdwIEX53PMj3iWs5PhmF0FodfwGhskvGD6Hd8cO6/TITEo KWvS79+Jt245M/RrXvciduEFI0jugxr+1Bn4PTWPxnd8l1/dbHG+wfWLoWFIig0YJQI2 ZAkPZagMQNLvGM3m5Z35GLIflPmVAuZ24K6n3WDjpmYd07FESgVlfsE/OfFhRYmG5d8y XuCzrVmbFWSLpoLvaYXOX7nFNGa8nvbSfTLygWCKfFJ9jRIkVxdYjFlMHBzp7j6hsmzK d9aQ== X-Gm-Message-State: AO0yUKWQ0VJSjRDuO4kXGMrUIbJogLjlN220OsIdVKZ0B3mqwbMC7uTd jN8zkk07N18bdp4AlXq4RE/57bQtk1N21UY0V28= X-Received: by 2002:a17:903:790:b0:196:f00:c8f9 with SMTP id kn16-20020a170903079000b001960f00c8f9mr2348490plb.10.1676863432905; Sun, 19 Feb 2023 19:23:52 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b00198e1bc9d83sm6621302plk.266.2023.02.19.19.23.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 19:23:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Ilya Leoshkevich Subject: [PULL 5/7] linux-user/microblaze: Handle privileged exception Date: Sun, 19 Feb 2023 17:23:36 -1000 Message-Id: <20230220032338.5619-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230220032338.5619-1-richard.henderson@linaro.org> References: <20230220032338.5619-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Follow what kernel's full_exception() is doing. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20230214140829.45392-4-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 5ccf9e942e..212e62d0a6 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -25,8 +25,8 @@ void cpu_loop(CPUMBState *env) { + int trapnr, ret, si_code, sig; CPUState *cs = env_cpu(env); - int trapnr, ret, si_code; while (1) { cpu_exec_start(cs); @@ -76,6 +76,7 @@ void cpu_loop(CPUMBState *env) env->iflags &= ~(IMM_FLAG | D_FLAG); switch (env->esr & 31) { case ESR_EC_DIVZERO: + sig = TARGET_SIGFPE; si_code = TARGET_FPE_INTDIV; break; case ESR_EC_FPU: @@ -84,6 +85,7 @@ void cpu_loop(CPUMBState *env) * if there's no recognized bit set. Possibly this * implies that si_code is 0, but follow the structure. */ + sig = TARGET_SIGFPE; si_code = env->fsr; if (si_code & FSR_IO) { si_code = TARGET_FPE_FLTINV; @@ -97,13 +99,17 @@ void cpu_loop(CPUMBState *env) si_code = TARGET_FPE_FLTRES; } break; + case ESR_EC_PRIVINSN: + sig = SIGILL; + si_code = ILL_PRVOPC; + break; default: fprintf(stderr, "Unhandled hw-exception: 0x%x\n", env->esr & ESR_EC_MASK); cpu_dump_state(cs, stderr, 0); exit(EXIT_FAILURE); } - force_sig_fault(TARGET_SIGFPE, si_code, env->pc); + force_sig_fault(sig, si_code, env->pc); break; case EXCP_DEBUG: