VirtualBox

Changeset 1936 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 4, 2007 3:06:13 PM (18 years ago)
Author:
vboxsync
Message:

Use new disassembler functions. Remove obsolete tables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMGC/IOMGC.cpp

    r1828 r1936  
    6666*   Global Variables                                                           *
    6767*******************************************************************************/
    68 /**
    69  * Array for accessing 32-bit general registers in VMMREGFRAME structure
    70  * by register's index from disasm.
    71  */
    72 static unsigned g_aReg32Index[] =
    73 {
    74     RT_OFFSETOF(CPUMCTXCORE, eax),        /* USE_REG_EAX */
    75     RT_OFFSETOF(CPUMCTXCORE, ecx),        /* USE_REG_ECX */
    76     RT_OFFSETOF(CPUMCTXCORE, edx),        /* USE_REG_EDX */
    77     RT_OFFSETOF(CPUMCTXCORE, ebx),        /* USE_REG_EBX */
    78     RT_OFFSETOF(CPUMCTXCORE, esp),        /* USE_REG_ESP */
    79     RT_OFFSETOF(CPUMCTXCORE, ebp),        /* USE_REG_EBP */
    80     RT_OFFSETOF(CPUMCTXCORE, esi),        /* USE_REG_ESI */
    81     RT_OFFSETOF(CPUMCTXCORE, edi)         /* USE_REG_EDI */
    82 };
    83 
    84 /**
    85  * Macro for accessing 32-bit general purpose registers in CPUMCTXCORE structure.
    86  */
    87 #define ACCESS_REG32(p, idx) (*((uint32_t *)((char *)(p) + g_aReg32Index[idx])))
    88 
    89 /**
    90  * Array for accessing 16-bit general registers in CPUMCTXCORE structure
    91  * by register's index from disasm.
    92  */
    93 static unsigned g_aReg16Index[] =
    94 {
    95     RT_OFFSETOF(CPUMCTXCORE, eax),        /* USE_REG_AX */
    96     RT_OFFSETOF(CPUMCTXCORE, ecx),        /* USE_REG_CX */
    97     RT_OFFSETOF(CPUMCTXCORE, edx),        /* USE_REG_DX */
    98     RT_OFFSETOF(CPUMCTXCORE, ebx),        /* USE_REG_BX */
    99     RT_OFFSETOF(CPUMCTXCORE, esp),        /* USE_REG_SP */
    100     RT_OFFSETOF(CPUMCTXCORE, ebp),        /* USE_REG_BP */
    101     RT_OFFSETOF(CPUMCTXCORE, esi),        /* USE_REG_SI */
    102     RT_OFFSETOF(CPUMCTXCORE, edi)         /* USE_REG_DI */
    103 };
    104 
    105 /**
    106  * Macro for accessing 16-bit general purpose registers in CPUMCTXCORE structure.
    107  */
    108 #define ACCESS_REG16(p, idx) (*((uint16_t *)((char *)(p) + g_aReg16Index[idx])))
    109 
    110 /**
    111  * Array for accessing 8-bit general registers in CPUMCTXCORE structure
    112  * by register's index from disasm.
    113  */
    114 static unsigned g_aReg8Index[] =
    115 {
    116     RT_OFFSETOF(CPUMCTXCORE, eax),        /* USE_REG_AL */
    117     RT_OFFSETOF(CPUMCTXCORE, ecx),        /* USE_REG_CL */
    118     RT_OFFSETOF(CPUMCTXCORE, edx),        /* USE_REG_DL */
    119     RT_OFFSETOF(CPUMCTXCORE, ebx),        /* USE_REG_BL */
    120     RT_OFFSETOF(CPUMCTXCORE, eax) + 1,    /* USE_REG_AH */
    121     RT_OFFSETOF(CPUMCTXCORE, ecx) + 1,    /* USE_REG_CH */
    122     RT_OFFSETOF(CPUMCTXCORE, edx) + 1,    /* USE_REG_DH */
    123     RT_OFFSETOF(CPUMCTXCORE, ebx) + 1     /* USE_REG_BH */
    124 };
    125 
    126 /**
    127  * Macro for accessing 8-bit general purpose registers in CPUMCTXCORE structure.
    128  */
    129 #define ACCESS_REG8(p, idx) (*((uint8_t *)((char *)(p) + g_aReg8Index[idx])))
    130 
    131 /**
    132  * Array for accessing segment registers in CPUMCTXCORE structure
    133  * by register's index from disasm.
    134  */
    135 static unsigned g_aRegSegIndex[] =
    136 {
    137     RT_OFFSETOF(CPUMCTXCORE, es),         /* USE_REG_ES */
    138     RT_OFFSETOF(CPUMCTXCORE, cs),         /* USE_REG_CS */
    139     RT_OFFSETOF(CPUMCTXCORE, ss),         /* USE_REG_SS */
    140     RT_OFFSETOF(CPUMCTXCORE, ds),         /* USE_REG_DS */
    141     RT_OFFSETOF(CPUMCTXCORE, fs),         /* USE_REG_FS */
    142     RT_OFFSETOF(CPUMCTXCORE, gs)          /* USE_REG_GS */
    143 };
    144 
    145 /**
    146  * Macro for accessing segment registers in CPUMCTXCORE structure.
    147  */
    148 #define ACCESS_REGSEG(p, idx) (*((uint16_t *)((char *)(p) + g_aRegSegIndex[idx])))
    14968
    15069/**
     
    289208    {
    290209        *pcbSize  = 4;
    291         *pu32Data = ACCESS_REG32(pRegFrame, pParam->base.reg_gen32);
     210        DISFetchReg32(pRegFrame, pParam->base.reg_gen32, pu32Data);
    292211        return true;
    293212    }
     
    296215    {
    297216        *pcbSize  = 2;
    298         *pu32Data = ACCESS_REG16(pRegFrame, pParam->base.reg_gen16);
     217        DISFetchReg16(pRegFrame, pParam->base.reg_gen16, (uint16_t *)pu32Data);
    299218        return true;
    300219    }
     
    303222    {
    304223        *pcbSize  = 1;
    305         *pu32Data = ACCESS_REG8(pRegFrame, pParam->base.reg_gen8);
     224        DISFetchReg8(pRegFrame, pParam->base.reg_gen8, (uint8_t *)pu32Data);
    306225        return true;
    307226    }
     
    331250    {
    332251        *pcbSize  = 2;
    333         *pu32Data = ACCESS_REGSEG(pRegFrame, pParam->base.reg_seg);
     252        DISFetchRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL *)pu32Data);
    334253        return true;
    335254    } /* Else - error. */
     
    360279    if (pParam->flags & USE_REG_GEN32)
    361280    {
    362         ACCESS_REG32(pRegFrame, pParam->base.reg_gen32) = u32Data;
     281        DISWriteReg32(pRegFrame, pParam->base.reg_gen32, u32Data);
    363282        return true;
    364283    }
     
    366285    if (pParam->flags & USE_REG_GEN16)
    367286    {
    368         ACCESS_REG16(pRegFrame, pParam->base.reg_gen16) = (uint16_t)u32Data;
     287        DISWriteReg16(pRegFrame, pParam->base.reg_gen16, (uint16_t)u32Data);
    369288        return true;
    370289    }
     
    372291    if (pParam->flags & USE_REG_GEN8)
    373292    {
    374         ACCESS_REG8(pRegFrame, pParam->base.reg_gen8) = (uint8_t)u32Data;
     293        DISWriteReg8(pRegFrame, pParam->base.reg_gen8, (uint8_t)u32Data);
    375294        return true;
    376295    }
     
    378297    if (pParam->flags & USE_REG_SEG)
    379298    {
    380         ACCESS_REGSEG(pRegFrame, pParam->base.reg_seg) = (uint16_t)u32Data;
     299        DISWriteRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL)u32Data);
    381300        return true;
    382301    }
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