From patchwork Sun Aug 22 03:55:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501423 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1068407jab; Sat, 21 Aug 2021 21:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBs6Pq34iX0mPN3kfa16M03DMmKt5Vix6fN+zNBf0fHk9WLbdABktCPWydhUm4ru+Dral/ X-Received: by 2002:a25:37c7:: with SMTP id e190mr17234271yba.519.1629605987146; Sat, 21 Aug 2021 21:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605987; cv=none; d=google.com; s=arc-20160816; b=bGfmTrZkHAXvxt0uboEE2MnBVIV6HeNGpShQM+p24UMLcDWTYbfsjgFQqheCWcmGgL wUc5ecsf10yuL8lBk3Pz1lTb8IzrxNyvEq3pDqvk+/yhjUusCXxfy16H8II4G3jeQbvH 94hZ9jxh9715USjUziPFfE0Yk+ObdnX+wbck+cWTAdFvgDGmodu6zWsKT/mHh9LvDcvJ BdOp8HjjDTsgQqg51FXU9DHCzONBfLMbi6QEXnfP7SuHsgJuMgsWer8td+GeedSE5hpM yN0JmRpUqRWPvgHecZpef2W4k7AiNS0GQ+9G2lLSXENUJcoDZVzqP5T2vwe8J15lyJrU m5Uw== 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=V4ABiYbSFXZhLI78uqHDE/IKCat0vkJCalHfW7nxEF0=; b=RsdBbMigoW2FaUzoKLXwUSNlJj6DrS5OjiCOVazR4ogIwCDLWjbkvqhbvN2TB+P+KT YeEvZgwNRIqpDW+5+OXuMSWiVOudad0krnWmo8VQyYioasTGYFROo/QVRRE1k1q8W/Sd ef3ElGmsIAi4BGXTIv4qyGorisBa8lSRQKeYjJZcrpyhu3LSokKujnciFPS3CcdO8uYe hKXBrpX+c4Hy+zkdxWwCYd0cXCk/6fltMMxxbmpWldfU83vxosITStjAgzFPrf202+1x ABy53wkwpyddDZ8JwMRfRWVL4zRCFSclg4sKFxoGHLsueQSI0AQALGic8yjU3GMzHaVQ CPWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kq8r5nzY; 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 t15si8806074ybp.284.2021.08.21.21.19.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:19:47 -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=Kq8r5nzY; 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]:43166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHexW-0007GD-I6 for patch@linaro.org; Sun, 22 Aug 2021 00:19:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0007tQ-D5 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:35548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaP-0000jS-Q0 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:55 -0400 Received: by mail-pg1-x536.google.com with SMTP id e7so13334123pgk.2 for ; Sat, 21 Aug 2021 20:55:53 -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=V4ABiYbSFXZhLI78uqHDE/IKCat0vkJCalHfW7nxEF0=; b=Kq8r5nzYbdmfv1JWiEddnS4y948QncZZa9UzDyipdzH3flWX29k+/DkYMi/ufqYcSZ h/mLflqbN0ccYh+3S1AC/cg6NgXNcibmUZxldbtC+IJjhzN8YsPUkYIumy7NMrSd/WKS PJ9dqNzy6qEKGminyiVtOYLJYEM1mOpzvo2ZcoMUhg+mavWDOtpdUnNpVtkS5UQRxcXm nowufJUD83BUuGbY6Zn5KhWotuh0aIAKFyMR/jZWy2LDhPTwnOvIAvhtjIP90kvlFAJS 3Jx93QGJUuK9SZSUQL6pDhu6n7mjc1uq0gDYaCfYFr0qyhxLh9a5W5XDLqTFluFK2pvz 2MtQ== 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=V4ABiYbSFXZhLI78uqHDE/IKCat0vkJCalHfW7nxEF0=; b=JMr1KLEDFq9DGytkgO9LwxgrOnbrP3XXyf7ovkm6sFsz3ZgXimvrZTkHAVuYiWwYlI h6jKDXrA0T7NYt3daUhgGUzbPFxSOdg33S8HsYMdHURdKwgQVFszf9ea49UDXicnHbut JZmCwWhRcwnp729CQcj1AtPdarcDnJBwtsjvooteLnHi+AdCizfKzWeL1KvjAqc1gX43 Tdx71z/NJa+yRXNK2KlkPhJyV4HFLoxwV7cmKgIiQuqsQ4SFP32Uzpo0ODHlay6CXpGQ qX4xIoI3pSKCvKnnBGy4sqXk4XqYclCPPgxJ3TH6ZhF8DhnxbKxXWlgcDjwwtewDLi7S 71tg== X-Gm-Message-State: AOAM530YAymUcIE7wzpbI9+23/W54xEGnqW3WZkWNneNFvLL+yxVjxzt X4o3D3mSXW68BohiOmKncHQgfRZx7rAlEg== X-Received: by 2002:a65:4203:: with SMTP id c3mr25638480pgq.309.1629604552594; Sat, 21 Aug 2021 20:55:52 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 21/30] linux-user/microblaze: Fix SIGFPE si_codes Date: Sat, 21 Aug 2021 20:55:28 -0700 Message-Id: <20210822035537.283193-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, 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. Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 9e07e52573..4a75c853b2 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -81,15 +81,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: