[PATCH v4 07/19] target/ppc: Introduce REQUIRE_FPU

Luis Pires posted 19 patches 4 years, 3 months ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Luc Michel <luc@lmichel.fr>, Greg Kurz <groug@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, "Alex Bennée" <alex.bennee@linaro.org>, Damien Hedde <damien.hedde@greensocs.com>, Aurelien Jarno <aurelien@aurel32.net>
There is a newer version of this series
[PATCH v4 07/19] target/ppc: Introduce REQUIRE_FPU
Posted by Luis Pires 4 years, 3 months ago
From: Fernando Valle <fernando.valle@eldorado.org.br>

Signed-off-by: Fernando Valle <fernando.valle@eldorado.org.br>
Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/ppc/translate.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index c2fafebd1c..48a484eef6 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -7477,6 +7477,14 @@ static int times_4(DisasContext *ctx, int x)
         }                                               \
     } while (0)
 
+#define REQUIRE_FPU(ctx)                                \
+    do {                                                \
+        if (unlikely(!(ctx)->fpu_enabled)) {            \
+            gen_exception((ctx), POWERPC_EXCP_FPU);     \
+            return true;                                \
+        }                                               \
+    } while (0)
+
 /*
  * Helpers for implementing sets of trans_* functions.
  * Defer the implementation of NAME to FUNC, with optional extra arguments.
-- 
2.25.1