VirtualBox

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


Ignore:
Timestamp:
Jun 16, 2012 8:08:56 PM (12 years ago)
Author:
vboxsync
Message:

DIS: size_t and windows compilers.

File:
1 edited

Legend:

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

    r41786 r41787  
    313313    }
    314314
    315     disReadMore(pCpu, offInstr, 1);
     315    disReadMore(pCpu, (uint8_t)offInstr, 1);
    316316    return pCpu->abInstr[offInstr];
    317317}
     
    353353    }
    354354
    355     disReadMore(pCpu, offInstr, 2);
     355    disReadMore(pCpu, (uint8_t)offInstr, 2);
    356356#ifdef DIS_HOST_UNALIGNED_ACCESS_OK
    357357    return *(uint16_t const *)&pCpu->abInstr[offInstr];
     
    409409    }
    410410
    411     disReadMore(pCpu, offInstr, 4);
     411    disReadMore(pCpu, (uint8_t)offInstr, 4);
    412412#ifdef DIS_HOST_UNALIGNED_ACCESS_OK
    413413    return *(uint32_t const *)&pCpu->abInstr[offInstr];
     
    481481    }
    482482
    483     disReadMore(pCpu, offInstr, 8);
     483    disReadMore(pCpu, (uint8_t)offInstr, 8);
    484484#ifdef DIS_HOST_UNALIGNED_ACCESS_OK
    485485    return *(uint64_t const *)&pCpu->abInstr[offInstr];
     
    519519//*****************************************************************************
    520520//*****************************************************************************
    521 static unsigned disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISCPUSTATE pCpu)
    522 {
    523     int size = 0;
     521static size_t disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISCPUSTATE pCpu)
     522{
     523    size_t size = 0;
    524524    bool fFiltered = false;
    525525
     
    595595    int index;
    596596    PCDISOPCODE fpop;
    597     unsigned size = 0;
     597    size_t size = 0;
    598598    unsigned ModRM;
    599599    NOREF(pOp);
     
    948948// Query the size of the ModRM parameters and fetch the immediate data (if any)
    949949//*****************************************************************************
    950 static unsigned QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, unsigned *pSibInc)
    951 {
    952     unsigned sibinc;
    953     unsigned size = 0;
     950static size_t QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, size_t *pSibInc)
     951{
     952    size_t sibinc;
     953    size_t size = 0;
    954954    // unsigned reg = pCpu->ModRM.Bits.Reg;
    955955    unsigned mod = pCpu->ModRM.Bits.Mod;
     
    10311031// Query the size of the ModRM parameters and fetch the immediate data (if any)
    10321032//*****************************************************************************
    1033 static unsigned QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, unsigned *pSibInc)
    1034 {
    1035     unsigned sibinc;
    1036     unsigned size = 0;
     1033static size_t QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, size_t *pSibInc)
     1034{
     1035    size_t sibinc;
     1036    size_t size = 0;
    10371037    // unsigned reg = pCpu->ModRM.Bits.Reg;
    10381038    unsigned mod = pCpu->ModRM.Bits.Mod;
     
    11161116static size_t ParseModRM(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    11171117{
    1118     unsigned size = sizeof(uint8_t);   //ModRM byte
    1119     unsigned sibinc, ModRM;
    1120 
    1121     ModRM = disReadByte(pCpu, offInstr);
     1118    size_t size = sizeof(uint8_t);   //ModRM byte
     1119    size_t sibinc;
     1120
     1121    unsigned ModRM = disReadByte(pCpu, offInstr);
    11221122    offInstr += sizeof(uint8_t);
    11231123
     
    11621162static size_t ParseModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    11631163{
    1164     unsigned size = sizeof(uint8_t);   //ModRM byte
    1165     unsigned sibinc, ModRM;
    1166 
    1167     ModRM = disReadByte(pCpu, offInstr);
     1164    size_t size = sizeof(uint8_t);   //ModRM byte
     1165    size_t sibinc;
     1166
     1167    unsigned ModRM = disReadByte(pCpu, offInstr);
    11681168    offInstr += sizeof(uint8_t);
    11691169
     
    17931793{
    17941794    PCDISOPCODE   pOpcode;
    1795     int           size    = sizeof(uint8_t);
     1795    size_t        size    = sizeof(uint8_t);
    17961796    NOREF(pOp); NOREF(pParam);
    17971797
     
    18521852{
    18531853    PCDISOPCODE   pOpcode;
    1854     int           size    = sizeof(uint8_t);
     1854    size_t        size    = sizeof(uint8_t);
    18551855    NOREF(pOp); NOREF(pParam);
    18561856
     
    19131913{
    19141914    PCDISOPCODE   pOpcode;
    1915     int           size    = sizeof(uint8_t);
     1915    size_t        size    = sizeof(uint8_t);
    19161916    NOREF(pOp); NOREF(pParam);
    19171917
     
    19471947static size_t ParseNopPause(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    19481948{
    1949     unsigned size = 0;
     1949    size_t size = 0;
    19501950    NOREF(pParam);
    19511951
     
    19661966{
    19671967    int idx = (pCpu->bOpCode - 0x80) * 8;
    1968     unsigned size = 0, modrm, reg;
     1968    size_t size = 0;
    19691969    NOREF(pParam);
    19701970
    1971     modrm = disReadByte(pCpu, offInstr);
    1972     reg   = MODRM_REG(modrm);
     1971    unsigned modrm = disReadByte(pCpu, offInstr);
     1972    unsigned reg   = MODRM_REG(modrm);
    19731973
    19741974    pOp = (PCDISOPCODE)&g_aMapX86_Group1[idx+reg];
     
    19861986{
    19871987    int idx;
    1988     unsigned size = 0, modrm, reg;
     1988    size_t size = 0;
    19891989    NOREF(pParam);
    19901990
     
    20082008    }
    20092009
    2010     modrm = disReadByte(pCpu, offInstr);
    2011     reg   = MODRM_REG(modrm);
    2012 
    2013     pOp = (PCDISOPCODE)&g_aMapX86_Group2[idx+reg];
     2010    unsigned modrm = disReadByte(pCpu, offInstr);
     2011    unsigned reg   = MODRM_REG(modrm);
     2012
     2013    pOp = &g_aMapX86_Group2[idx+reg];
    20142014
    20152015    //little hack to make sure the ModRM byte is included in the returned size
     
    20262026{
    20272027    int idx = (pCpu->bOpCode - 0xF6) * 8;
    2028     unsigned size = 0, modrm, reg;
     2028    size_t size = 0;
    20292029    NOREF(pParam);
    20302030
    2031     modrm = disReadByte(pCpu, offInstr);
    2032     reg   = MODRM_REG(modrm);
     2031    unsigned modrm = disReadByte(pCpu, offInstr);
     2032    unsigned reg   = MODRM_REG(modrm);
    20332033
    20342034    pOp = (PCDISOPCODE)&g_aMapX86_Group3[idx+reg];
     
    20462046static size_t ParseGrp4(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    20472047{
    2048     unsigned size = 0, modrm, reg;
     2048    size_t size = 0;
    20492049    NOREF(pParam);
    20502050
    2051     modrm = disReadByte(pCpu, offInstr);
    2052     reg   = MODRM_REG(modrm);
     2051    unsigned modrm = disReadByte(pCpu, offInstr);
     2052    unsigned reg   = MODRM_REG(modrm);
    20532053
    20542054    pOp = (PCDISOPCODE)&g_aMapX86_Group4[reg];
     
    20662066static size_t ParseGrp5(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    20672067{
    2068     unsigned size = 0, modrm, reg;
     2068    size_t size = 0;
    20692069    NOREF(pParam);
    20702070
    2071     modrm = disReadByte(pCpu, offInstr);
    2072     reg   = MODRM_REG(modrm);
     2071    unsigned modrm = disReadByte(pCpu, offInstr);
     2072    unsigned reg   = MODRM_REG(modrm);
    20732073
    20742074    pOp = (PCDISOPCODE)&g_aMapX86_Group5[reg];
     
    20902090static size_t Parse3DNow(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    20912091{
    2092     unsigned size = 0, modrmsize;
     2092    size_t size = 0;
    20932093
    20942094#ifdef DEBUG_Sander
     
    21022102    pCpu->ModRM.Bits.Reg = MODRM_REG(ModRM);
    21032103
    2104     modrmsize = QueryModRM(offInstr+sizeof(uint8_t), pOp, pParam, pCpu, NULL);
     2104    size_t modrmsize = QueryModRM(offInstr+sizeof(uint8_t), pOp, pParam, pCpu, NULL);
    21052105
    21062106    uint8_t opcode = disReadByte(pCpu, offInstr+sizeof(uint8_t)+modrmsize);
     
    21262126static size_t ParseGrp6(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    21272127{
    2128     unsigned size = 0, modrm, reg;
     2128    size_t size = 0;
    21292129    NOREF(pParam);
    21302130
    2131     modrm = disReadByte(pCpu, offInstr);
    2132     reg   = MODRM_REG(modrm);
     2131    unsigned modrm = disReadByte(pCpu, offInstr);
     2132    unsigned reg   = MODRM_REG(modrm);
    21332133
    21342134    pOp = (PCDISOPCODE)&g_aMapX86_Group6[reg];
     
    21462146static size_t ParseGrp7(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    21472147{
    2148     unsigned size = 0, modrm, reg, rm, mod;
     2148    size_t size = 0;
    21492149    NOREF(pParam);
    21502150
    2151     modrm = disReadByte(pCpu, offInstr);
    2152     mod   = MODRM_MOD(modrm);
    2153     reg   = MODRM_REG(modrm);
    2154     rm    = MODRM_RM(modrm);
     2151    unsigned modrm = disReadByte(pCpu, offInstr);
     2152    unsigned mod   = MODRM_MOD(modrm);
     2153    unsigned reg   = MODRM_REG(modrm);
     2154    unsigned rm    = MODRM_RM(modrm);
    21552155
    21562156    if (mod == 3 && rm == 0)
     
    21742174static size_t ParseGrp8(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    21752175{
    2176     unsigned size = 0, modrm, reg;
     2176    size_t size = 0;
    21772177    NOREF(pParam);
    21782178
    2179     modrm = disReadByte(pCpu, offInstr);
    2180     reg   = MODRM_REG(modrm);
     2179    unsigned modrm = disReadByte(pCpu, offInstr);
     2180    unsigned reg   = MODRM_REG(modrm);
    21812181
    21822182    pOp = (PCDISOPCODE)&g_aMapX86_Group8[reg];
     
    21942194static size_t ParseGrp9(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    21952195{
    2196     unsigned size = 0, modrm, reg;
     2196    size_t size = 0;
    21972197    NOREF(pParam);
    21982198
    2199     modrm = disReadByte(pCpu, offInstr);
    2200     reg   = MODRM_REG(modrm);
     2199    unsigned modrm = disReadByte(pCpu, offInstr);
     2200    unsigned reg   = MODRM_REG(modrm);
    22012201
    22022202    pOp = (PCDISOPCODE)&g_aMapX86_Group9[reg];
     
    22142214static size_t ParseGrp10(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    22152215{
    2216     unsigned size = 0, modrm, reg;
     2216    size_t size = 0;
    22172217    NOREF(pParam);
    22182218
    2219     modrm = disReadByte(pCpu, offInstr);
    2220     reg   = MODRM_REG(modrm);
     2219    unsigned modrm = disReadByte(pCpu, offInstr);
     2220    unsigned reg   = MODRM_REG(modrm);
    22212221
    22222222    pOp = (PCDISOPCODE)&g_aMapX86_Group10[reg];
     
    22342234static size_t ParseGrp12(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    22352235{
    2236     unsigned size = 0, modrm, reg;
     2236    size_t size = 0;
    22372237    NOREF(pParam);
    22382238
    2239     modrm = disReadByte(pCpu, offInstr);
    2240     reg   = MODRM_REG(modrm);
     2239    unsigned modrm = disReadByte(pCpu, offInstr);
     2240    unsigned reg   = MODRM_REG(modrm);
    22412241
    22422242    if (pCpu->fPrefix & DISPREFIX_OPSIZE)
     
    22562256static size_t ParseGrp13(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    22572257{
    2258     unsigned size = 0, modrm, reg;
     2258    size_t size = 0;
    22592259    NOREF(pParam);
    22602260
    2261     modrm = disReadByte(pCpu, offInstr);
    2262     reg   = MODRM_REG(modrm);
     2261    unsigned modrm = disReadByte(pCpu, offInstr);
     2262    unsigned reg   = MODRM_REG(modrm);
    22632263    if (pCpu->fPrefix & DISPREFIX_OPSIZE)
    22642264        reg += 8;   //2nd table
     
    22782278static size_t ParseGrp14(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    22792279{
    2280     unsigned size = 0, modrm, reg;
     2280    size_t size = 0;
    22812281    NOREF(pParam);
    22822282
    2283     modrm = disReadByte(pCpu, offInstr);
    2284     reg   = MODRM_REG(modrm);
     2283    unsigned modrm = disReadByte(pCpu, offInstr);
     2284    unsigned reg   = MODRM_REG(modrm);
    22852285    if (pCpu->fPrefix & DISPREFIX_OPSIZE)
    22862286        reg += 8;   //2nd table
     
    23002300static size_t ParseGrp15(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    23012301{
    2302     unsigned size = 0, modrm, reg, mod, rm;
     2302    size_t size = 0;
    23032303    NOREF(pParam);
    23042304
    2305     modrm = disReadByte(pCpu, offInstr);
    2306     mod   = MODRM_MOD(modrm);
    2307     reg   = MODRM_REG(modrm);
    2308     rm    = MODRM_RM(modrm);
     2305    unsigned modrm = disReadByte(pCpu, offInstr);
     2306    unsigned mod   = MODRM_MOD(modrm);
     2307    unsigned reg   = MODRM_REG(modrm);
     2308    unsigned rm    = MODRM_RM(modrm);
    23092309
    23102310    if (mod == 3 && rm == 0)
     
    23242324static size_t ParseGrp16(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu)
    23252325{
    2326     unsigned size = 0, modrm, reg;
     2326    size_t size = 0;
    23272327    NOREF(pParam);
    23282328
    2329     modrm = disReadByte(pCpu, offInstr);
    2330     reg   = MODRM_REG(modrm);
     2329    unsigned modrm = disReadByte(pCpu, offInstr);
     2330    unsigned reg   = MODRM_REG(modrm);
    23312331
    23322332    pOp = (PCDISOPCODE)&g_aMapX86_Group16[reg];
     
    26302630    }
    26312631
    2632     pCpu->cbInstr = offInstr;
     2632    pCpu->cbInstr = (uint8_t)offInstr;
    26332633    if (pcbInstr)
    2634         *pcbInstr = offInstr;
     2634        *pcbInstr = (uint32_t)offInstr;
    26352635
    26362636    if (pCpu->fPrefix & DISPREFIX_LOCK)
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