VirtualBox

Changeset 4953 in vbox


Ignore:
Timestamp:
Sep 21, 2007 2:08:19 PM (17 years ago)
Author:
vboxsync
Message:

Cleaned up disassembler

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/dis.h

    r4071 r4953  
    3333 * @{
    3434 */
    35 #define CPUMODE_16BIT                   1
    36 #define CPUMODE_32BIT                   2
     35typedef enum
     36{
     37    CPUMODE_16BIT = 1,
     38    CPUMODE_32BIT = 2,
     39    CPUMODE_64BIT = 3
     40} DISCPUMODE;
    3741/** @} */
    3842
     
    313317typedef const struct _OPCODE *PCOPCODE;
    314318
    315 typedef DECLCALLBACK(int32_t) FN_DIS_READBYTES(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTUINTPTR dwUserdata);
     319typedef DECLCALLBACK(int) FN_DIS_READBYTES(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);
    316320typedef FN_DIS_READBYTES *PFN_DIS_READBYTES;
    317321
     
    323327/** Parser callback.
    324328 * @remark no DECLCALLBACK() here because it's considered to be internal (really, I'm too lazy to update all the functions). */
    325 typedef int FNDISPARSE(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     329typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    326330typedef FNDISPARSE *PFNDISPARSE;
    327331
     
    370374    PCOPCODE        pCurInstr;
    371375
    372     RTUINTPTR       dwUserData[3];
     376    void           *apvUserData[3];
    373377
    374378    /** Optional read function */
     
    402406 * Disassembles a code block.
    403407 *
    404  * @returns Success indicator.
     408 * @returns VBox error code
    405409 * @param   pCpu            Pointer to cpu structure which have DISCPUSTATE::mode
    406410 *                          set correctly.
     
    419423 *          This means *pcbSize >= cbMax sometimes.
    420424 */
    421 DISDECL(bool) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, int32_t cbMax, uint32_t *pSize);
     425DISDECL(int) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, unsigned cbMax, unsigned *pSize);
    422426
    423427/**
    424428 * Disassembles one instruction
    425429 *
    426  * @returns Success indicator.
     430 * @returns VBox error code
    427431 * @param   pCpu            Pointer to cpu structure which have DISCPUSTATE::mode
    428432 *                          set correctly.
     
    435439 * @todo    Define output callback.
    436440 */
    437 DISDECL(bool) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize, char *pszOutput);
     441DISDECL(int) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize, char *pszOutput);
    438442
    439443/**
    440444 * Disassembles one instruction
    441445 *
    442  * @returns Success indicator.
     446 * @returns VBox error code
    443447 * @param   pCpu            Pointer to cpu structure which have DISCPUSTATE::mode
    444448 *                          set correctly.
     
    452456 * @todo    Define output callback.
    453457 */
    454 DISDECL(bool) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize,
    455                          char *pszOutput, uint32_t uFilter);
     458DISDECL(int) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize,
     459                         char *pszOutput, unsigned uFilter);
    456460
    457461/**
     
    459463 * The result is found in pCpu.
    460464 *
    461  * @returns Success indicator.
     465 * @returns VBox error code
    462466 * @param   pCpu            Pointer to cpu structure which has DISCPUSTATE::mode set correctly.
    463467 * @param   InstructionAddr Pointer to the instruction to parse.
     
    465469 *                          NULL is allowed.
    466470 */
    467 DISDECL(bool) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction);
     471DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction);
    468472
    469473/**
  • trunk/include/VBox/err.h

    r4738 r4953  
    11171117
    11181118
     1119/** @name VBox Disassembler Status Codes
     1120 * @{
     1121 */
     1122/** Invalid opcode byte(s) */
     1123#define VERR_DIS_INVALID_OPCODE                     (-5000)
     1124/** Generic failure during disassembly. */
     1125#define VERR_DIS_GEN_FAILURE                        (-5001)
     1126/** @} */
     1127
    11191128/* SED-END */
    11201129
  • trunk/src/VBox/Disassembler/Disasm.cpp

    r4071 r4953  
    3636 * Disassembles a code block.
    3737 *
    38  * @returns Success indicator.
     38 * @returns VBox error code
    3939 * @param   pCpu            Pointer to cpu structure which have DISCPUSTATE::mode
    4040 *                          set correctly.
     
    5353 *          This means *pcbSize >= cbMax sometimes.
    5454 */
    55 DISDECL(bool) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, int32_t cbMax, uint32_t *pSize)
     55DISDECL(int) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, unsigned cbMax, unsigned *pSize)
    5656{
    57     int32_t i = 0;
     57    unsigned i = 0;
    5858    char szOutput[256];
    5959
    6060    while (i < cbMax)
    6161    {
    62         uint32_t cbInstr;
    63         if (!DISInstr(pCpu, pvCodeBlock + i, 0, &cbInstr, szOutput))
    64             return false;
     62        unsigned cbInstr;
     63        int rc = DISInstr(pCpu, pvCodeBlock + i, 0, &cbInstr, szOutput);
     64        if (VBOX_FAILURE(rc))
     65            return rc;
    6566
    6667        i += cbInstr;
     
    7576 * Disassembles one instruction
    7677 *
    77  * @returns Success indicator.
     78 * @returns VBox error code
    7879 * @param   pCpu            Pointer to cpu structure which have DISCPUSTATE::mode
    7980 *                          set correctly.
     
    8687 * @todo    Define output callback.
    8788 */
    88 DISDECL(bool) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize,
     89DISDECL(int) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize,
    8990                       char *pszOutput)
    9091{
     
    9596 * Disassembles one instruction; only fully disassembly an instruction if it matches the filter criteria
    9697 *
    97  * @returns Success indicator.
     98 * @returns VBox error code
    9899 * @param   pCpu            Pointer to cpu structure which have DISCPUSTATE::mode
    99100 *                          set correctly.
     
    107108 * @todo    Define output callback.
    108109 */
    109 DISDECL(bool) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize,
    110                          char *pszOutput, uint32_t uFilter)
     110DISDECL(int) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize,
     111                         char *pszOutput, unsigned uFilter)
    111112{
    112     int i = 0, prefixbytes;
    113     int idx, inc;
     113    unsigned i = 0, prefixbytes;
     114    unsigned idx, inc;
    114115#ifdef __L4ENV__
    115116    jmp_buf jumpbuffer;
     
    165166                    AssertMsgFailed(("Invalid opcode!!\n"));
    166167#endif
    167                     return false;
     168                    return VERR_DIS_INVALID_OPCODE;
    168169
    169170                // segment override prefix byte
     
    245246        if (pcbSize)
    246247            *pcbSize = 0;
    247         return false;
     248        return VERR_DIS_GEN_FAILURE;
    248249    }
    249250
     
    251252        *pcbSize = i;
    252253
    253     return true;
     254    return VINF_SUCCESS;
    254255}
    255256//*****************************************************************************
  • trunk/src/VBox/Disassembler/DisasmCore.cpp

    r4283 r4953  
    6060#endif
    6161
    62 static int QueryModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL);
    63 static int QueryModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL);
    64 static int UseSIB(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    65 static int ParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     62static unsigned QueryModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL);
     63static unsigned QueryModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL);
     64static void    UseSIB(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     65static unsigned ParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    6666
    6767/*******************************************************************************
     
    257257 *                          NULL is allowed.
    258258 */
    259 DISDECL(bool) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction)
     259DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction)
    260260{
    261261    /*
     
    295295 * @param   InstructionAddr Address of the instruction to decode. What this means
    296296 *                          is left to the pfnReadBytes function.
    297  * @param   CpuMode         The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT.
     297 * @param   uCpuMode        The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT.
    298298 * @param   pfnReadBytes    Callback for reading instruction bytes.
    299  * @param   pvUser          User argument for the instruction reader. (Ends up in dwUserData[0].)
     299 * @param   pvUser          User argument for the instruction reader. (Ends up in apvUserData[0].)
    300300 * @param   pCpu            Pointer to cpu structure. Will be initialized.
    301301 * @param   pcbInstruction  Where to store the size of the instruction.
    302302 *                          NULL is allowed.
    303303 */
    304 DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, unsigned CpuMode, PFN_DIS_READBYTES pfnReadBytes, void *pvUser,
     304DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, unsigned uCpuMode, PFN_DIS_READBYTES pfnReadBytes, void *pvUser,
    305305                          PDISCPUSTATE pCpu, unsigned *pcbInstruction)
    306306{
     
    311311    pCpu->prefix_seg = 0;
    312312    pCpu->lastprefix = 0;
    313     pCpu->mode       = CpuMode;
    314     pCpu->addrmode   = CpuMode;
    315     pCpu->opmode     = CpuMode;
     313    pCpu->mode       = uCpuMode;
     314    pCpu->addrmode   = uCpuMode;
     315    pCpu->opmode     = uCpuMode;
    316316    pCpu->ModRM      = 0;
    317317    pCpu->SIB        = 0;
     
    322322    pCpu->param2.szParam[0] = '\0';
    323323    pCpu->param3.szParam[0] = '\0';
    324     pCpu->param1.flags = 0;
    325     pCpu->param2.flags = 0;
    326     pCpu->param3.flags = 0;
    327     pCpu->param1.size  = 0;
    328     pCpu->param2.size  = 0;
    329     pCpu->param3.size  = 0;
    330     pCpu->pfnReadBytes = pfnReadBytes;
    331     pCpu->dwUserData[0] = (uintptr_t)pvUser; Assert(sizeof(pCpu->dwUserData) >= sizeof(uintptr_t));
    332     pCpu->uFilter      = OPTYPE_ALL;
    333     pCpu->pfnDisasmFnTable = pfnFullDisasm;
     324    pCpu->param1.flags      = 0;
     325    pCpu->param2.flags      = 0;
     326    pCpu->param3.flags      = 0;
     327    pCpu->param1.size       = 0;
     328    pCpu->param2.size       = 0;
     329    pCpu->param3.size       = 0;
     330    pCpu->pfnReadBytes      = pfnReadBytes;
     331    pCpu->apvUserData[0]    = pvUser;
     332    pCpu->uFilter           = OPTYPE_ALL;
     333    pCpu->pfnDisasmFnTable  = pfnFullDisasm;
    334334
    335335    return disCoreOne(pCpu, InstructionAddr, pcbInstruction);
     
    838838//*****************************************************************************
    839839//*****************************************************************************
    840 int ParseInstruction(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu)
     840unsigned ParseInstruction(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu)
    841841{
    842842    int  size = 0;
     
    888888/* Floating point opcode parsing */
    889889//*****************************************************************************
    890 int ParseEscFP(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     890unsigned ParseEscFP(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    891891{
    892892    int index;
    893893    const OPCODE *fpop;
    894     int size = 0;
     894    unsigned size = 0;
    895895
    896896    pCpu->ModRM = DISReadByte(pCpu, lpszCodeBlock);
     
    971971
    972972//*****************************************************************************
    973 int UseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     973void UseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    974974{
    975975    int scale, base, index;
     
    10191019        pParam->base.reg_gen32 = base;
    10201020    }
    1021     return 0;   //already fetched everything in ParseSIB
    1022 }
    1023 //*****************************************************************************
    1024 //*****************************************************************************
    1025 int ParseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    1026 {
    1027     int size = sizeof(uint8_t), base;
     1021    return;   /* Already fetched everything in ParseSIB; no size returned */
     1022}
     1023//*****************************************************************************
     1024//*****************************************************************************
     1025unsigned ParseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1026{
     1027    unsigned size = sizeof(uint8_t), base;
    10281028
    10291029    pCpu->SIB = DISReadByte(pCpu, lpszCodeBlock);
     
    10401040//*****************************************************************************
    10411041//*****************************************************************************
    1042 int ParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    1043 {
    1044     int size = sizeof(uint8_t), base;
     1042unsigned ParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1043{
     1044    unsigned size = sizeof(uint8_t), base;
    10451045
    10461046    pCpu->SIB = DISReadByte(pCpu, lpszCodeBlock);
     
    10591059// Mod    Reg/Opcode  R/M
    10601060//*****************************************************************************
    1061 int UseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1061unsigned UseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    10621062{
    10631063    int reg   = MODRM_REG(pCpu->ModRM);
     
    12621262// Query the size of the ModRM parameters and fetch the immediate data (if any)
    12631263//*****************************************************************************
    1264 int QueryModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc)
     1264unsigned QueryModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc)
    12651265{
    12661266    int mod, rm, sibinc;
    1267     int size = 0;
     1267    unsigned size = 0;
    12681268
    12691269    rm  = MODRM_RM(pCpu->ModRM);
     
    13401340// Query the size of the ModRM parameters and fetch the immediate data (if any)
    13411341//*****************************************************************************
    1342 int QueryModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc)
     1342unsigned QueryModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc)
    13431343{
    13441344    int mod, rm, sibinc;
    1345     int size = 0;
     1345    unsigned size = 0;
    13461346
    13471347    rm  = MODRM_RM(pCpu->ModRM);
     
    14111411//*****************************************************************************
    14121412//*****************************************************************************
    1413 int ParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1413unsigned ParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    14141414{
    14151415    AssertFailed();
     
    14181418//*****************************************************************************
    14191419//*****************************************************************************
    1420 int ParseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    1421 {
    1422     int size = sizeof(uint8_t);   //ModRM byte
     1420unsigned ParseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1421{
     1422    unsigned size = sizeof(uint8_t);   //ModRM byte
    14231423    int sibinc;
    14241424
     
    14351435//*****************************************************************************
    14361436//*****************************************************************************
    1437 int ParseModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    1438 {
    1439     int size = sizeof(uint8_t);   //ModRM byte
     1437unsigned ParseModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1438{
     1439    unsigned size = sizeof(uint8_t);   //ModRM byte
    14401440    int sibinc;
    14411441
     
    14511451//*****************************************************************************
    14521452//*****************************************************************************
    1453 int ParseModFence(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1453unsigned ParseModFence(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    14541454{
    14551455    ////AssertMsgFailed(("??\n"));
     
    14591459//*****************************************************************************
    14601460//*****************************************************************************
    1461 int ParseImmByte(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1461unsigned ParseImmByte(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    14621462{
    14631463    pParam->parval = DISReadByte(pCpu, lpszCodeBlock);
     
    14691469//*****************************************************************************
    14701470//*****************************************************************************
    1471 int ParseImmByte_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1471unsigned ParseImmByte_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    14721472{
    14731473    return sizeof(uint8_t);
     
    14751475//*****************************************************************************
    14761476//*****************************************************************************
    1477 int ParseImmByteSX(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1477unsigned ParseImmByteSX(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    14781478{
    14791479    if(pCpu->opmode == CPUMODE_32BIT)
     
    14931493//*****************************************************************************
    14941494//*****************************************************************************
    1495 int ParseImmByteSX_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1495unsigned ParseImmByteSX_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    14961496{
    14971497    return sizeof(uint8_t);
     
    14991499//*****************************************************************************
    15001500//*****************************************************************************
    1501 int ParseImmUshort(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1501unsigned ParseImmUshort(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15021502{
    15031503    pParam->parval = DISReadWord(pCpu, lpszCodeBlock);
     
    15091509//*****************************************************************************
    15101510//*****************************************************************************
    1511 int ParseImmUshort_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1511unsigned ParseImmUshort_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15121512{
    15131513    return sizeof(uint16_t);
     
    15151515//*****************************************************************************
    15161516//*****************************************************************************
    1517 int ParseImmUlong(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1517unsigned ParseImmUlong(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15181518{
    15191519    pParam->parval = DISReadDWord(pCpu, lpszCodeBlock);
     
    15251525//*****************************************************************************
    15261526//*****************************************************************************
    1527 int ParseImmUlong_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1527unsigned ParseImmUlong_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15281528{
    15291529    return sizeof(uint32_t);
     
    15311531//*****************************************************************************
    15321532//*****************************************************************************
    1533 int ParseImmQword(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1533unsigned ParseImmQword(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15341534{
    15351535    pParam->parval = DISReadQWord(pCpu, lpszCodeBlock);
     
    15421542//*****************************************************************************
    15431543//*****************************************************************************
    1544 int ParseImmQword_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1544unsigned ParseImmQword_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15451545{
    15461546    return sizeof(uint64_t);
     
    15481548//*****************************************************************************
    15491549//*****************************************************************************
    1550 int ParseImmV(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1550unsigned ParseImmV(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15511551{
    15521552    if(pCpu->opmode == CPUMODE_32BIT)
     
    15691569//*****************************************************************************
    15701570//*****************************************************************************
    1571 int ParseImmV_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1571unsigned ParseImmV_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15721572{
    15731573    if(pCpu->opmode == CPUMODE_32BIT)
     
    15831583// Relative displacement for branches (rel. to next instruction)
    15841584//*****************************************************************************
    1585 int ParseImmBRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1585unsigned ParseImmBRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15861586{
    15871587    pParam->parval = DISReadByte(pCpu, lpszCodeBlock);
     
    15941594// Relative displacement for branches (rel. to next instruction)
    15951595//*****************************************************************************
    1596 int ParseImmBRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1596unsigned ParseImmBRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    15971597{
    15981598    return sizeof(char);
     
    16011601// Relative displacement for branches (rel. to next instruction)
    16021602//*****************************************************************************
    1603 int ParseImmVRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1603unsigned ParseImmVRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    16041604{
    16051605    if(pCpu->opmode == CPUMODE_32BIT)
     
    16231623// Relative displacement for branches (rel. to next instruction)
    16241624//*****************************************************************************
    1625 int ParseImmVRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1625unsigned ParseImmVRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    16261626{
    16271627    if(pCpu->opmode == CPUMODE_32BIT)
     
    16361636//*****************************************************************************
    16371637//*****************************************************************************
    1638 int ParseImmAddr(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1638unsigned ParseImmAddr(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    16391639{
    16401640    disasmGetPtrString(pCpu, pOp, pParam);
     
    16891689//*****************************************************************************
    16901690//*****************************************************************************
    1691 int ParseImmAddr_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1691unsigned ParseImmAddr_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    16921692{
    16931693    if(pCpu->addrmode == CPUMODE_32BIT)
     
    17161716//*****************************************************************************
    17171717//*****************************************************************************
    1718 int ParseFixedReg(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1718unsigned ParseFixedReg(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    17191719{
    17201720    /*
     
    17861786//*****************************************************************************
    17871787//*****************************************************************************
    1788 int ParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1788unsigned ParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    17891789{
    17901790    disasmGetPtrString(pCpu, pOp, pParam);
     
    18061806//*****************************************************************************
    18071807//*****************************************************************************
    1808 int ParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1808unsigned ParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    18091809{
    18101810    disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), (pCpu->addrmode == CPUMODE_32BIT) ? "DS:ESI" : "DS:SI");
     
    18251825//*****************************************************************************
    18261826//*****************************************************************************
    1827 int ParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1827unsigned ParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    18281828{
    18291829    disasmGetPtrString(pCpu, pOp, pParam);
     
    18451845//*****************************************************************************
    18461846//*****************************************************************************
    1847 int ParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1847unsigned ParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    18481848{
    18491849    disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), (pCpu->addrmode == CPUMODE_32BIT) ? "ES:EDI" : "ES:DI");
     
    18641864//*****************************************************************************
    18651865//*****************************************************************************
    1866 int ParseTwoByteEsc(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1866unsigned ParseTwoByteEsc(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    18671867{
    18681868    const OPCODE *pOpcode;
     
    19201920//*****************************************************************************
    19211921//*****************************************************************************
    1922 int ParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    1923 {
    1924     int size = 0;
     1922unsigned ParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1923{
     1924    unsigned size = 0;
    19251925
    19261926    if (pCpu->prefix & PREFIX_REP)
     
    19371937//*****************************************************************************
    19381938//*****************************************************************************
    1939 int ParseImmGrpl(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1939unsigned ParseImmGrpl(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    19401940{
    19411941    int idx = (pCpu->opcode - 0x80) * 8;
    1942     int size = 0, modrm, reg;
     1942    unsigned size = 0, modrm, reg;
    19431943
    19441944    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    19581958//*****************************************************************************
    19591959//*****************************************************************************
    1960 int ParseShiftGrp2(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     1960unsigned ParseShiftGrp2(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    19611961{
    19621962    int idx;
    1963     int size = 0, modrm, reg;
     1963    unsigned size = 0, modrm, reg;
    19641964
    19651965    switch(pCpu->opcode)
     
    19991999//*****************************************************************************
    20002000//*****************************************************************************
    2001 int ParseGrp3(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2001unsigned ParseGrp3(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    20022002{
    20032003    int idx = (pCpu->opcode - 0xF6) * 8;
    2004     int size = 0, modrm, reg;
     2004    unsigned size = 0, modrm, reg;
    20052005
    20062006    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    20212021//*****************************************************************************
    20222022//*****************************************************************************
    2023 int ParseGrp4(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2024 {
    2025     int size = 0, modrm, reg;
     2023unsigned ParseGrp4(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2024{
     2025    unsigned size = 0, modrm, reg;
    20262026
    20272027    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    20422042//*****************************************************************************
    20432043//*****************************************************************************
    2044 int ParseGrp5(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2045 {
    2046     int size = 0, modrm, reg;
     2044unsigned ParseGrp5(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2045{
     2046    unsigned size = 0, modrm, reg;
    20472047
    20482048    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    20672067//
    20682068//*****************************************************************************
    2069 int Parse3DNow(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2070 {
    2071     int size = 0, modrmsize;
     2069unsigned Parse3DNow(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2070{
     2071    unsigned size = 0, modrmsize;
    20722072
    20732073#ifdef DEBUG_Sander
     
    21002100//*****************************************************************************
    21012101//*****************************************************************************
    2102 int ParseGrp6(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2103 {
    2104     int size = 0, modrm, reg;
     2102unsigned ParseGrp6(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2103{
     2104    unsigned size = 0, modrm, reg;
    21052105
    21062106    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    21212121//*****************************************************************************
    21222122//*****************************************************************************
    2123 int ParseGrp7(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2124 {
    2125     int size = 0, modrm, reg, rm, mod;
     2123unsigned ParseGrp7(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2124{
     2125    unsigned size = 0, modrm, reg, rm, mod;
    21262126
    21272127    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    21542154//*****************************************************************************
    21552155//*****************************************************************************
    2156 int ParseGrp8(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2157 {
    2158     int size = 0, modrm, reg;
     2156unsigned ParseGrp8(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2157{
     2158    unsigned size = 0, modrm, reg;
    21592159
    21602160    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    21752175//*****************************************************************************
    21762176//*****************************************************************************
    2177 int ParseGrp9(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2178 {
    2179     int size = 0, modrm, reg;
     2177unsigned ParseGrp9(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2178{
     2179    unsigned size = 0, modrm, reg;
    21802180
    21812181    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    21962196//*****************************************************************************
    21972197//*****************************************************************************
    2198 int ParseGrp10(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2199 {
    2200     int size = 0, modrm, reg;
     2198unsigned ParseGrp10(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2199{
     2200    unsigned size = 0, modrm, reg;
    22012201
    22022202    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    22172217//*****************************************************************************
    22182218//*****************************************************************************
    2219 int ParseGrp12(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2220 {
    2221     int size = 0, modrm, reg;
     2219unsigned ParseGrp12(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2220{
     2221    unsigned size = 0, modrm, reg;
    22222222
    22232223    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    22432243//*****************************************************************************
    22442244//*****************************************************************************
    2245 int ParseGrp13(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2246 {
    2247     int size = 0, modrm, reg;
     2245unsigned ParseGrp13(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2246{
     2247    unsigned size = 0, modrm, reg;
    22482248
    22492249    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    22682268//*****************************************************************************
    22692269//*****************************************************************************
    2270 int ParseGrp14(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2271 {
    2272     int size = 0, modrm, reg;
     2270unsigned ParseGrp14(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2271{
     2272    unsigned size = 0, modrm, reg;
    22732273
    22742274    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    22932293//*****************************************************************************
    22942294//*****************************************************************************
    2295 int ParseGrp15(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2296 {
    2297     int size = 0, modrm, reg, mod, rm;
     2295unsigned ParseGrp15(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2296{
     2297    unsigned size = 0, modrm, reg, mod, rm;
    22982298
    22992299    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    23192319//*****************************************************************************
    23202320//*****************************************************************************
    2321 int ParseGrp16(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    2322 {
    2323     int size = 0, modrm, reg;
     2321unsigned ParseGrp16(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
     2322{
     2323    unsigned size = 0, modrm, reg;
    23242324
    23252325    modrm = DISReadByte(pCpu, lpszCodeBlock);
     
    25112511         int     rc;
    25122512
    2513          rc = pCpu->pfnReadBytes(pAddress, &temp, sizeof(temp), (RTUINTPTR)pCpu);
     2513         rc = pCpu->pfnReadBytes(pAddress, &temp, sizeof(temp), pCpu);
    25142514         if(VBOX_FAILURE(rc))
    25152515         {
     
    25352535         int     rc;
    25362536
    2537          rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), (RTUINTPTR)pCpu);
     2537         rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), pCpu);
    25382538         if(VBOX_FAILURE(rc))
    25392539         {
     
    25592559         int     rc;
    25602560
    2561          rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), (RTUINTPTR)pCpu);
     2561         rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), pCpu);
    25622562         if(VBOX_FAILURE(rc))
    25632563         {
     
    25832583         int     rc;
    25842584
    2585          rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), (RTUINTPTR)pCpu);
     2585         rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), pCpu);
    25862586         if(VBOX_FAILURE(rc))
    25872587         {
  • trunk/src/VBox/Disassembler/DisasmInternal.h

    r4071 r4953  
    8282__BEGIN_DECLS
    8383
    84 int ParseInstruction(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu);
     84unsigned ParseInstruction(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu);
    8585
    86 int ParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    87 int ParseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    88 int ParseModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    89 int UseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    90 int ParseImmByte(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    91 int ParseImmByte_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    92 int ParseImmByteSX(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    93 int ParseImmByteSX_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    94 int ParseImmBRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    95 int ParseImmBRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    96 int ParseImmUshort(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    97 int ParseImmUshort_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    98 int ParseImmV(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    99 int ParseImmV_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    100 int ParseImmVRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    101 int ParseImmVRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     86unsigned ParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     87unsigned ParseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     88unsigned ParseModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     89unsigned UseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     90unsigned ParseImmByte(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     91unsigned ParseImmByte_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     92unsigned ParseImmByteSX(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     93unsigned ParseImmByteSX_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     94unsigned ParseImmBRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     95unsigned ParseImmBRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     96unsigned ParseImmUshort(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     97unsigned ParseImmUshort_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     98unsigned ParseImmV(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     99unsigned ParseImmV_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     100unsigned ParseImmVRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     101unsigned ParseImmVRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    102102
    103 int ParseImmAddr(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    104 int ParseImmAddr_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    105 int ParseFixedReg(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    106 int ParseImmUlong(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    107 int ParseImmUlong_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    108 int ParseImmQword(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    109 int ParseImmQword_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     103unsigned ParseImmAddr(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     104unsigned ParseImmAddr_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     105unsigned ParseFixedReg(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     106unsigned ParseImmUlong(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     107unsigned ParseImmUlong_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     108unsigned ParseImmQword(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     109unsigned ParseImmQword_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    110110
    111 int ParseTwoByteEsc(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    112 int ParseImmGrpl(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    113 int ParseShiftGrp2(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    114 int ParseGrp3(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    115 int ParseGrp4(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    116 int ParseGrp5(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    117 int Parse3DNow(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    118 int ParseGrp6(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    119 int ParseGrp7(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    120 int ParseGrp8(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    121 int ParseGrp9(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    122 int ParseGrp10(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    123 int ParseGrp12(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    124 int ParseGrp13(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    125 int ParseGrp14(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    126 int ParseGrp15(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    127 int ParseGrp16(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    128 int ParseModFence(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    129 int ParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     111unsigned ParseTwoByteEsc(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     112unsigned ParseImmGrpl(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     113unsigned ParseShiftGrp2(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     114unsigned ParseGrp3(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     115unsigned ParseGrp4(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     116unsigned ParseGrp5(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     117unsigned Parse3DNow(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     118unsigned ParseGrp6(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     119unsigned ParseGrp7(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     120unsigned ParseGrp8(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     121unsigned ParseGrp9(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     122unsigned ParseGrp10(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     123unsigned ParseGrp12(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     124unsigned ParseGrp13(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     125unsigned ParseGrp14(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     126unsigned ParseGrp15(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     127unsigned ParseGrp16(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     128unsigned ParseModFence(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     129unsigned ParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    130130
    131 int ParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    132 int ParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    133 int ParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    134 int ParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     131unsigned ParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     132unsigned ParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     133unsigned ParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     134unsigned ParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    135135
    136136/* Floating point parsing */
    137 int ParseEscFP(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
     137unsigned ParseEscFP(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
    138138
    139139/* Disassembler printf */
  • trunk/src/VBox/VMM/CPUM.cpp

    r4691 r4953  
    15121512    /** Pointer to the current page - GC Ptr. */
    15131513    RTGCPTR         pvPageGC;
    1514     /** The rc of the operation.
    1515      *
    1516      * @todo r=bird: it's rather annoying that we have to keep track of the status code of the operation.
    1517      *               When we've got time we should adjust the disassembler to use VBox status codes and not
    1518      *               boolean returns.
    1519      */
    1520     int             rc;
    15211514} CPUMDISASSTATE, *PCPUMDISASSTATE;
    15221515
     
    15251518 * Instruction reader.
    15261519 *
    1527  * @returns VBox status code. (Why this is a int32_t and not just an int is also beyond me.)
     1520 * @returns VBox status code.
    15281521 * @param   PtrSrc      Address to read from.
    15291522 *                      In our case this is relative to the selector pointed to by the 2nd user argument of uDisCpu.
    15301523 * @param   pu8Dst      Where to store the bytes.
    15311524 * @param   cbRead      Number of bytes to read.
    1532  * @param   uDisCpu     Pointer to the disassembler cpu state. (Why this is a VBOXHUINTPTR is beyond me...)
     1525 * @param   uDisCpu     Pointer to the disassembler cpu state.
    15331526 *                      In this context it's always pointer to the Core of a DBGFDISASSTATE.
    1534  * @todo r=bird: The status code should be an int. The PtrSrc should *NOT* be a RTHCUINTPTR. The uDisCpu could just as well be
    1535  *               declared as what it actually is a PDISCPUSTATE.
    1536  */
    1537 static DECLCALLBACK(int32_t) cpumR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, RTHCUINTPTR uDisCpu)
     1527 */
     1528static DECLCALLBACK(int) cpumR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, void *uDisCpu)
    15381529{
    15391530    PDISCPUSTATE pCpu = (PDISCPUSTATE)uDisCpu;
    1540     PCPUMDISASSTATE pState = (PCPUMDISASSTATE)pCpu->dwUserData[0]; /** @todo r=bird: Invalid prefix, dw='double word' which it isn't. Besides it's an array too. And btw. RTHCUINTPTR isn't the right thing either in a 32-bit host 64-bit guest situation */
     1531    PCPUMDISASSTATE pState = (PCPUMDISASSTATE)pCpu->apvUserData[0];
    15411532    Assert(cbRead > 0);
    15421533    for (;;)
     
    15481539            ||  (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT))
    15491540        {
     1541            int rc = VINF_SUCCESS;
     1542
    15501543            /* translate the address */
    15511544            pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK;
     
    15541547                pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC);
    15551548                if (!pState->pvPageHC)
    1556                     pState->rc = VERR_INVALID_POINTER;
     1549                    rc = VERR_INVALID_POINTER;
    15571550            }
    15581551            else
    1559                 pState->rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);
    1560             if (VBOX_FAILURE(pState->rc))
     1552                rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);
     1553            if (VBOX_FAILURE(rc))
    15611554            {
    15621555                pState->pvPageHC = NULL;
    1563                 return pState->rc;
     1556                return rc;
    15641557            }
    15651558        }
     
    15671560        /* check the segemnt limit */
    15681561        if (PtrSrc > pState->cbSegLimit)
    1569             return pState->rc = VERR_OUT_OF_SELECTOR_BOUNDS;
     1562            return VERR_OUT_OF_SELECTOR_BOUNDS;
    15701563
    15711564        /* calc how much we can read */
     
    16071600    State.pvPageGC        = 0;
    16081601    State.pvPageHC        = NULL;
    1609     State.rc              = VINF_SUCCESS;
    16101602    State.pVM             = pVM;
    16111603
     
    16621654     */
    16631655    pCpu->pfnReadBytes    = cpumR3DisasInstrRead;
    1664     pCpu->dwUserData[0]   = (uintptr_t)&State;
     1656    pCpu->apvUserData[0]  = &State;
    16651657
    16661658    uint32_t cbInstr;
    16671659#ifdef LOG_ENABLED
    1668     if (DISInstr(pCpu, GCPtrPC, 0, &cbInstr, NULL))
     1660    rc = DISInstr(pCpu, GCPtrPC, 0, &cbInstr, NULL);
     1661    if (VBOX_SUCCESS(rc))
    16691662    {
    16701663#else
    16711664    char szOutput[160];
    1672     if (DISInstr(pCpu, GCPtrPC, 0, &cbInstr, &szOutput[0]))
     1665    rc = DISInstr(pCpu, GCPtrPC, 0, &cbInstr, &szOutput[0]);
     1666    if (VBOX_SUCCESS(rc))
    16731667    {
    16741668        /* log it */
     
    16811675    }
    16821676
    1683     /* DISInstr failure */
    1684     if (VBOX_FAILURE(State.rc))
    1685     {
    1686         Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv rc=%Vrc\n", pCtx->cs, GCPtrPC, State.rc));
    1687         return State.rc;
    1688     }
    1689     Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv\n", pCtx->cs, GCPtrPC));
    1690     rc = VERR_GENERAL_FAILURE;
     1677    Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv rc=%Vrc\n", pCtx->cs, GCPtrPC, rc));
    16911678    return rc;
    16921679}
  • trunk/src/VBox/VMM/DBGFDisas.cpp

    r4071 r4953  
    4040*   Internal Functions                                                         *
    4141*******************************************************************************/
    42 static DECLCALLBACK(int32_t) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata);
     42static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);
    4343
    4444
     
    6565    /** Pointer to the current page - GC Ptr. */
    6666    RTGCPTR         pvPageGC;
    67     /** The rc of the operation.
    68      * @todo r=bird: it's rather annoying that we have to keep track of the status code of the operation.
    69      *               When we've got time we should adjust the disassembler to use VBox status codes and not
    70      *               boolean returns.
    71      */
    72     int             rc;
    7367    /** Pointer to the next instruction (relative to GCPtrSegBase). */
    7468    RTGCUINTPTR     GCPtrNext;
     
    9791    pState->pvPageGC        = 0;
    9892    pState->pvPageHC        = NULL;
    99     pState->rc              = VINF_SUCCESS;
    10093    pState->pVM             = pVM;
    10194    Assert((uintptr_t)GCPtr == GCPtr);
    10295    uint32_t cbInstr;
    103     if (DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL))
     96    int rc = DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL);
     97    if (VBOX_SUCCESS(rc))
    10498    {
    10599        pState->GCPtrNext = GCPtr + cbInstr;
    106100        return VINF_SUCCESS;
    107101    }
    108     if (VBOX_FAILURE(pState->rc))
    109         return pState->rc;
    110     return VERR_GENERAL_FAILURE;
     102    return rc;
    111103}
    112104
     
    123115    pState->rc              = VINF_SUCCESS;
    124116    uint32_t cbInstr;
    125     if (DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL))
     117    int rc = DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL);
     118    if (VBOX_SUCCESS(rc))
    126119    {
    127120        pState->GCPtrNext = GCPtr + cbInstr;
    128121        return VINF_SUCCESS;
    129122    }
    130     if (VBOX_FAILURE(pState->rc))
    131         return pState->rc;
    132     return VERR_GENERAL_FAILURE;
     123    return rc;
    133124}
    134125#endif
     
    146137 *                      In this context it's always pointer to the Core of a DBGFDISASSTATE.
    147138 */
    148 static DECLCALLBACK(int32_t) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, RTHCUINTPTR uDisCpu)
    149 {
    150     PDBGFDISASSTATE pState = (PDBGFDISASSTATE)uDisCpu;
     139static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, unsigned cbRead, void *pvDisCpu)
     140{
     141    PDBGFDISASSTATE pState = (PDBGFDISASSTATE)pvDisCpu;
    151142    Assert(cbRead > 0);
    152143    for (;;)
     
    158149            ||  (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT))
    159150        {
     151            int rc = VINF_SUCCESS;
     152
    160153            /* translate the address */
    161154            pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK;
     
    164157                pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC);
    165158                if (!pState->pvPageHC)
    166                     pState->rc = VERR_INVALID_POINTER;
     159                    rc = VERR_INVALID_POINTER;
    167160            }
    168161            else if (pState->enmMode <= PGMMODE_PROTECTED)
    169                 pState->rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC);
     162                rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC);
    170163            else
    171                 pState->rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);
    172             if (VBOX_FAILURE(pState->rc))
     164                rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);
     165            if (VBOX_FAILURE(rc))
    173166            {
    174167                pState->pvPageHC = NULL;
    175                 return pState->rc;
     168                return rc;
    176169            }
    177170        }
     
    179172        /* check the segemnt limit */
    180173        if (PtrSrc > pState->cbSegLimit)
    181             return pState->rc = VERR_OUT_OF_SELECTOR_BOUNDS;
     174            return VERR_OUT_OF_SELECTOR_BOUNDS;
    182175
    183176        /* calc how much we can read */
     
    544537        size_t  cbBits = State.Cpu.opsize;
    545538        uint8_t *pau8Bits = (uint8_t *)alloca(cbBits);
    546         rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, (uintptr_t)&State);
     539        rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, &State);
    547540        AssertRC(rc);
    548541        if (fFlags & DBGF_DISAS_FLAGS_NO_ADDRESS)
  • trunk/src/VBox/VMM/PATM/CSAM.cpp

    r4776 r4953  
    593593 *
    594594 */
    595 int32_t CSAMR3ReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)
    596 {
    597     DISCPUSTATE  *pCpu     = (DISCPUSTATE *)dwUserdata;
    598     PVM           pVM      = (PVM)pCpu->dwUserData[0];
    599     RTHCUINTPTR   pInstrHC = pCpu->dwUserData[1];
    600     RTGCUINTPTR   pInstrGC = pCpu->dwUserData[2];
     595static DECLCALLBACK(int) CSAMR3ReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata)
     596{
     597    DISCPUSTATE  *pCpu     = (DISCPUSTATE *)pvUserdata;
     598    PVM           pVM      = (PVM)pCpu->apvUserData[0];
     599    RTHCUINTPTR   pInstrHC = (RTHCUINTPTR)pCpu->apvUserData[1];
     600    RTGCUINTPTR   pInstrGC = (RTGCUINTPTR)pCpu->apvUserData[2];
    601601    int           orgsize  = size;
    602 
    603     Assert(sizeof(RTHCUINTPTR) <= sizeof(pCpu->dwUserData[0]));
    604     Assert(sizeof(RTGCUINTPTR) <= sizeof(pCpu->dwUserData[0]));
    605602
    606603    /* We are not interested in patched instructions, so read the original opcode bytes. */
     
    638635}
    639636
    640 inline bool CSAMR3DISInstr(PVM pVM, DISCPUSTATE *pCpu, RTGCPTR InstrGC, uint8_t *InstrHC, uint32_t *pOpsize, char *pszOutput)
     637inline int CSAMR3DISInstr(PVM pVM, DISCPUSTATE *pCpu, RTGCPTR InstrGC, uint8_t *InstrHC, uint32_t *pOpsize, char *pszOutput)
    641638{
    642639    (pCpu)->pfnReadBytes  = CSAMR3ReadBytes;
    643     (pCpu)->dwUserData[0] = (RTHCUINTPTR)pVM;
    644     (pCpu)->dwUserData[1] = (RTHCUINTPTR)InstrHC;
    645     (pCpu)->dwUserData[2] = (RTHCUINTPTR)InstrGC;
     640    (pCpu)->apvUserData[0] = pVM;
     641    (pCpu)->apvUserData[1] = InstrHC;
     642    (pCpu)->apvUserData[2] = (void *)InstrGC; Assert(sizeof(InstrGC) <= sizeof(pCpu->apvUserData[0]));
    646643#ifdef DEBUG
    647644    return DISInstrEx(pCpu, InstrGC, 0, pOpsize, pszOutput, OPTYPE_ALL);
     
    718715            DISCPUSTATE  cpu;
    719716            uint8_t     *pCurInstrHC = 0;
    720             bool         disret;
    721717
    722718            if (cbInstr + opsize >= SIZEOF_NEARJUMP32)
     
    741737
    742738            cpu.mode = (pPage->fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT;
    743             disret = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);
    744             Assert(disret == true);
    745             if (disret == false)
     739            rc = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);
     740            Assert(VBOX_SUCCESS(rc));
     741            if (VBOX_FAILURE(rc))
    746742                break;
    747743        }
     
    889885            uint32_t     opsize;
    890886            uint8_t     *pCurInstrHC = 0;
    891             bool         disret;
     887            int          rc2;
    892888#ifdef DEBUG
    893889            char szOutput[256];
     
    924920                STAM_PROFILE_START(&pVM->csam.s.StatTimeDisasm, a);
    925921#ifdef DEBUG
    926                 disret = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput);
    927                 if (disret == true) Log(("CSAM Call Analysis: %s", szOutput));
     922                rc2 = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput);
     923                if (VBOX_SUCCESS(rc2)) Log(("CSAM Call Analysis: %s", szOutput));
    928924#else
    929                 disret = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);
     925                rc2 = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);
    930926#endif
    931927                STAM_PROFILE_STOP(&pVM->csam.s.StatTimeDisasm, a);
    932                 if (disret == false)
     928                if (VBOX_FAILURE(rc2))
    933929                {
    934                     Log(("Disassembly failed at %VGv (probably page not present) -> return to caller\n", pCurInstrGC));
     930                    Log(("Disassembly failed at %VGv with %Vrc (probably page not present) -> return to caller\n", pCurInstrGC, rc2));
    935931                    goto done;
    936932                }
     
    10731069    uint32_t opsize;
    10741070    R3PTRTYPE(uint8_t *) pCurInstrHC = 0;
    1075     bool disret;
     1071    int rc2;
    10761072
    10771073#ifdef DEBUG
     
    11341130        STAM_PROFILE_START(&pVM->csam.s.StatTimeDisasm, a);
    11351131#ifdef DEBUG
    1136         disret = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput);
    1137         if (disret == true) Log(("CSAM Analysis: %s", szOutput));
     1132        rc2 = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput);
     1133        if (VBOX_SUCCESS(rc2)) Log(("CSAM Analysis: %s", szOutput));
    11381134#else
    11391135        disret = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);
    11401136#endif
    11411137        STAM_PROFILE_STOP(&pVM->csam.s.StatTimeDisasm, a);
    1142         if (disret == false)
    1143         {
    1144             Log(("Disassembly failed at %VGv (probably page not present) -> return to caller\n", pCurInstrGC));
     1138        if (VBOX_FAILURE(rc2))
     1139        {
     1140            Log(("Disassembly failed at %VGv with %Vrc (probably page not present) -> return to caller\n", pCurInstrGC, rc2));
    11451141            rc = VINF_SUCCESS;
    11461142            goto done;
  • trunk/src/VBox/VMM/PATM/PATM.cpp

    r4776 r4953  
    506506 * @param   pDest       HC destination pointer
    507507 * @param   size        Number of bytes to read
    508  * @param   dwUserdata  Callback specific user data (pCpu)
    509  *
    510  */
    511 int32_t patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)
    512 {
    513     DISCPUSTATE  *pCpu     = (DISCPUSTATE *)dwUserdata;
    514     PATMDISASM   *pDisInfo = (PATMDISASM *)pCpu->dwUserData[0];
     508 * @param   pvUserdata  Callback specific user data (pCpu)
     509 *
     510 */
     511int patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata)
     512{
     513    DISCPUSTATE  *pCpu     = (DISCPUSTATE *)pvUserdata;
     514    PATMDISASM   *pDisInfo = (PATMDISASM *)pCpu->apvUserData[0];
    515515    int           orgsize  = size;
    516516
  • trunk/src/VBox/VMM/PATM/PATMInternal.h

    r4776 r4953  
    662662 * @param   pDest       HC destination pointer
    663663 * @param   size        Number of bytes to read
    664  * @param   dwUserdata  Callback specific user data (pCpu)
    665  *
    666  */
    667 int32_t patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata);
     664 * @param   pvUserdata  Callback specific user data (pCpu)
     665 *
     666 */
     667int patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata);
    668668
    669669
     
    697697    disinfo.fReadFlags = fReadFlags;
    698698    (pCpu)->pfnReadBytes  = patmReadBytes;
    699     (pCpu)->dwUserData[0] = (RTHCUINTPTR)&disinfo;
    700     return DISInstr(pCpu, InstrGC, 0, pOpsize, pszOutput);
     699    (pCpu)->apvUserData[0] = &disinfo;
     700    return VBOX_SUCCESS(DISInstr(pCpu, InstrGC, 0, pOpsize, pszOutput));
    701701}
    702702#endif /* !IN_GC */
  • trunk/src/VBox/VMM/PGMInternal.h

    r4917 r4953  
    31063106}
    31073107
     3108
     3109#if 0
     3110/** Soon to be obsolete conversion functions */
     3111
     3112/**
     3113 * Converts a GC physical address to a HC pointer.
     3114 *
     3115 * @returns VINF_SUCCESS on success.
     3116 * @returns VERR_PGM_PHYS_PAGE_RESERVED it it's a valid GC physical
     3117 *          page but has no physical backing.
     3118 * @returns VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid
     3119 *          GC physical address.
     3120 * @param   pVM     The VM handle.
     3121 * @param   GCPhys  The GC physical address to convert.
     3122 * @param   cbRange Physical range
     3123 * @param   pHCPtr  Where to store the HC pointer on success.
     3124 */
     3125PGMDECL(int) PGMPhysGCPhys2HCPtr(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange, PRTHCPTR pHCPtr);
     3126
     3127/**
     3128 * Converts a guest pointer to a HC pointer.
     3129 *
     3130 * This uses the current CR3/CR0/CR4 of the guest.
     3131 *
     3132 * @returns VBox status code.
     3133 * @param   pVM         The VM Handle
     3134 * @param   GCPtr       The guest pointer to convert.
     3135 * @param   pHCPtr      Where to store the HC virtual address.
     3136 */
     3137PGMDECL(int) PGMPhysGCPtr2HCPtr(PVM pVM, RTGCPTR GCPtr, PRTHCPTR pHCPtr);
     3138
     3139/**
     3140 * Converts a guest virtual address to a HC pointer by specfied CR3 and flags.
     3141 *
     3142 * @returns VBox status code.
     3143 * @param   pVM         The VM Handle
     3144 * @param   GCPtr       The guest pointer to convert.
     3145 * @param   cr3         The guest CR3.
     3146 * @param   fFlags      Flags used for interpreting the PD correctly: X86_CR4_PSE and X86_CR4_PAE
     3147 * @param   pHCPtr      Where to store the HC pointer.
     3148 *
     3149 * @remark  This function is used by the REM at a time where PGM could
     3150 *          potentially not be in sync. It could also be used by a
     3151 *          future DBGF API to cpu state independent conversions.
     3152 */
     3153PGMDECL(int) PGMPhysGCPtr2HCPtrByGstCR3(PVM pVM, RTGCPTR GCPtr, uint32_t cr3, unsigned fFlags, PRTHCPTR pHCPtr);
     3154#endif
     3155
    31083156/** @} */
    31093157
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r4773 r4953  
    8080 *
    8181 */
    82 DECLCALLBACK(int32_t) EMReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)
    83 {
    84     DISCPUSTATE  *pCpu     = (DISCPUSTATE *)dwUserdata;
    85     PVM           pVM      = (PVM)pCpu->dwUserData[0];
     82DECLCALLBACK(int) EMReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata)
     83{
     84    DISCPUSTATE  *pCpu     = (DISCPUSTATE *)pvUserdata;
     85    PVM           pVM      = (PVM)pCpu->apvUserData[0];
    8686#ifdef IN_RING0
    8787    int rc = PGMPhysReadGCPtr(pVM, pDest, pSrc, size);
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r4789 r4953  
    11931193 * @param   pDest       HC destination pointer
    11941194 * @param   size        Number of bytes to read
    1195  * @param   dwUserdata  Callback specific user data (pCpu)
    1196  *
    1197  */
    1198 DECLCALLBACK(int32_t) iomReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)
    1199 {
    1200     DISCPUSTATE  *pCpu     = (DISCPUSTATE *)dwUserdata;
    1201     PVM           pVM      = (PVM)pCpu->dwUserData[0];
     1195 * @param   pvUserdata  Callback specific user data (pCpu)
     1196 *
     1197 */
     1198DECLCALLBACK(int) iomReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata)
     1199{
     1200    DISCPUSTATE  *pCpu     = (DISCPUSTATE *)pvUserdata;
     1201    PVM           pVM      = (PVM)pCpu->apvUserData[0];
    12021202
    12031203    int rc = PGMPhysReadGCPtr(pVM, pDest, pSrc, size);
     
    12061206}
    12071207
    1208 inline bool iomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize)
     1208inline int iomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize)
    12091209{
    12101210    return VBOX_SUCCESS(DISCoreOneEx(InstrGC, pCpu->mode, iomReadBytes, pVM, pCpu, pOpsize));
    12111211}
    12121212#else
    1213 inline bool iomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize)
    1214 {
    1215     return DISCoreOne(pCpu, InstrGC, pOpsize);
     1213inline int iomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize)
     1214{
     1215    return VBOX_SUCCESS(DISCoreOne(pCpu, InstrGC, pOpsize));
    12161216}
    12171217
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r4917 r4953  
    10061006 * @param   pDest       HC destination pointer
    10071007 * @param   size        Number of bytes to read
    1008  * @param   dwUserdata  Callback specific user data (pCpu)
    1009  *
    1010  */
    1011 DECLCALLBACK(int32_t) pgmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)
    1012 {
    1013     DISCPUSTATE  *pCpu     = (DISCPUSTATE *)dwUserdata;
    1014     PVM           pVM      = (PVM)pCpu->dwUserData[0];
     1008 * @param   pvUserdata  Callback specific user data (pCpu)
     1009 *
     1010 */
     1011DECLCALLBACK(int) pgmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata)
     1012{
     1013    DISCPUSTATE  *pCpu     = (DISCPUSTATE *)pvUserdata;
     1014    PVM           pVM      = (PVM)pCpu->apvUserData[0];
    10151015
    10161016    int rc = PGMPhysReadGCPtr(pVM, pDest, pSrc, size);
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r4932 r4953  
    561561        case VMMR0_DO_RAW_RUN:
    562562        {
    563             /* Safety precaution as VMX disables the switcher. */
     563            /* We must disable interrupts here */
     564            RTCCUINTREG uFlags = ASMIntDisableFlags();
     565
     566            /* Safety precaution as hwaccm disables the switcher. */
    564567            if (RT_LIKELY(!pVM->vmm.s.fSwitcherDisabled))
    565568            {
     
    575578                vmmR0RecordRC(pVM, rc);
    576579#endif
     580                ASMSetFlags(uFlags);
    577581                return rc;
    578582            }
     583            ASMSetFlags(uFlags);
    579584
    580585            Assert(!pVM->vmm.s.fSwitcherDisabled);
     
    588593        {
    589594            STAM_COUNTER_INC(&pVM->vmm.s.StatRunGC);
     595
     596#ifndef RT_OS_WINDOWS /* test on other platforms */
     597            /* We must disable interrupts here */
     598            RTCCUINTREG uFlags = ASMIntDisableFlags();
     599#endif
    590600            int rc = HWACCMR0Enable(pVM);
    591601            if (VBOX_SUCCESS(rc))
     
    602612            }
    603613            pVM->vmm.s.iLastGCRc = rc;
     614
     615#ifndef RT_OS_WINDOWS /* test on other platforms */
     616            ASMSetFlags(uFlags);
     617#endif
    604618
    605619#ifdef VBOX_WITH_STATISTICS
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