Skip to content

Commit c1776a9

Browse files
committed
fix opcodes not emulated
Signed-off-by: R <[email protected]>
1 parent d7bf521 commit c1776a9

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/hv_vm.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,8 @@ static bool emulate_store(struct exc_info *ctx, u32 insn, u64 *val, u64 *width)
644644

645645
regs[31] = 0;
646646

647+
union simd_reg simd[32];
648+
647649
u64 mask = 0xffffffffffffffffUL;
648650

649651
if (*width < 3)
@@ -657,6 +659,12 @@ static bool emulate_store(struct exc_info *ctx, u32 insn, u64 *val, u64 *width)
657659
} else if ((insn & 0x3fc00000) == 0x39000000) {
658660
// STRx (immediate) Unsigned offset
659661
*val = regs[Rt] & mask;
662+
} else if ((insn & 0x3fc00000) == 0x3d800000) {
663+
// STR Q (immediate) Unsigned offset, SIMD&FP, 128-bit
664+
get_simd_state(simd);
665+
val[0] = simd[Rt].d[0];
666+
val[1] = simd[Rt].d[1];
667+
*width = 4;
660668
} else if ((insn & 0x3fe04c00) == 0x38204800) {
661669
// STRx (register)
662670
*val = regs[Rt] & mask;
@@ -667,6 +675,16 @@ static bool emulate_store(struct exc_info *ctx, u32 insn, u64 *val, u64 *width)
667675
val[0] = regs[Rt];
668676
val[1] = regs[Rt2];
669677
*width = 4;
678+
} else if ((insn & 0xffc00000) == 0xad000000) {
679+
// STP (Signed offset, SIMD&FP), 256-bit
680+
CHECK_RN;
681+
get_simd_state(simd);
682+
u64 Rt2 = (insn >> 10) & 0x1f;
683+
val[0] = simd[Rt].d[0];
684+
val[1] = simd[Rt].d[1];
685+
val[2] = simd[Rt2].d[0];
686+
val[3] = simd[Rt2].d[1];
687+
*width = 4;
670688
} else if ((insn & 0x3fe00c00) == 0x38000000) {
671689
// STURx (unscaled)
672690
*val = regs[Rt] & mask;
@@ -837,7 +855,7 @@ bool hv_handle_dabort(struct exc_info *ctx)
837855
}
838856

839857
u32 insn = read32(elr_pa);
840-
u64 val[2] = {0, 0};
858+
u64 val[4] = {0, 0, 0, 0};
841859
u64 width;
842860

843861
hv_wdt_breadcrumb('2');

0 commit comments

Comments
 (0)