From patchwork Mon Dec 20 21:05:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526089 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4459689imb; Mon, 20 Dec 2021 13:20:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZ7/ahql6oer9wmAMXA/CFIac8J0n4JxQoSweIWf7rHtW98l8kcq9JJ2ladsZx63j0HBJw X-Received: by 2002:a05:6902:154d:: with SMTP id r13mr35383ybu.491.1640035235236; Mon, 20 Dec 2021 13:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640035235; cv=none; d=google.com; s=arc-20160816; b=gFrQJPvwVjdu9GMfoZpNAK0+5SDJYNjGOShbzZxI8tN/8KJt3zwhZ1Ju7Zn2XQU9v1 teHTVQPt6dH5Gcz1L4CbXLhLZRM0WPmbT4z4Sb3QKSSv1tmm1fZMd5c0IEto9dESPFMh RkWXHCe1qoM1vzr5dkqT2GdMQH8qTkjeK7Xq62Zlr5Pu5ckEAkNcS9SH4/x2LBU6YSPD vPiZ6Ml1CH2O4P7mIKVvgxXotBnEGRpftKTt4btp5EbyX5ZIQexIopSfmMo4Y3fXaZoJ W5rWb5ULQo6tuVszZEE2T9zizzXuiG8c5AhGoafqG3c0QmADf0eykD6Wq2KnWIEIxCSx TQZQ== 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=ta3Ko9zxfZ4eRR7LoDI2ksYw0ZQI5fINkcgZmVZuQY0=; b=EcgVSWNeUk7Fta6cZTdNRbxrWSb1JpZcqF1K6JsRnHEwdzvdJv2ujuUyuv6Ktn5n0L TK4EUuAMHjTchGskGmQpq1rZ+KZpPL1/f6ChSlO3r3LYSkXGG43VjxrRpBPawS1fsgRQ 693TKYTpzeamK6DmkXh04z8gpEKn7FlalzPGqsTnND+OspEVuAv72Cepgx8cz+dmrSlF uGkmp0ktkIwrXkjDBvv46TV1juDoDp6UiOST3djsEmoDvliidRzaMebszcTiAF8JieML s8sWd2kZze6u8T90OrxO6+FyV+elZ4bmYAL8xC/h814dgoeaFv7y4tsRaz9/K0bwnPns i/Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hX+OtUff; 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 a17si19197844ybt.109.2021.12.20.13.20.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 13:20:35 -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=fail header.i=@linaro.org header.s=google header.b=hX+OtUff; 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]:41914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzQ5C-0005l3-NQ for patch@linaro.org; Mon, 20 Dec 2021 16:20:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPqq-0000Vy-9K for qemu-devel@nongnu.org; Mon, 20 Dec 2021 16:05:44 -0500 Received: from [2607:f8b0:4864:20::42b] (port=42569 helo=mail-pf1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPqo-0005uu-Ak for qemu-devel@nongnu.org; Mon, 20 Dec 2021 16:05:43 -0500 Received: by mail-pf1-x42b.google.com with SMTP id t19so3476582pfg.9 for ; Mon, 20 Dec 2021 13:05:41 -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 :mime-version:content-transfer-encoding; bh=ta3Ko9zxfZ4eRR7LoDI2ksYw0ZQI5fINkcgZmVZuQY0=; b=hX+OtUffJanhryZ6O07gJcsVdcxnpXg287moCDvDwGTkMuASRT2n4OaC/WkxyuGU5t sKlzy9wTfyWdVPaKKXRt49SqJ4wKZZycHx0depkXrWjCQdW9+iWlhgFuiX0z+pWCTHQB 5goDqPj2+tRaTDQVYoaBZ79Xt3Nd/woTN3bEMh4hZjQWMaG1+kM/uN5w/4/SDXSFihRe D6Rp1XdC30s5f0E1cDa1StJVmH6+HcJHddmmP9rLI5sD9drdhzGus7L7zKMuUpe0Q9fg wKfvCiFzzCK6VkHYCFqkIkvScuDWNOX5XlbW++qBPGDNtPjiBUP53+fsta8wbn0SdTiq qyYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ta3Ko9zxfZ4eRR7LoDI2ksYw0ZQI5fINkcgZmVZuQY0=; b=vllbr6+cncxCvY1p6DifCo0nE+iGVt2+h4/BPiajusSuhPRO6kTI3BcbNQT+YsW8Uu qf7jBnU0+wkUByVDNh1xRhtobpNA/tfkb9OTEcnwZmv0ofygt78N7OcOb29/ZviWiIH9 jOX+Aw1GAjPCptvCzEH2S75ivxdSJvKdhrMNcigyt4Vdtx+UtveijzCIukeFmIYGk7vL DPtMAlJNg4d4pcVrXkuny7qb+SPx2O2KAKeMqACUEP66L9nct5bDGiRWYygm0EalSWTF RFECYzINdAmZRhcrz1lnP3C3CcgW3pJ+pfAedDk0SYJEM4TksdBPAEKPJCvISKW/aQMi edMQ== X-Gm-Message-State: AOAM531ODuDyRvxlgCl0QhNtgGUUowqqbRvt6tBLWBve6e3Vxz0wQ61Q Hcx2dRlUhipUslXDTgohCEGbAZsG3AvecQ== X-Received: by 2002:aa7:9481:0:b0:4ba:82e3:1964 with SMTP id z1-20020aa79481000000b004ba82e31964mr16300884pfk.4.1640034341144; Mon, 20 Dec 2021 13:05:41 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id d13sm20091021pfu.213.2021.12.20.13.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 13:05:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 13/24] linux-user/microblaze: Fix SIGFPE si_codes Date: Mon, 20 Dec 2021 13:05:17 -0800 Message-Id: <20211220210529.150423-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220210529.150423-1-richard.henderson@linaro.org> References: <20211220210529.150423-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Peter Maydell , laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Fix a typo for ESR_EC_DIVZERO, which is integral not floating-point. Fix the if ladder for decoding floating-point exceptions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 263b68aea1..cf1668a45f 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -77,15 +77,25 @@ void cpu_loop(CPUMBState *env) env->iflags &= ~(IMM_FLAG | D_FLAG); switch (env->esr & 31) { case ESR_EC_DIVZERO: - si_code = TARGET_FPE_FLTDIV; + si_code = TARGET_FPE_INTDIV; break; case ESR_EC_FPU: - si_code = 0; - if (env->fsr & FSR_IO) { + /* + * Note that the kernel passes along fsr as si_code + * if there's no recognized bit set. Possibly this + * implies that si_code is 0, but follow the structure. + */ + si_code = env->fsr; + if (si_code & FSR_IO) { si_code = TARGET_FPE_FLTINV; - } - if (env->fsr & FSR_DZ) { + } else if (si_code & FSR_OF) { + si_code = TARGET_FPE_FLTOVF; + } else if (si_code & FSR_UF) { + si_code = TARGET_FPE_FLTUND; + } else if (si_code & FSR_DZ) { si_code = TARGET_FPE_FLTDIV; + } else if (si_code & FSR_DO) { + si_code = TARGET_FPE_FLTRES; } break; default: