Changeset 9774 in vbox for trunk/src/VBox
- Timestamp:
- Jun 17, 2008 2:55:50 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/IOMInternal.h
r9387 r9774 519 519 520 520 /* Disassembly helpers used in IOMAll.cpp & IOMAllMMIO.cpp */ 521 bool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint 32_t *pu32Data, unsigned *pcbSize);522 bool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, u nsignedu32Data);521 bool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t *pu64Data, unsigned *pcbSize); 522 bool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t u32Data); 523 523 524 524 __END_DECLS -
trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
r9280 r9774 77 77 * @param pParam Pointer to parameter of instruction to proccess. 78 78 * @param pRegFrame Pointer to CPUMCTXCORE guest structure. 79 * @param pu 32Data Where to store retrieved data.80 * @param pcbSize Where to store the size of data (1, 2, 4 ).81 */ 82 bool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint 32_t *pu32Data, unsigned *pcbSize)79 * @param pu64Data Where to store retrieved data. 80 * @param pcbSize Where to store the size of data (1, 2, 4, 8). 81 */ 82 bool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t *pu64Data, unsigned *pcbSize) 83 83 { 84 84 if (pParam->flags & (USE_BASE | USE_INDEX | USE_SCALE | USE_DISPLACEMENT8 | USE_DISPLACEMENT16 | USE_DISPLACEMENT32)) 85 85 { 86 86 *pcbSize = 0; 87 *pu 32Data = 0;87 *pu64Data = 0; 88 88 return false; 89 89 } … … 92 92 { 93 93 *pcbSize = 4; 94 DISFetchReg32(pRegFrame, pParam->base.reg_gen, pu32Data);94 DISFetchReg32(pRegFrame, pParam->base.reg_gen, (uint32_t *)pu64Data); 95 95 return true; 96 96 } … … 99 99 { 100 100 *pcbSize = 2; 101 DISFetchReg16(pRegFrame, pParam->base.reg_gen, (uint16_t *)pu 32Data);101 DISFetchReg16(pRegFrame, pParam->base.reg_gen, (uint16_t *)pu64Data); 102 102 return true; 103 103 } … … 106 106 { 107 107 *pcbSize = 1; 108 DISFetchReg8(pRegFrame, pParam->base.reg_gen, (uint8_t *)pu 32Data);108 DISFetchReg8(pRegFrame, pParam->base.reg_gen, (uint8_t *)pu64Data); 109 109 return true; 110 110 } … … 112 112 if (pParam->flags & USE_REG_GEN64) 113 113 { 114 AssertFailed();115 114 *pcbSize = 8; 116 ///DISFetchReg64(pRegFrame, pParam->base.reg_gen, pu32Data);115 DISFetchReg64(pRegFrame, pParam->base.reg_gen, pu64Data); 117 116 return true; 118 117 } … … 120 119 if (pParam->flags & (USE_IMMEDIATE64)) 121 120 { 122 AssertFailed();123 121 *pcbSize = 8; 124 *pu 32Data = (uint32_t)pParam->parval;122 *pu64Data = pParam->parval; 125 123 return true; 126 124 } … … 129 127 { 130 128 *pcbSize = 4; 131 *pu 32Data = (uint32_t)pParam->parval;129 *pu64Data = (uint32_t)pParam->parval; 132 130 return true; 133 131 } … … 136 134 { 137 135 *pcbSize = 2; 138 *pu 32Data = (uint16_t)pParam->parval;136 *pu64Data = (uint16_t)pParam->parval; 139 137 return true; 140 138 } … … 143 141 { 144 142 *pcbSize = 1; 145 *pu 32Data = (uint8_t)pParam->parval;143 *pu64Data = (uint8_t)pParam->parval; 146 144 return true; 147 145 } … … 150 148 { 151 149 *pcbSize = 2; 152 DISFetchRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL *)pu 32Data);150 DISFetchRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL *)pu64Data); 153 151 return true; 154 152 } /* Else - error. */ … … 156 154 AssertFailed(); 157 155 *pcbSize = 0; 158 *pu 32Data = 0;156 *pu64Data = 0; 159 157 return false; 160 158 } … … 169 167 * @param pParam Pointer to parameter of instruction to proccess. 170 168 * @param pRegFrame Pointer to CPUMCTXCORE guest structure. 171 * @param u 32Data 8/16/32bit data to store.172 */ 173 bool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, u nsigned u32Data)174 { 175 if (pParam->flags & (USE_BASE | USE_INDEX | USE_SCALE | USE_DISPLACEMENT8 | USE_DISPLACEMENT16 | USE_DISPLACEMENT32 | USE_ IMMEDIATE8 | USE_IMMEDIATE16 | USE_IMMEDIATE32 | USE_IMMEDIATE32_SX8 | USE_IMMEDIATE16_SX8))169 * @param u64Data 8/16/32/64 bit data to store. 170 */ 171 bool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t u64Data) 172 { 173 if (pParam->flags & (USE_BASE | USE_INDEX | USE_SCALE | USE_DISPLACEMENT8 | USE_DISPLACEMENT16 | USE_DISPLACEMENT32 | USE_DISPLACEMENT64 | USE_IMMEDIATE8 | USE_IMMEDIATE16 | USE_IMMEDIATE32 | USE_IMMEDIATE32_SX8 | USE_IMMEDIATE16_SX8)) 176 174 { 177 175 return false; … … 180 178 if (pParam->flags & USE_REG_GEN32) 181 179 { 182 DISWriteReg32(pRegFrame, pParam->base.reg_gen, u32Data); 180 DISWriteReg32(pRegFrame, pParam->base.reg_gen, (uint32_t)u64Data); 181 return true; 182 } 183 184 if (pParam->flags & USE_REG_GEN64) 185 { 186 DISWriteReg64(pRegFrame, pParam->base.reg_gen, u64Data); 183 187 return true; 184 188 } … … 186 190 if (pParam->flags & USE_REG_GEN16) 187 191 { 188 DISWriteReg16(pRegFrame, pParam->base.reg_gen, (uint16_t)u 32Data);192 DISWriteReg16(pRegFrame, pParam->base.reg_gen, (uint16_t)u64Data); 189 193 return true; 190 194 } … … 192 196 if (pParam->flags & USE_REG_GEN8) 193 197 { 194 DISWriteReg8(pRegFrame, pParam->base.reg_gen, (uint8_t)u 32Data);198 DISWriteReg8(pRegFrame, pParam->base.reg_gen, (uint8_t)u64Data); 195 199 return true; 196 200 } … … 198 202 if (pParam->flags & USE_REG_SEG) 199 203 { 200 DISWriteRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL)u 32Data);204 DISWriteRegSeg(pRegFrame, pParam->base.reg_seg, (RTSEL)u64Data); 201 205 return true; 202 206 } … … 875 879 * And get the register size from the first parameter. 876 880 */ 877 uint 32_t uPort = 0;881 uint64_t uPort = 0; 878 882 unsigned cbSize = 0; 879 883 bool fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uPort, &cbSize); … … 934 938 * And get the register size and value from the second parameter. 935 939 */ 936 uint 32_t uPort = 0;940 uint64_t uPort = 0; 937 941 unsigned cbSize = 0; 938 942 bool fRc = iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uPort, &cbSize); … … 942 946 if (rc == VINF_SUCCESS) 943 947 { 944 uint 32_t u32Data = 0;945 fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &u 32Data, &cbSize);948 uint64_t u64Data = 0; 949 fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &u64Data, &cbSize); 946 950 AssertMsg(fRc, ("Failed to get reg value!\n")); NOREF(fRc); 947 951 … … 949 953 * Attempt to write to the port. 950 954 */ 951 rc = IOMIOPortWrite(pVM, uPort, u 32Data, cbSize);955 rc = IOMIOPortWrite(pVM, uPort, u64Data, cbSize); 952 956 AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc)); 953 957 } -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r9764 r9774 235 235 */ 236 236 unsigned cb = 0; 237 uint 32_t u32Data = 0;238 bool fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &u 32Data, &cb);237 uint64_t u64Data = 0; 238 bool fRc = iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &u64Data, &cb); 239 239 AssertMsg(fRc, ("Failed to get reg/imm port number!\n")); NOREF(fRc); 240 240 241 int rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &u 32Data, cb);241 int rc = iomMMIODoWrite(pVM, pRange, GCPhysFault, &u64Data, cb); 242 242 if (rc == VINF_SUCCESS) 243 243 iomMMIOStatLength(pVM, cb); … … 702 702 */ 703 703 unsigned cb = 0; 704 uint 32_t uData1;705 uint 32_t uData2;704 uint64_t uData1; 705 uint64_t uData2; 706 706 int rc; 707 707 if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb)) … … 748 748 { 749 749 unsigned cb = 0; 750 uint 32_t uData1;751 uint 32_t uData2;750 uint64_t uData1; 751 uint64_t uData2; 752 752 bool fAndWrite; 753 753 int rc; … … 778 778 { 779 779 /* Emulate AND and update guest flags. */ 780 uint32_t eflags = EMEmulateAnd( &uData1, uData2, cb);780 uint32_t eflags = EMEmulateAnd((uint32_t *)&uData1, uData2, cb); 781 781 if (fAndWrite) 782 782 /* Store result to MMIO. */ … … 822 822 823 823 unsigned cb = 0; 824 uint 32_t uData1;825 uint 32_t uData2;824 uint64_t uData1; 825 uint64_t uData2; 826 826 int rc; 827 827 … … 845 845 { 846 846 /* Emulate TEST (=AND without write back) and update guest EFLAGS. */ 847 uint32_t eflags = EMEmulateAnd( &uData1, uData2, cb);847 uint32_t eflags = EMEmulateAnd((uint32_t *)&uData1, uData2, cb); 848 848 pRegFrame->eflags.u32 = (pRegFrame->eflags.u32 & ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF)) 849 849 | (eflags & (X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF)); … … 878 878 int rc; 879 879 unsigned cb = 0; 880 uint 32_t uData1;881 uint 32_t uData2;880 uint64_t uData1; 881 uint64_t uData2; 882 882 if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb)) 883 883 { … … 1562 1562 * And get the I/O register size from the opcode / prefix. 1563 1563 */ 1564 uint 32_t Port = 0;1564 uint64_t Port = 0; 1565 1565 unsigned cb = 0; 1566 1566 bool fRc = iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &Port, &cb);
Note:
See TracChangeset
for help on using the changeset viewer.