The branch main has been updated by mhorne:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cb923f03faa068f0c8ed5ffa7c3485ad7918be10

commit cb923f03faa068f0c8ed5ffa7c3485ad7918be10
Author:     Mykola Hohsadze <[email protected]>
AuthorDate: 2023-04-18 15:50:58 +0000
Commit:     Mitchell Horne <[email protected]>
CommitDate: 2023-04-25 20:23:15 +0000

    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
---
 sys/arm64/arm64/disassem.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/arm64/disassem.c b/sys/arm64/arm64/disassem.c
index 681164011b40..90ae51c5740c 100644
--- a/sys/arm64/arm64/disassem.c
+++ b/sys/arm64/arm64/disassem.c
@@ -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");

Reply via email to