arm64/disassem.c: Fix typo sxts to sxts and amount for TYPE_02

The current implementation is wrong, since it unconditionally sets the
amount equal to the <size> field of the instruction. However, when the
<S> bit (scale) is not set, it must be zero.

Also fix a typo, sxts to sxtx, according to the Arm64 documentation.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39334
This commit is contained in:
Mykola Hohsadze 2023-04-18 12:50:58 -03:00 committed by Mitchell Horne
parent 5b61ad4b00
commit cb923f03fa

View File

@ -503,9 +503,13 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt)
arm64_reg(sf, rt), arm64_reg(1, rn),
arm64_reg(option & 1, rm));
/* Calculate amount, it's op(31:30) */
amount = (insn >> ARM_INSN_SIZE_OFFSET) &
ARM_INSN_SIZE_MASK;
if (scale == 0)
amount = 0;
else {
/* Calculate amount, it's op(31:30) */
amount = (insn >> ARM_INSN_SIZE_OFFSET) &
ARM_INSN_SIZE_MASK;
}
switch (option) {
case 0x2:
@ -519,7 +523,7 @@ disasm(const struct disasm_interface *di, vm_offset_t loc, int altfmt)
di->di_printf(", sxtw #%d", amount);
break;
case 0x7:
di->di_printf(", sxts #%d", amount);
di->di_printf(", sxtx #%d", amount);
break;
default:
di->di_printf(", RSVD");