mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
hv_vm: Mask off operand size for store emulation
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
496516ded0
commit
4acc3d7c7f
1 changed files with 6 additions and 4 deletions
10
src/hv_vm.c
10
src/hv_vm.c
|
@ -581,17 +581,19 @@ static bool emulate_store(u64 *regs, u32 insn, u64 *val, u64 *width)
|
|||
|
||||
regs[31] = 0;
|
||||
|
||||
u64 mask = (1UL << (8 << *width)) - 1;
|
||||
|
||||
if ((insn & 0x3fe00400) == 0x38000400) {
|
||||
// STRx (immediate) Pre/Post-index
|
||||
CHECK_RN;
|
||||
regs[Rn] += imm9;
|
||||
*val = regs[Rt];
|
||||
*val = regs[Rt] & mask;
|
||||
} else if ((insn & 0x3fc00000) == 0x39000000) {
|
||||
// STRx (immediate) Unsigned offset
|
||||
*val = regs[Rt];
|
||||
*val = regs[Rt] & mask;
|
||||
} else if ((insn & 0x3fe04c00) == 0x38204800) {
|
||||
// STRx (register)
|
||||
*val = regs[Rt];
|
||||
*val = regs[Rt] & mask;
|
||||
} else if ((insn & 0xffc00000) == 0xa9000000) {
|
||||
// STP (Signed offset, 64-bit)
|
||||
CHECK_RN;
|
||||
|
@ -601,7 +603,7 @@ static bool emulate_store(u64 *regs, u32 insn, u64 *val, u64 *width)
|
|||
*width = 4;
|
||||
} else if ((insn & 0x3fe00c00) == 0x38000000) {
|
||||
// STURx (unscaled)
|
||||
*val = regs[Rt];
|
||||
*val = regs[Rt] & mask;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue