core/x86/decode.c
/* FIXME: Tried putting this inside a separate unit-decode.c file, but
 *        required creating a unit-decode_table.c file.  Since the
 *        infrastructure is not fully set up, currently leaving this here
 * FIXME: beef up to check if something went wrong
 */
Tried putting this inside a separate unit-decode.c file, but
required creating a unit-decode_table.c file.  Since the
infrastructure is not fully set up, currently leaving this here
FIXME: beef up to check if something went wrong
Tried putting this inside a separate unit - decode . c file but required creating a unit - decode_table . c file . Since the infrastructure is not fully set up currently leaving this here FIXME : beef up to check if something went wrong
static bool
unit_check_decode_ff_opcode() {
    static int do_once = 0;
    instr_t instr;
    byte modrm, sib;
    byte raw_bytes[] = { 0xff, 0x0, 0x0, 
                         0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
                         0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfa,
                       };
    app_pc next_pc = NULL;
    for (modrm = 0x0; modrm < 0xff; modrm++) {
        raw_bytes[1] = modrm;
        for(sib = 0x0; sib < 0xff; sib++) {
            raw_bytes[2] = sib;
            instr_init(GLOBAL_DCONTEXT, &instr);
            instr.bytes = raw_bytes;
            instr.length = 15;
            instr_set_raw_bits_valid(&instr, true);
            instr_set_operands_valid(&instr, false);
            next_pc = decode_opcode(GLOBAL_DCONTEXT, instr.bytes, &instr);
            if (next_pc != NULL &&
                instr.opcode != OP_INVALID && instr.opcode != OP_UNDECODED) {
                print_file(STDERR, "## %02x %02x %02x len=%d\n",
                    instr.bytes[0], instr.bytes[1], instr.bytes[2], instr.length);
            }
        }
    }
    return 0;
}
static bool unit_check_decode_ff_opcode ( ) { static int do_once = 0 ; instr_t instr ; byte modrm , sib ; byte raw_bytes [ ] = { 0xff , 0x0 , 0x0 , 0xaa , 0xbb , 0xcc , 0xdd , 0xee , 0xff , 0xab , 0xbc , 0xcd , 0xde , 0xef , 0xfa , } ; app_pc next_pc = NULL ; for ( modrm = 0x0 ; modrm < 0xff ; modrm ++ ) { raw_bytes [ 1 ] = modrm ; for ( sib = 0x0 ; sib < 0xff ; sib ++ ) { raw_bytes [ 2 ] = sib ; instr_init ( GLOBAL_DCONTEXT , & instr ) ; instr . bytes = raw_bytes ; instr . length = 15 ; instr_set_raw_bits_valid ( & instr , true ) ; instr_set_operands_valid ( & instr , false ) ; next_pc = decode_opcode ( GLOBAL_DCONTEXT , instr . bytes , & instr ) ; if ( next_pc != NULL && instr . opcode != OP_INVALID && instr . opcode != OP_UNDECODED ) { print_file ( STDERR , " \n " , instr . bytes [ 0 ] , instr . bytes [ 1 ] , instr . bytes [ 2 ] , instr . length ) ; } } } return 0 ; }
FIXME: Tried putting this inside a separate unit-decode.c file, but
        required creating a unit-decode_table.c file.
FIXME : Tried putting this inside a separate unit - decode . c file but required creating a unit - decode_table . c file .
/* set up instr for decode_opcode */