Skip to content

Commit

Permalink
target/hppa: exit tb on flush cache instructions
Browse files Browse the repository at this point in the history
When the guest modifies the tb it is currently executing from,
it executes a fic instruction. Exit the tb on such instruction,
otherwise we might execute stale code.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Message-Id: <20240319161921.487080-5-svens@stackframe.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit ad1fdac)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
svenschnelle authored and Michael Tokarev committed Mar 21, 2024
1 parent 4dbeff3 commit e3b3cff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions target/hppa/insns.decode
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ getshadowregs 1111 1111 1111 1101 1110 1010 1101 0010
nop 000001 ----- ----- -- 11001010 0 ----- # fdc, disp
nop_addrx 000001 ..... ..... -- 01001010 . ----- @addrx # fdc, index
nop_addrx 000001 ..... ..... -- 01001011 . ----- @addrx # fdce
nop_addrx 000001 ..... ..... --- 0001010 . ----- @addrx # fic 0x0a
nop_addrx 000001 ..... ..... -- 01001111 . 00000 @addrx # fic 0x4f
nop_addrx 000001 ..... ..... --- 0001011 . ----- @addrx # fice
fic 000001 ..... ..... --- 0001010 . ----- @addrx # fic 0x0a
fic 000001 ..... ..... -- 01001111 . 00000 @addrx # fic 0x4f
fic 000001 ..... ..... --- 0001011 . ----- @addrx # fice
nop_addrx 000001 ..... ..... -- 01001110 . 00000 @addrx # pdc

probe 000001 b:5 ri:5 sp:2 imm:1 100011 write:1 0 t:5
Expand Down
7 changes: 7 additions & 0 deletions target/hppa/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,13 @@ static bool trans_nop_addrx(DisasContext *ctx, arg_ldst *a)
return true;
}

static bool trans_fic(DisasContext *ctx, arg_ldst *a)
{
/* End TB for flush instruction cache, so we pick up new insns. */
ctx->base.is_jmp = DISAS_IAQ_N_STALE;
return trans_nop_addrx(ctx, a);
}

static bool trans_probe(DisasContext *ctx, arg_probe *a)
{
TCGv_i64 dest, ofs;
Expand Down

0 comments on commit e3b3cff

Please sign in to comment.