On Thu, 26 Feb 2026 at 10:33, Alex Bennée <[email protected]> wrote:
>
> Peter Maydell <[email protected]> writes:
>
> > On Tue, 24 Feb 2026 at 15:43, Alex Bennée <[email protected]> wrote:
> >>
> >> If we generate an exception for WFIT we could also fill out the rv/rn
> >> fields of the ISS. To facilitate this pass the register number
> >> directly and read the timeout value in the helper itself.
> >>
> >> Signed-off-by: Alex Bennée <[email protected]>
> >> ---
> >>  target/arm/tcg/helper-defs.h   | 2 +-
> >>  target/arm/tcg/op_helper.c     | 4 +++-
> >>  target/arm/tcg/translate-a64.c | 2 +-
> >>  3 files changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/target/arm/tcg/helper-defs.h b/target/arm/tcg/helper-defs.h
> >> index 5a10a9fba3b..a9a062cf777 100644
> >> --- a/target/arm/tcg/helper-defs.h
> >> +++ b/target/arm/tcg/helper-defs.h
> >> @@ -55,7 +55,7 @@ DEF_HELPER_2(exception_pc_alignment, noreturn, env, 
> >> vaddr)
> >>  DEF_HELPER_1(setend, void, env)
> >>  DEF_HELPER_2(wfi, void, env, i32)
> >>  DEF_HELPER_1(wfe, void, env)
> >> -DEF_HELPER_2(wfit, void, env, i64)
> >> +DEF_HELPER_FLAGS_2(wfit, TCG_CALL_NO_WG, void, env, i32)
> >
> > Why the change to NO_WG ? The code change doesn't remove any
> > writes to globals...
>
> I thought that was the right way round - it doesn't write to any
> globals, but it does read so the helper needs to ensure globals are
> synced before the callback.

The default if you use a DEF_HELPER macro that doesn't specify
flags is "reading and writing to globals is OK" (it's a zero
flags argument). So this change goes from "flags 0" to "flags NO_WG"
and doesn't make any difference to how TCG thinks of its behaviour
w.r.t. reading globals.

I think you're right that the helper doesn't need to be able to write
globals, but making a stricter promise about what the helper does is
something that's a distinct change from adding the rn info to the syndrome.

-- PMM

Reply via email to