(still necessary?) translate: implement remap behavior for STORi with abs20

This commit is contained in:
fridtjof 2025-08-15 21:24:05 +02:00
parent a45d83e2ca
commit 5b25a18c95
2 changed files with 27 additions and 8 deletions

View file

@ -341,12 +341,12 @@ LOAD_abs 0000 0000 0001 0010 1011 .... .... .... .... .... .... ....
&stor rs ra dbase disp width
&stor_rrp rs rrp disp width
&stor_abs rs addr width
&stor_abs rs addr width remap
&stor_ind_abs rs ri addr width
&stor_imm imm ra dbase disp width
&stor_rrp_imm imm rrp disp width
&stor_abs_imm imm addr width
&stor_abs_imm imm addr width remap
&stor_abs_rrp_imm imm ri addr width
%stor_disp20 40:s4 16:s16
@ -358,10 +358,10 @@ LOAD_abs 0000 0000 0001 0010 1011 .... .... .... .... .... .... ....
@stor_disp20_reg .... .... .... .... .... .... rs:4 ra:4 .... .... .... .... disp=%stor_disp20 &stor
@stor_disp20_rrp .... .... .... .... .... .... rs:4 rrp:4 .... .... .... .... disp=%stor_disp20 &stor_rrp
@stor_disp20_rp .... .... .... .... .... .... rs:4 ra:4 .... .... .... .... disp=%stor_disp20 &stor
@stor_abs20 .... .... rs:4 .... .... .... .... .... addr=%addr_abs20 &stor_abs
@stor_abs20 .... .... rs:4 .... .... .... .... .... addr=%addr_abs20 remap=1 &stor_abs
@stor_ind_abs .... ... ri:1 rs:4 addr:20 &stor_ind_abs
@stor_disp4_reg .... .... rs:4 ra:4 &stor
@stor_abs24 .... .... .... .... .... .... rs:4 .... .... .... .... .... addr=%addr_disp24 &stor_abs
@stor_abs24 .... .... .... .... .... .... rs:4 .... .... .... .... .... addr=%addr_disp24 remap=0 &stor_abs
#@stord_disp14_rrp .... .... .... rrp:4 .... .... rs:4 .... disp=%stor_disp14 &stor_rrp
@stor_disp14_rrp_imm .... .... .... rrp:4 .... .... imm:4 .... disp=%stor_disp14 &stor_rrp_imm
@ -369,9 +369,9 @@ LOAD_abs 0000 0000 0001 0010 1011 .... .... .... .... .... .... ....
@stor_disp20_reg_imm .... .... .... .... .... .... imm:4 ra:4 .... .... .... .... disp=%stor_disp20 &stor_imm
@stor_disp20_rrp_imm .... .... .... .... .... .... imm:4 rrp:4 .... .... .... .... disp=%stor_disp20 &stor_rrp_imm
@stor_disp20_rp_imm .... .... .... .... .... .... imm:4 ra:4 .... .... .... .... disp=%stor_disp20 &stor_imm
@stor_abs_imm .... .... imm:4 addr:20 &stor_abs_imm
@stor_abs_imm .... .... imm:4 addr:20 remap=1 &stor_abs_imm
@stor_abs_rrp_imm .... ... ri:1 imm:4 addr:20 &stor_abs_rrp_imm
@stor_abs24_imm .... .... .... .... .... .... imm:4 .... .... .... .... .... addr=%addr_disp24 &stor_abs_imm
@stor_abs24_imm .... .... .... .... .... .... imm:4 .... .... .... .... .... addr=%addr_disp24 remap=0 &stor_abs_imm
{
STOR_rrp 1111 1110 rs:4 rrp:4 width=1 disp=0 &stor_rrp

View file

@ -1441,8 +1441,18 @@ static bool trans_STOR_rrp(DisasContext *ctx, arg_STOR_rrp *a) {
}
static bool trans_STOR_abs(DisasContext *ctx, arg_STOR_abs *a) {
int32_t addr = a->addr;
// Table 5-7 describes the addressing options for the
// first [single reg -> dest] and second [STORD] formats of the instruction.
// See Table 5-7, footnote f, which applies for abs20
if (a->remap) {
addr = addr > 0xEFFFF ? addr | 0xF00000 : addr;
}
gen_combine_rp(a->rs, a->width);
tcg_gen_qemu_st_i32(r[a->rs], tcg_constant_i32(a->addr), 0, unsigned_op_by_width[a->width]);
tcg_gen_qemu_st_i32(r[a->rs], tcg_constant_i32(addr), 0, unsigned_op_by_width[a->width]);
return true;
}
@ -1457,7 +1467,16 @@ static bool trans_STOR_ind_abs(DisasContext *ctx, arg_STOR_ind_abs *a) {
}
static bool trans_STOR_abs_imm(DisasContext *ctx, arg_STOR_abs_imm *a) {
tcg_gen_qemu_st_i32(tcg_constant_i32(a->imm), tcg_constant_i32(a->addr), 0, unsigned_op_by_width[a->width]);
int32_t addr = a->addr;
// Table 5-4 describes the addressing options for the
// third [imm -> dest] format of the instruction.
// See Table 5-4, footnote e, which applies for abs20
if (a->remap) {
addr = addr > 0xEFFFF ? addr | 0xF00000 : addr;
}
tcg_gen_qemu_st_i32(tcg_constant_i32(a->imm), tcg_constant_i32(addr), 0, unsigned_op_by_width[a->width]);
return true;
}