VirtualBox

Changeset 65926 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Mar 3, 2017 11:00:27 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113744
Message:

IEM: Started on generating tests from instruction specs.

Location:
trunk/src/VBox/ValidationKit/bootsectors
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/Makefile.kmk

    r65893 r65926  
    317317MISCBINS += bs3-cpu-generated-1
    318318bs3-cpu-generated-1_TEMPLATE = VBoxBS3KitImg
    319 bs3-cpu-generated-1_INCS  = .
     319bs3-cpu-generated-1_INCS = .
     320bs3-cpu-generated-1_DEFS = BS3_CMN_INSTANTIATE_FILE1=bs3-cpu-generated-1-template.c
    320321bs3-cpu-generated-1_SOURCES = \
    321322        bs3kit/bs3-first-rm.asm \
    322323        bs3-cpu-generated-1.c \
    323         bs3-cpu-generated-1-asm.asm
     324        bs3-cpu-generated-1-asm.asm \
     325       bs3kit/bs3-cmn-instantiate.c16 \
     326       bs3kit/bs3-cmn-instantiate.c32 \
     327       bs3kit/bs3-cmn-instantiate.c64 \
     328        $(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-data.c16
     329bs3-cpu-generated-1_CLEAN = $(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-data.c16
     330
    324331bs3-cpu-generated-1-template.o:: \
     332        $$(bs3-cpu-generated-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o16 \
     333        $$(bs3-cpu-generated-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o32 \
     334        $$(bs3-cpu-generated-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o64 \
    325335        $$(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-asm.o16
    326336
     337$$(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-data.c16: \
     338                $(PATH_SUB_CURRENT)/bs3-cpu-generated-1-data.py \
     339                $(PATH_SUB_CURRENT)/../../VMM/VMMAll/IEMAllInstructionsPython.py \
     340                $(PATH_SUB_CURRENT)/../../VMM/VMMAll/IEMAllInstructions*.cpp.h \
     341               | $$(dir $$@)
     342        $(VBOX_BLD_PYTHON) $< $@
     343
    327344endif # VBOX_WITH_BS3KIT
    328345
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1.h

    r65903 r65926  
    3333
    3434
    35 
    36 /** Instruction encoding format. */
     35/**
     36 * Operand details.
     37 *
     38 * Currently simply using the encoding from the reference manuals.
     39 */
     40typedef enum BS3CG1OP
     41{
     42    BS3CG1OP_INVALID = 0,
     43
     44    BS3CG1OP_Eb,
     45    BS3CG1OP_Ev,
     46
     47    BS3CG1OP_Gb,
     48    BS3CG1OP_Gv,
     49
     50    BS3CG1OP_END
     51} BS3CG1OP;
     52/** Pointer to a const operand enum. */
     53typedef const BS3_FAR *PCBS3CG1OP;
     54
     55
     56/**
     57 * Instruction encoding format.
     58 *
     59 * This duplicates some of the info in the operand array, however it makes it
     60 * easier to figure out encoding variations.
     61 */
    3762typedef enum BS3CG1ENC
    3863{
    3964    BS3CG1ENC_INVALID = 0,
    40     BS3CG1ENC_FIXED,
    41     BS3CG1ENC_MODRM,
     65
     66    BS3CG1ENC_FIXED_Iz,
     67    BS3CG1ENC_FIXED_FIRST = BS3CG1ENC_FIXED_Iz,
     68    BS3CG1ENC_FIXED_Iv,
     69
     70    BS3CG1ENC_MODRM_Eb_Gb,
     71    BS3CG1ENC_MODRM_Ev_Gv,
     72
    4273    BS3CG1ENC_END
    4374} BS3CG1ENC;
     
    4576
    4677/**
    47  * Operand details.
    48  *
    49  * Currently simply using the encoding from the reference manuals.
    50  */
    51 typedef enum BS3CG1OP
    52 {
    53     BS3CG1OP_INVALID = 0,
    54 
    55     BS3CG1OP_Eb,
    56     BS3CG1OP_Ev,
    57 
    58     BS3CG1OP_Gb,
    59     BS3CG1OP_Gv,
    60 
    61     BS3CG1OP_END
    62 } BS3CG1OP;
    63 
    64 
    65 /**
    6678 * Generated instruction info.
    6779 */
    6880typedef struct BS3CG1INSTR
    6981{
    70     /** Opcode bytes. */
    71     uint8_t     abOpcode[4];
    72     /** BS3CG1OP values for each operand. */
    73     uint8_t     aenmOperands[4];
    7482    /** The opcode size.   */
    7583    uint32_t    cbOpcode : 2;
    7684    /** The number of operands.   */
    7785    uint32_t    cOperands : 2;
     86    /** The length of the mnemonic. */
     87    uint32_t    cchMnemonic : 3;
     88    /** Whether to advance the mnemonic array pointer. */
     89    uint32_t    fAdvanceMnemonic : 1;
     90    /** Offset into g_abBs3Cg1Tests of the first test. */
     91    uint32_t    offTests : 23;
    7892    /** BS3CG1ENC values. */
    79     uint32_t    enmEncoding : 5;
    80     /** The length of the mnemonic. */
    81     uint32_t    cchMnemonic : 4;
    82     /** Index of the test header into g_aBs3Cg1Tests */
    83     uint32_t    idxTestHdr : 19;
     93    uint32_t    enmEncoding : 10;
     94    /** BS3CG1ENC values. */
     95    uint32_t    uUnused : 22;
    8496    /** BS3CG1INSTR_F_XXX. */
    8597    uint32_t    fFlags;
    8698} BS3CG1INSTR;
    87 AssertCompileSize(BS3CG1INSTR, 16);
     99AssertCompileSize(BS3CG1INSTR, 12);
    88100/** Pointer to a const instruction. */
    89101typedef BS3CG1INSTR const BS3_FAR *PCBS3CG1INSTR;
     
    103115    /** The size of the selector program in bytes.
    104116     * This is also the offset of the input context modification program.  */
    105     uint32_t    cbSelector : 9;
     117    uint32_t    cbSelector : 8;
    106118    /** The size of the input context modification program in bytes.
    107119     * This immediately follows the selector program.  */
    108     uint32_t    cbInput    : 11;
     120    uint32_t    cbInput    : 12;
    109121    /** The size of the output context modification program in bytes.
    110122     * This immediately follows the input context modification program.  The
     
    128140#define BS3CG1_CTXOP_SIZE_MASK      UINT8_C(0x07)
    129141#define BS3CG1_CTXOP_1_BYTE         UINT8_C(0x00)
    130 #define BS3CG1_CTXOP_2_BYTE         UINT8_C(0x01)
    131 #define BS3CG1_CTXOP_4_BYTE         UINT8_C(0x02)
    132 #define BS3CG1_CTXOP_8_BYTE         UINT8_C(0x03)
    133 #define BS3CG1_CTXOP_16_BYTE        UINT8_C(0x04)
    134 #define BS3CG1_CTXOP_32_BYTE        UINT8_C(0x05)
    135 #define BS3CG1_CTXOP_12_BYTE        UINT8_C(0x06)
     142#define BS3CG1_CTXOP_2_BYTES        UINT8_C(0x01)
     143#define BS3CG1_CTXOP_4_BYTES        UINT8_C(0x02)
     144#define BS3CG1_CTXOP_8_BYTES        UINT8_C(0x03)
     145#define BS3CG1_CTXOP_16_BYTES       UINT8_C(0x04)
     146#define BS3CG1_CTXOP_32_BYTES       UINT8_C(0x05)
     147#define BS3CG1_CTXOP_12_BYTES       UINT8_C(0x06)
    136148#define BS3CG1_CTXOP_SIZE_ESC       UINT8_C(0x07)   /**< Separate byte encoding the value size follows immediately. */
    137149
     
    309321
    310322
     323/** The test instructions (generated). */
     324extern const BS3CG1INSTR BS3_FAR_DATA   g_aBs3Cg1Instructions[];
    311325/** The number of test instructions (generated). */
    312 extern uint16_t BS3_FAR_DATA        g_cBs3Cg1Instructions;
    313 /** The test instructions (generated). */
    314 extern const char BS3_FAR_DATA      g_aBs3Cg1Instructions[];
    315 /** The test data that BS3CG1INSTR. */
    316 extern BS3CG1TESTHDR BS3_FAR_DATA   g_aBs3Cg1Tests[];
     326extern const uint16_t BS3_FAR_DATA      g_cBs3Cg1Instructions;
    317327/** The mnemonics (generated).
    318328 * Variable length sequence of mnemonics that runs in parallel to
    319329 * g_aBs3Cg1Instructions. */
    320 extern const char BS3_FAR_DATA      g_achBs3Cg1Mnemonics[];
     330extern const char BS3_FAR_DATA          g_achBs3Cg1Mnemonics[];
     331/** The opcodes (generated).
     332 * Variable length sequence of opcode bytes that runs in parallel to
     333 * g_aBs3Cg1Instructions, advancing by BS3CG1INSTR::cbOpcode each time. */
     334extern const uint8_t BS3_FAR_DATA       g_abBs3Cg1Opcodes[];
     335/** The operands (generated).
     336 * Variable length sequence of opcode values (BS3CG1OP) that runs in
     337 * parallel to g_aBs3Cg1Instructions, advancing by BS3CG1INSTR::cOperands. */
     338extern const uint8_t BS3_FAR_DATA       g_abBs3Cg1Operands[];
     339/** The test data that BS3CG1INSTR.
     340 * In order to simplify generating these, we use a byte array. */
     341extern const uint8_t BS3_FAR_DATA       g_abBs3Cg1Tests[];
    321342
    322343
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