VirtualBox

Ignore:
Timestamp:
Oct 28, 2024 1:14:22 PM (3 months ago)
Author:
vboxsync
Message:

Disassembler: Decode SIMD ldr/str instructions, bugref:10394

File:
1 edited

Legend:

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

    r106744 r106746  
    106106static FNDISPARSEARMV8 disArmV8ParseFpScale;
    107107static FNDISPARSEARMV8 disArmV8ParseFpFixupFCvt;
     108static FNDISPARSEARMV8 disArmV8ParseSimdRegSize;
     109static FNDISPARSEARMV8 disArmV8ParseSimdRegSize64;
     110static FNDISPARSEARMV8 disArmV8ParseSimdRegSize128;
    108111static FNDISPARSEARMV8 disArmV8ParseSimdRegScalar;
    109112static FNDISPARSEARMV8 disArmV8ParseImmHImmB;
     
    161164    disArmV8ParseFpScale,
    162165    disArmV8ParseFpFixupFCvt,
     166    disArmV8ParseSimdRegSize,
     167    disArmV8ParseSimdRegSize64,
     168    disArmV8ParseSimdRegSize128,
    163169    disArmV8ParseSimdRegScalar,
    164170    disArmV8ParseImmHImmB,
     
    664670        case sizeof(uint32_t): pParam->armv8.u.offBase <<= 2; break;
    665671        case sizeof(uint64_t): pParam->armv8.u.offBase <<= 3; break;
     672        case 16:               pParam->armv8.u.offBase <<= 4; break;
    666673        default:
    667674            AssertReleaseFailed();
     
    874881
    875882
     883static int disArmV8ParseSimdRegSize(PDISSTATE pDis, uint32_t u32Insn, PCDISARMV8OPCODE pOp, PCDISARMV8INSNCLASS pInsnClass, PDISOPPARAM pParam, PCDISARMV8INSNPARAM pInsnParm, bool *pf64Bit)
     884{
     885    RT_NOREF(pOp, pInsnClass, pParam, pf64Bit);
     886
     887    Assert(pInsnParm->cBits == 2);
     888    uint32_t u32Size = disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits);
     889    switch (u32Size)
     890    {
     891        case 0: pDis->armv8.cbOperand = sizeof(uint8_t); break;
     892        case 1: pDis->armv8.cbOperand = sizeof(uint16_t); break;
     893        case 2: pDis->armv8.cbOperand = sizeof(uint32_t); break;
     894        case 3: pDis->armv8.cbOperand = sizeof(uint64_t); break;
     895        default:
     896            AssertReleaseFailed();
     897    }
     898
     899    return VINF_SUCCESS;
     900}
     901
     902
     903static int disArmV8ParseSimdRegSize64(PDISSTATE pDis, uint32_t u32Insn, PCDISARMV8OPCODE pOp, PCDISARMV8INSNCLASS pInsnClass, PDISOPPARAM pParam, PCDISARMV8INSNPARAM pInsnParm, bool *pf64Bit)
     904{
     905    RT_NOREF(u32Insn, pOp, pInsnClass, pParam, pInsnParm, pf64Bit);
     906
     907    pDis->armv8.cbOperand = sizeof(uint64_t);
     908    return VINF_SUCCESS;
     909}
     910
     911
     912static int disArmV8ParseSimdRegSize128(PDISSTATE pDis, uint32_t u32Insn, PCDISARMV8OPCODE pOp, PCDISARMV8INSNCLASS pInsnClass, PDISOPPARAM pParam, PCDISARMV8INSNPARAM pInsnParm, bool *pf64Bit)
     913{
     914    RT_NOREF(u32Insn, pOp, pInsnClass, pParam, pInsnParm, pf64Bit);
     915
     916    pDis->armv8.cbOperand = 16;
     917    return VINF_SUCCESS;
     918}
     919
     920
    876921static int disArmV8ParseSimdRegScalar(PDISSTATE pDis, uint32_t u32Insn, PCDISARMV8OPCODE pOp, PCDISARMV8INSNCLASS pInsnClass, PDISOPPARAM pParam, PCDISARMV8INSNPARAM pInsnParm, bool *pf64Bit)
    877922{
    878923    RT_NOREF(pDis, pOp, pInsnClass, pParam, pInsnParm, pf64Bit);
    879924
     925    Assert(pDis->armv8.cbOperand != 0);
    880926    Assert(pParam->armv8.enmType == kDisArmv8OpParmNone);
    881927
    882928    pParam->armv8.enmType = kDisArmv8OpParmReg;
    883929    pParam->armv8.Op.Reg.idReg = disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits);
    884     pParam->armv8.Op.Reg.enmRegType = kDisOpParamArmV8RegType_Simd_Scalar_64Bit;
     930    switch (pDis->armv8.cbOperand)
     931    {
     932        case sizeof(uint8_t):  pParam->armv8.Op.Reg.enmRegType = kDisOpParamArmV8RegType_Simd_Scalar_8Bit;   break;
     933        case sizeof(uint16_t): pParam->armv8.Op.Reg.enmRegType = kDisOpParamArmV8RegType_Simd_Scalar_16Bit;  break;
     934        case sizeof(uint32_t): pParam->armv8.Op.Reg.enmRegType = kDisOpParamArmV8RegType_Simd_Scalar_32Bit;  break;
     935        case sizeof(uint64_t): pParam->armv8.Op.Reg.enmRegType = kDisOpParamArmV8RegType_Simd_Scalar_64Bit;  break;
     936        case 16:               pParam->armv8.Op.Reg.enmRegType = kDisOpParamArmV8RegType_Simd_Scalar_128Bit; break;
     937    }
    885938    return VINF_SUCCESS;
    886939}
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