VirtualBox

Changeset 105810 in vbox for trunk/src


Ignore:
Timestamp:
Aug 22, 2024 8:26:22 AM (9 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164523
Message:

Disassembler/ARMv8: Implement disassembly of ccmp/ccmn register variants and add testcases, bugref:10394

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

Legend:

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

    r105806 r105810  
    301301{
    302302    RT_NOREF(pInsnClass, pParam, pf64Bit);
    303     pDis->armv8.enmCond = (DISARMV8INSTRCOND)disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits);
     303    Assert(pInsnParm->cBits <= 4);
     304    if (pParam)
     305    {
     306        /* Conditional as a parameter (CCMP/CCMN). */
     307        Assert(pParam->armv8.enmType == kDisArmv8OpParmCond);
     308        pParam->armv8.Reg.enmCond = (DISARMV8INSTRCOND)disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits);
     309    }
     310    else /* Conditional for the base instruction. */
     311        pDis->armv8.enmCond = (DISARMV8INSTRCOND)disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits);
    304312    return VINF_SUCCESS;
    305313}
  • trunk/src/VBox/Disassembler/DisasmFormatArmV8.cpp

    r105794 r105810  
    730730                    break;
    731731                }
     732                case kDisArmv8OpParmCond:
     733                {
     734                    Assert((uint16_t)pParam->armv8.Reg.enmCond < RT_ELEMENTS(g_aszArmV8Cond));
     735                    PUT_STR(g_aszArmV8Cond[pParam->armv8.Reg.enmCond], sizeof(g_aszArmV8Cond[0]) - 1);
     736                    break;
     737                }
    732738                default:
    733739                    AssertFailed();
  • trunk/src/VBox/Disassembler/DisasmTables-armv8-a64.cpp

    r105808 r105810  
    463463
    464464
    465 
    466465DIS_ARMV8_DECODE_MAP_DEFINE_BEGIN(AddSubExtReg)
    467466    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY, /** @todo */
     
    481480
    482481
     482/* CCMN/CCMP */
     483DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_BEGIN(CondCmpReg)
     484    DIS_ARMV8_OP(0x3a400000, "ccmn",            OP_ARMV8_A64_CCMN,      DISOPTYPE_HARMLESS),
     485    DIS_ARMV8_OP(0x7a400000, "ccmp",            OP_ARMV8_A64_CCMP,      DISOPTYPE_HARMLESS)
     486DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_DECODER(CondCmpReg)
     487    DIS_ARMV8_INSN_DECODE(kDisParmParseReg,            5,  5, 0 /*idxParam*/),
     488    DIS_ARMV8_INSN_DECODE(kDisParmParseReg,           16,  5, 1 /*idxParam*/),
     489    DIS_ARMV8_INSN_DECODE(kDisParmParseImm,            0,  4, 2 /*idxParam*/),
     490    DIS_ARMV8_INSN_DECODE(kDisParmParseCond,          12,  4, 3 /*idxParam*/),
     491DIS_ARMV8_DECODE_INSN_CLASS_DEFINE_END_PARAMS_4(CondCmpReg, 0x7fe00c10 /*fFixedInsn*/, DISARMV8INSNCLASS_F_SF,
     492                                                kDisArmV8OpcDecodeNop, RT_BIT_32(30), 30,
     493                                                kDisArmv8OpParmGpr, kDisArmv8OpParmGpr, kDisArmv8OpParmImm, kDisArmv8OpParmCond);
     494
     495
     496/**
     497 * C4.1.95 - Data Processing - Register
     498 *
     499 * The conditional compare instructions differentiate between register and immediate
     500 * variant based on the 11th bit (part of op3).
     501 */
     502DIS_ARMV8_DECODE_MAP_DEFINE_BEGIN(CondCmp)
     503    DIS_ARMV8_DECODE_MAP_ENTRY(CondCmpReg),          /* Conditional compare register */
     504    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,              /** @todo Conditional compare immediate */
     505DIS_ARMV8_DECODE_MAP_DEFINE_END(CondCmp, RT_BIT_32(11), 11);
     506
     507
     508/*
     509 * C4.1.95 - Data Processing - Register
     510 *
     511 * The op1 field is already decoded in the previous step and is 1 when being here,
     512 * leaving us with the following possible values:
     513 *
     514 *     Bit  24 23 22 21
     515 *     +-------------------------------------------
     516 *           0  0  0  0 Add/subtract with carry / Rotate right into flags / Evaluate into flags (depending on op3)
     517 *           0  0  0  1 UNALLOC
     518 *           0  0  1  0 Conditional compare (register / immediate)
     519 *           0  0  1  1 UNALLOC
     520 *           0  1  0  0 Conditional select
     521 *           0  1  0  1 UNALLOC
     522 *           0  1  1  0 Data processing (2-source or 1-source depending on op0).
     523 *           0  1  1  1 UNALLOC
     524 *           1  x  x  x Data processing 3-source
     525 */
    483526DIS_ARMV8_DECODE_MAP_DEFINE_BEGIN(DataProcReg)
    484     DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,
    485 DIS_ARMV8_DECODE_MAP_DEFINE_END(DataProcReg, RT_BIT_32(24), 24);
     527    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Add/subtract with carry. */
     528    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,
     529    DIS_ARMV8_DECODE_MAP_ENTRY(CondCmp),            /** @todo Conditional compare. */
     530    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,
     531    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Conditional select. */
     532    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,
     533    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 2-source/1-source. */
     534    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,
     535    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     536    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     537    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     538    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     539    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     540    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     541    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     542    DIS_ARMV8_DECODE_MAP_INVALID_ENTRY,             /** @todo Data Processing 3-source. */
     543DIS_ARMV8_DECODE_MAP_DEFINE_END(DataProcReg, RT_BIT_32(21) | RT_BIT_32(22) | RT_BIT_32(23) | RT_BIT_32(24), 21);
    486544
    487545
  • trunk/src/VBox/Disassembler/testcase/tstDisasmArmv8-1-asm.S

    r105796 r105810  
    390390        str w0, [x28, #16380]
    391391
     392        ; Conditional compare
     393        ccmp x0, x1, #0x3, eq
     394        ccmp w0, w1, #0xf, eq
     395        ccmp x0, x1, #0x3, ne
     396        ccmp w0, w1, #0xf, ne
     397        ccmp x0, x1, #0x3, cs
     398        ccmp w0, w1, #0xf, cc
     399        ccmp x0, x1, #0x3, mi
     400        ccmp w0, w1, #0xf, mi
     401        ccmp x0, x1, #0x3, pl
     402        ccmp w0, w1, #0xf, vs
     403        ccmp x0, x1, #0x3, vc
     404        ccmp w0, w1, #0xf, vc
     405        ccmp x0, x1, #0x3, hi
     406        ccmp w0, w1, #0xf, hi
     407        ccmp x0, x1, #0x3, ls
     408        ccmp w0, w1, #0xf, ls
     409        ccmp x0, x1, #0x3, ge
     410        ccmp w0, w1, #0xf, ge
     411        ccmp x0, x1, #0x3, lt
     412        ccmp w0, w1, #0xf, lt
     413        ccmp x0, x1, #0x3, gt
     414        ccmp w0, w1, #0xf, gt
     415        ccmp x0, x1, #0x3, le
     416        ccmp w0, w1, #0xf, le
     417        ccmp x0, x1, #0x3, al
     418        ccmp w0, w1, #0xf, al
     419
     420        ccmn x0, x1, #0x3, eq
     421        ccmn w0, w1, #0xf, eq
     422        ccmn x0, x1, #0x3, ne
     423        ccmn w0, w1, #0xf, ne
     424        ccmn x0, x1, #0x3, cs
     425        ccmn w0, w1, #0xf, cc
     426        ccmn x0, x1, #0x3, mi
     427        ccmn w0, w1, #0xf, mi
     428        ccmn x0, x1, #0x3, pl
     429        ccmn w0, w1, #0xf, vs
     430        ccmn x0, x1, #0x3, vc
     431        ccmn w0, w1, #0xf, vc
     432        ccmn x0, x1, #0x3, hi
     433        ccmn w0, w1, #0xf, hi
     434        ccmn x0, x1, #0x3, ls
     435        ccmn w0, w1, #0xf, ls
     436        ccmn x0, x1, #0x3, ge
     437        ccmn w0, w1, #0xf, ge
     438        ccmn x0, x1, #0x3, lt
     439        ccmn w0, w1, #0xf, lt
     440        ccmn x0, x1, #0x3, gt
     441        ccmn w0, w1, #0xf, gt
     442        ccmn x0, x1, #0x3, le
     443        ccmn w0, w1, #0xf, le
     444        ccmn x0, x1, #0x3, al
     445        ccmn w0, w1, #0xf, al
     446
    392447        ;
    393448        ; Keep last so the testcase can catch errors in
Note: See TracChangeset for help on using the changeset viewer.

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