0102-target-riscv-fix-REQUIRE_ZFH-macro-bug.patch 1021 B

1234567891011121314151617181920212223242526272829303132
  1. From 9dee38536585ddbb681e3dd124e02c91fe93604e Mon Sep 17 00:00:00 2001
  2. From: Frank Chang <frank.chang@sifive.com>
  3. Date: Wed, 19 May 2021 11:42:06 +0800
  4. Subject: [PATCH 102/107] target/riscv: fix REQUIRE_ZFH() macro bug
  5. REQUIRE_ZFH() should return false only when ctx->ext_zfh is 0.
  6. It should not return the value of ctx->ext_zfh as it's just a
  7. check function.
  8. Signed-off-by: Frank Chang <frank.chang@sifive.com>
  9. ---
  10. target/riscv/insn_trans/trans_rvzfh.c.inc | 4 +++-
  11. 1 file changed, 3 insertions(+), 1 deletion(-)
  12. diff --git a/target/riscv/insn_trans/trans_rvzfh.c.inc b/target/riscv/insn_trans/trans_rvzfh.c.inc
  13. index 4c483f6372..0b91de5ae1 100644
  14. --- a/target/riscv/insn_trans/trans_rvzfh.c.inc
  15. +++ b/target/riscv/insn_trans/trans_rvzfh.c.inc
  16. @@ -17,7 +17,9 @@
  17. */
  18. #define REQUIRE_ZFH(ctx) do { \
  19. - return ctx->ext_zfh; \
  20. + if (ctx->ext_zfh == 0) { \
  21. + return false; \
  22. + } \
  23. } while (0)
  24. static bool trans_flh(DisasContext *ctx, arg_flh *a)
  25. --
  26. 2.33.1