VirtualBox

Changeset 106706 in vbox for trunk/src/VBox/Disassembler


Ignore:
Timestamp:
Oct 25, 2024 3:43:05 PM (3 months ago)
Author:
vboxsync
Message:

Disassembler: Decode 3-source register data processing instructions, bugref:10394

Location:
trunk/src/VBox/Disassembler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Disassembler/DisasmTables-armv8-a64.cpp

    r106705 r106706  
    804804
    805805
     806/* MADD/MSUB (32-bit) */
     807DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_DECODER(Reg3Src32)
     808    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr32,        0,  5, 0 /*idxParam*/),
     809    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr32,        5,  5, 1 /*idxParam*/),
     810    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr32,       16,  5, 2 /*idxParam*/),
     811    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr32,       10,  5, 3 /*idxParam*/),
     812DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_BEGIN(Reg3Src32)
     813    DIS_ARMV8_OP(0x1b000000, "madd",            OP_ARMV8_A64_MADD,      DISOPTYPE_HARMLESS),
     814    DIS_ARMV8_OP(0x1b008000, "msub",            OP_ARMV8_A64_MSUB,      DISOPTYPE_HARMLESS),
     815DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_END(Reg3Src32, 0xffe08000 /*fFixedInsn*/, kDisArmV8OpcDecodeNop,
     816                                       RT_BIT_32(15), 15);
     817
     818
     819/* MADD/MSUB (64-bit) /SMADDL/SMSUBL/SMULH/UMADDL/UMSUBL/UMULH */
     820DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_DECODER(Reg3Src64)
     821    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,        0,  5, 0 /*idxParam*/),
     822    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,        5,  5, 1 /*idxParam*/),
     823    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,       16,  5, 2 /*idxParam*/),
     824    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,       10,  5, 3 /*idxParam*/),
     825DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_DECODER_ALTERNATIVE(Reg3Src64_32)
     826    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,        0,  5, 0 /*idxParam*/),
     827    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr32,        5,  5, 1 /*idxParam*/),
     828    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr32,       16,  5, 2 /*idxParam*/),
     829    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,       10,  5, 3 /*idxParam*/),
     830DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_DECODER_ALTERNATIVE(Reg3Src64Mul) /** @todo Ra == 11111 (or is it ignored?) */
     831    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,        0,  5, 0 /*idxParam*/),
     832    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,        5,  5, 1 /*idxParam*/),
     833    DIS_ARMV8_INSN_DECODE(kDisParmParseGprZr64,       16,  5, 2 /*idxParam*/),
     834DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_BEGIN(Reg3Src64)
     835    DIS_ARMV8_OP(           0x9b000000, "madd",            OP_ARMV8_A64_MADD,      DISOPTYPE_HARMLESS),
     836    DIS_ARMV8_OP(           0x9b008000, "msub",            OP_ARMV8_A64_MSUB,      DISOPTYPE_HARMLESS),
     837    DIS_ARMV8_OP_ALT_DECODE(0x9b200000, "smaddl",          OP_ARMV8_A64_SMADDL,    DISOPTYPE_HARMLESS, Reg3Src64_32),
     838    DIS_ARMV8_OP_ALT_DECODE(0x9b208000, "smsubl",          OP_ARMV8_A64_SMSUBL,    DISOPTYPE_HARMLESS, Reg3Src64_32),
     839    DIS_ARMV8_OP_ALT_DECODE(0x9b400000, "smulh",           OP_ARMV8_A64_SMULH,     DISOPTYPE_HARMLESS, Reg3Src64Mul),
     840    INVALID_OPCODE,
     841    INVALID_OPCODE,
     842    INVALID_OPCODE,
     843    INVALID_OPCODE,
     844    INVALID_OPCODE,
     845    DIS_ARMV8_OP_ALT_DECODE(0x9ba00000, "umaddl",          OP_ARMV8_A64_UMADDL,    DISOPTYPE_HARMLESS, Reg3Src64_32),
     846    DIS_ARMV8_OP_ALT_DECODE(0x9ba08000, "umsubl",          OP_ARMV8_A64_UMSUBL,    DISOPTYPE_HARMLESS, Reg3Src64_32),
     847    DIS_ARMV8_OP_ALT_DECODE(0x9bc00000, "umulh",           OP_ARMV8_A64_UMULH,     DISOPTYPE_HARMLESS, Reg3Src64Mul),
     848DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_END(Reg3Src64, 0xffe08000 /*fFixedInsn*/, kDisArmV8OpcDecodeCollate,
     849                                       RT_BIT_32(15) | RT_BIT_32(21) | RT_BIT_32(22) | RT_BIT_32(23), 15);
     850
     851
     852/**
     853 * C4.1.95.12 - Data Processing - Register - 3-source
     854 *
     855 * We differentiate further based on SF because there are different instructions encoded
     856 * for 32-bit and 64-bit.
     857 */
     858DIS_ARMV8_DECODE_MAP_DEFINE_BEGIN(Reg3Src)
     859    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src32),        /* 3-source 32-bit */
     860    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src64),        /* 3-source 64-bit */
     861DIS_ARMV8_DECODE_MAP_DEFINE_END_SINGLE_BIT(Reg3Src, 31);
     862
     863
    806864/*
    807865 * C4.1.95 - Data Processing - Register
     
    831889    DIS_ARMV8_DECODE_MAP_ENTRY(Reg2Src1Src),
    832890    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,
    833     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    834     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    835     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    836     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    837     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    838     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    839     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
    840     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     891    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     892    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     893    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     894    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     895    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     896    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     897    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
     898    DIS_ARMV8_DECODE_MAP_ENTRY(Reg3Src),
    841899DIS_ARMV8_DECODE_MAP_DEFINE_END(DataProcReg, RT_BIT_32(21) | RT_BIT_32(22) | RT_BIT_32(23) | RT_BIT_32(24), 21);
    842900
  • trunk/src/VBox/Disassembler/testcase/tstDisasmArmv8-1-asm.S

    r106705 r106706  
    515515        csneg wzr, w1, w2, eq
    516516
     517        madd wzr, w0, w1, w2
     518        madd xzr, x0, x1, x2
     519
     520        msub wzr, w0, w1, w2
     521        msub xzr, x0, x1, x2
     522
     523        smaddl xzr, w0, w1, x2
     524        smsubl xzr, w0, w1, x2
     525        umaddl xzr, w0, w1, x2
     526        umsubl xzr, w0, w1, x2
     527
     528        smulh  xzr, x1, x2
     529        umulh  xzr, x1, x2
     530
     531
    517532        ; Memory loads
    518533        ldrb w0, [x28]
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette