On 7/19/2026 4:31 PM, Taylor Simpson wrote:
On Wed, Jul 15, 2026 at 12:57 PM Brian Cain
<[email protected]> wrote:
Add hex_next_PC, a global mirroring CPUHexagonState::next_PC,
and ctx->need_next_pc, so that gen_write_new_pc_addr() can write the
branch target through hex_next_PC instead of hex_gpr[HEX_REG_PC]
when a later unconditional write of PC is expected. gen_end_tb()
then commits hex_next_PC into hex_gpr[HEX_REG_PC] at the end of the
packet.
Previously, non-COF instructions that still end a TB did not
advance the
PC, since next_PC's value was never written back into the PC register.
Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Brian Cain <[email protected]>
---
target/hexagon/translate.h | 3 +++
target/hexagon/genptr.c | 14 ++++++++---
target/hexagon/translate.c | 51
++++++++++++++++++++++++++------------
3 files changed, 49 insertions(+), 19 deletions(-)
@@ -1327,6 +1344,8 @@ void hexagon_translate_init(void)
}
hex_new_value_usr = tcg_global_mem_new(tcg_env,
offsetof(CPUHexagonState, new_value_usr), "new_value_usr");
+ hex_next_PC = tcg_global_mem_new(tcg_env,
+ offsetof(CPUHexagonState, next_PC), "next_PC");
This only lives within the context of a single packet, so it shouldn't
be global.
Put it into DisasContext and make it a tmp similar to new_value.
Taylor - this patch was included for the sake of testing the l2vic
series, but landed recently -
https://lore.kernel.org/qemu-devel/20260720100107.GA816167@fedora/
So I'll send a new independent series with updates suggested for
"target/hexagon: fix PC not advancing for non-COF TB-ending packets" and
"target/hexagon: initialize deferred sreg-write temps to current value".
-Brian