Changeset 1936 in vbox for trunk/src/VBox
- Timestamp:
- Apr 4, 2007 3:06:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMGC/IOMGC.cpp
r1828 r1936 66 66 * Global Variables * 67 67 *******************************************************************************/ 68 /**69 * Array for accessing 32-bit general registers in VMMREGFRAME structure70 * 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 structure91 * 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 structure112 * 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 structure133 * 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])))149 68 150 69 /** … … 289 208 { 290 209 *pcbSize = 4; 291 *pu32Data = ACCESS_REG32(pRegFrame, pParam->base.reg_gen32);210 DISFetchReg32(pRegFrame, pParam->base.reg_gen32, pu32Data); 292 211 return true; 293 212 } … … 296 215 { 297 216 *pcbSize = 2; 298 *pu32Data = ACCESS_REG16(pRegFrame, pParam->base.reg_gen16);217 DISFetchReg16(pRegFrame, pParam->base.reg_gen16, (uint16_t *)pu32Data); 299 218 return true; 300 219 } … … 303 222 { 304 223 *pcbSize = 1; 305 *pu32Data = ACCESS_REG8(pRegFrame, pParam->base.reg_gen8);224 DISFetchReg8(pRegFrame, pParam->base.reg_gen8, (uint8_t *)pu32Data); 306 225 return true; 307 226 } … … 331 250 { 332 251 *pcbSize = 2; 333 *pu32Data = ACCESS_REGSEG(pRegFrame, pParam->base.reg_seg);252 DISFetchRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL *)pu32Data); 334 253 return true; 335 254 } /* Else - error. */ … … 360 279 if (pParam->flags & USE_REG_GEN32) 361 280 { 362 ACCESS_REG32(pRegFrame, pParam->base.reg_gen32) = u32Data;281 DISWriteReg32(pRegFrame, pParam->base.reg_gen32, u32Data); 363 282 return true; 364 283 } … … 366 285 if (pParam->flags & USE_REG_GEN16) 367 286 { 368 ACCESS_REG16(pRegFrame, pParam->base.reg_gen16) = (uint16_t)u32Data;287 DISWriteReg16(pRegFrame, pParam->base.reg_gen16, (uint16_t)u32Data); 369 288 return true; 370 289 } … … 372 291 if (pParam->flags & USE_REG_GEN8) 373 292 { 374 ACCESS_REG8(pRegFrame, pParam->base.reg_gen8) = (uint8_t)u32Data;293 DISWriteReg8(pRegFrame, pParam->base.reg_gen8, (uint8_t)u32Data); 375 294 return true; 376 295 } … … 378 297 if (pParam->flags & USE_REG_SEG) 379 298 { 380 ACCESS_REGSEG(pRegFrame, pParam->base.reg_seg) = (uint16_t)u32Data;299 DISWriteRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL)u32Data); 381 300 return true; 382 301 }
Note:
See TracChangeset
for help on using the changeset viewer.