- Timestamp:
- Jul 31, 2019 11:43:16 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmReg.cpp
r76553 r80071 25 25 #include <iprt/errcore.h> 26 26 #include <VBox/log.h> 27 #include <VBox/vmm/cpum.h> 27 #ifdef RT_ARCH_AMD64 28 # include <VBox/vmm/cpum.h> 29 #endif 28 30 #include <iprt/assert.h> 29 31 #include <iprt/string.h> … … 35 37 * Global Variables * 36 38 *********************************************************************************************************************************/ 39 #ifdef RT_ARCH_AMD64 37 40 38 41 /** … … 63 66 * Macro for accessing 64-bit general purpose registers in CPUMCTXCORE structure. 64 67 */ 65 # define DIS_READ_REG64(p, idx) (*(uint64_t *)((char *)(p) + g_aReg64Index[idx]))66 # define DIS_WRITE_REG64(p, idx, val) (*(uint64_t *)((char *)(p) + g_aReg64Index[idx]) = val)67 # define DIS_PTR_REG64(p, idx) ( (uint64_t *)((char *)(p) + g_aReg64Index[idx]))68 # define DIS_READ_REG64(p, idx) (*(uint64_t *)((char *)(p) + g_aReg64Index[idx])) 69 # define DIS_WRITE_REG64(p, idx, val) (*(uint64_t *)((char *)(p) + g_aReg64Index[idx]) = val) 70 # define DIS_PTR_REG64(p, idx) ( (uint64_t *)((char *)(p) + g_aReg64Index[idx])) 68 71 69 72 /** … … 94 97 * Macro for accessing 32-bit general purpose registers in CPUMCTXCORE structure. 95 98 */ 96 # define DIS_READ_REG32(p, idx) (*(uint32_t *)((char *)(p) + g_aReg32Index[idx]))99 # define DIS_READ_REG32(p, idx) (*(uint32_t *)((char *)(p) + g_aReg32Index[idx])) 97 100 /* From http://www.cs.cmu.edu/~fp/courses/15213-s06/misc/asm64-handout.pdf: 98 101 * ``Perhaps unexpectedly, instructions that move or generate 32-bit register … … 100 103 * there is no need for an instruction movzlq.'' 101 104 */ 102 # define DIS_WRITE_REG32(p, idx, val) (*(uint64_t *)((char *)(p) + g_aReg32Index[idx]) = (uint32_t)val)103 # define DIS_PTR_REG32(p, idx) ( (uint32_t *)((char *)(p) + g_aReg32Index[idx]))105 # define DIS_WRITE_REG32(p, idx, val) (*(uint64_t *)((char *)(p) + g_aReg32Index[idx]) = (uint32_t)val) 106 # define DIS_PTR_REG32(p, idx) ( (uint32_t *)((char *)(p) + g_aReg32Index[idx])) 104 107 105 108 /** … … 130 133 * Macro for accessing 16-bit general purpose registers in CPUMCTXCORE structure. 131 134 */ 132 # define DIS_READ_REG16(p, idx) (*(uint16_t *)((char *)(p) + g_aReg16Index[idx]))133 # define DIS_WRITE_REG16(p, idx, val) (*(uint16_t *)((char *)(p) + g_aReg16Index[idx]) = val)134 # define DIS_PTR_REG16(p, idx) ( (uint16_t *)((char *)(p) + g_aReg16Index[idx]))135 # define DIS_READ_REG16(p, idx) (*(uint16_t *)((char *)(p) + g_aReg16Index[idx])) 136 # define DIS_WRITE_REG16(p, idx, val) (*(uint16_t *)((char *)(p) + g_aReg16Index[idx]) = val) 137 # define DIS_PTR_REG16(p, idx) ( (uint16_t *)((char *)(p) + g_aReg16Index[idx])) 135 138 136 139 /** … … 165 168 * Macro for accessing 8-bit general purpose registers in CPUMCTXCORE structure. 166 169 */ 167 # define DIS_READ_REG8(p, idx) (*(uint8_t *)((char *)(p) + g_aReg8Index[idx]))168 # define DIS_WRITE_REG8(p, idx, val) (*(uint8_t *)((char *)(p) + g_aReg8Index[idx]) = val)169 # define DIS_PTR_REG8(p, idx) ( (uint8_t *)((char *)(p) + g_aReg8Index[idx]))170 # define DIS_READ_REG8(p, idx) (*(uint8_t *)((char *)(p) + g_aReg8Index[idx])) 171 # define DIS_WRITE_REG8(p, idx, val) (*(uint8_t *)((char *)(p) + g_aReg8Index[idx]) = val) 172 # define DIS_PTR_REG8(p, idx) ( (uint8_t *)((char *)(p) + g_aReg8Index[idx])) 170 173 171 174 /** … … 196 199 * Macro for accessing segment registers in CPUMCTXCORE structure. 197 200 */ 198 #define DIS_READ_REGSEG(p, idx) (*((uint16_t *)((char *)(p) + g_aRegSegIndex[idx]))) 199 #define DIS_WRITE_REGSEG(p, idx, val) (*((uint16_t *)((char *)(p) + g_aRegSegIndex[idx])) = val) 201 # define DIS_READ_REGSEG(p, idx) (*((uint16_t *)((char *)(p) + g_aRegSegIndex[idx]))) 202 # define DIS_WRITE_REGSEG(p, idx, val) (*((uint16_t *)((char *)(p) + g_aRegSegIndex[idx])) = val) 203 204 #endif /* RT_ARCH_AMD64 */ 205 200 206 201 207 //***************************************************************************** … … 334 340 335 341 342 #ifdef RT_ARCH_AMD64 343 336 344 /** 337 345 * Returns the value of the specified 8 bits general purpose register … … 835 843 } 836 844 845 #endif /* RT_ARCH_AMD64 */ 846
Note:
See TracChangeset
for help on using the changeset viewer.