qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix mtfsf, mtfsfi and mtfsb1 bug
@ 2021-11-18 13:24 Lucas Mateus Castro (alqotel)
  2021-11-18 13:25 ` [PATCH v2 1/3] target/ppc: Fixed call to deferred exception Lucas Mateus Castro (alqotel)
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Lucas Mateus Castro (alqotel) @ 2021-11-18 13:24 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc
  Cc: richard.henderson, danielhb413, mark.cave-ayland,
	Lucas Mateus Castro (alqotel), pc, david, matheus.ferst, clg

The instructions mtfsf, mtfsfi and mtfsb1, when called, fail to set the FI
bit (bit 46 in the FPSCR) and can set to 1 the reserved bit 52 of the
FPSCR, as reported in https://gitlab.com/qemu-project/qemu/-/issues/266
(although the bug report is only for mtfsf, the bug applies to mtfsfi and
mtfsb1 as well).

These instructions also fail to throw an exception when the exception
and enabling bits are set, this can be tested by adding
'prctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE);' before the __builtin_mtfsf
call in the test case of the bug report.

These patches aim to fix these issues.

Changes from v1:
- added a test for mtfsf (patch 3)
- moved "Resolves" to second patch
- removed gen_reset_fpstatus() from mtfsf,mtfsfi and mtfsb1 instructions

Lucas Mateus Castro (alqotel) (3):
  target/ppc: Fixed call to deferred exception
  target/ppc: ppc_store_fpscr doesn't update bit 52
  test/tcg/ppc64le: test mtfsf

 target/ppc/cpu.c                   |  2 +-
 target/ppc/cpu.h                   |  3 ++
 target/ppc/fpu_helper.c            | 41 ++++++++++++++++++++++
 target/ppc/helper.h                |  1 +
 target/ppc/translate/fp-impl.c.inc |  9 ++---
 tests/tcg/ppc64/Makefile.target    |  1 +
 tests/tcg/ppc64le/Makefile.target  |  1 +
 tests/tcg/ppc64le/mtfsf.c          | 56 ++++++++++++++++++++++++++++++
 8 files changed, 107 insertions(+), 7 deletions(-)
 create mode 100644 tests/tcg/ppc64le/mtfsf.c

-- 
2.31.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-19 17:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-18 13:24 [PATCH v2 0/3] Fix mtfsf, mtfsfi and mtfsb1 bug Lucas Mateus Castro (alqotel)
2021-11-18 13:25 ` [PATCH v2 1/3] target/ppc: Fixed call to deferred exception Lucas Mateus Castro (alqotel)
2021-11-19  9:18   ` Richard Henderson
2021-11-19  9:24     ` Cédric Le Goater
2021-11-19  9:48       ` Richard Henderson
2021-11-19 17:06     ` Lucas Mateus Martins Araujo e Castro
2021-11-18 13:25 ` [PATCH v2 2/3] target/ppc: ppc_store_fpscr doesn't update bit 52 Lucas Mateus Castro (alqotel)
2021-11-18 15:18   ` BALATON Zoltan
2021-11-19  9:21   ` Richard Henderson
2021-11-18 13:25 ` [PATCH v2 3/3] test/tcg/ppc64le: test mtfsf Lucas Mateus Castro (alqotel)
2021-11-19 10:00   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).