Changeset 10473 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jul 10, 2008 3:02:53 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33146
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r10362 r10473 51 51 * Structures and Typedefs * 52 52 *******************************************************************************/ 53 typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM2_UINT32(void *pvParam1, uint64_t val2);54 typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM2(void *pvParam1, size_t val2);55 typedef DECLCALLBACK(uint32_t) PFN_EMULATE_PARAM3(void *pvParam1, uint64_t val2, size_t val3);56 typedef DECLCALLBACK(int) FNEMULATELOCKPARAM2(void *pvParam1, uint64_t val2, RTGCUINTREG32 *pf);57 typedef FNEMULATELOCKPARAM2 *PFNEMULATELOCKPARAM2;58 typedef DECLCALLBACK(int) FNEMULATELOCKPARAM3(void *pvParam1, uint64_t val2, size_t cb, RTGCUINTREG32 *pf);59 typedef FNEMULATELOCKPARAM3 *PFNEMULATELOCKPARAM3;60 53 61 54 -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r10382 r10473 748 748 * AND [MMIO], reg|imm 749 749 * AND reg, [MMIO] 750 * OR [MMIO], reg|imm 751 * OR reg, [MMIO] 750 752 * 751 753 * Restricted implementation. … … 759 761 * @param pCpu Disassembler CPU state. 760 762 * @param pRange Pointer MMIO range. 761 */ 762 static int iomInterpretAND(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, PDISCPUSTATE pCpu, PIOMMMIORANGE pRange) 763 * @param pfnEmulate Instruction emulation function. 764 */ 765 static int iomInterpretOrXorAnd(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, PDISCPUSTATE pCpu, PIOMMMIORANGE pRange, PFN_EMULATE_PARAM3 pfnEmulate) 763 766 { 764 767 unsigned cb = 0; … … 767 770 bool fAndWrite; 768 771 int rc; 772 773 #ifdef LOG_ENABLED 774 const char *pszInstr; 775 776 if (pCpu->pCurInstr->opcode == OP_XOR) 777 pszInstr = "Xor"; 778 else if (pCpu->pCurInstr->opcode == OP_OR) 779 pszInstr = "Or"; 780 else if (pCpu->pCurInstr->opcode == OP_AND) 781 pszInstr = "And"; 782 else 783 pszInstr = "OrXorAnd??"; 784 #endif 785 769 786 if (iomGetRegImmData(pCpu, &pCpu->param1, pRegFrame, &uData1, &cb)) 770 787 { … … 793 810 { 794 811 /* Emulate AND and update guest flags. */ 795 uint32_t eflags = EMEmulateAnd((uint32_t *)&uData1, uData2, cb); 812 uint32_t eflags = pfnEmulate((uint32_t *)&uData1, uData2, cb); 813 814 LogFlow(("iomInterpretOrXorAnd %s result %RX64\n", pszInstr, uData1)); 815 796 816 if (fAndWrite) 797 817 /* Store result to MMIO. */ … … 815 835 } 816 836 817 818 819 837 /** 820 838 * TEST [MMIO], reg|imm … … 863 881 pRegFrame->eflags.u32 = (pRegFrame->eflags.u32 & ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF)) 864 882 | (eflags & (X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF)); 883 iomMMIOStatLength(pVM, cb); 884 } 885 886 return rc; 887 } 888 889 /** 890 * BT [MMIO], reg|imm 891 * 892 * Restricted implementation. 893 * 894 * 895 * @returns VBox status code. 896 * 897 * @param pVM The virtual machine (GC pointer ofcourse). 898 * @param pRegFrame Trap register frame. 899 * @param GCPhysFault The GC physical address corresponding to pvFault. 900 * @param pCpu Disassembler CPU state. 901 * @param pRange Pointer MMIO range. 902 */ 903 static int iomInterpretBT(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, PDISCPUSTATE pCpu, PIOMMMIORANGE pRange) 904 { 905 Assert(pRange->CTXALLSUFF(pfnReadCallback) || !pRange->pfnReadCallbackR3); 906 907 uint64_t uBit; 908 uint64_t uData1; 909 int rc; 910 unsigned cb; 911 912 if (iomGetRegImmData(pCpu, &pCpu->param2, pRegFrame, &uBit, &cb)) 913 { 914 /* bt [MMIO], reg|imm. */ 915 rc = iomMMIODoRead(pVM, pRange, GCPhysFault, &uData1, cb); 916 } 917 else 918 { 919 AssertMsgFailed(("Disassember BT problem..\n")); 920 return VERR_IOM_MMIO_HANDLER_DISASM_ERROR; 921 } 922 923 if (rc == VINF_SUCCESS) 924 { 925 /* The size of the memory operand only matters here. */ 926 cb = DISGetParamSize(pCpu, &pCpu->param1); 927 928 /* Find the bit inside the faulting address */ 929 uBit &= (cb*8 - 1); 930 931 pRegFrame->eflags.Bits.u1CF = (uData1 >> uBit); 865 932 iomMMIOStatLength(pVM, cb); 866 933 } … … 1062 1129 case OP_AND: 1063 1130 STAM_PROFILE_START(&pVM->iom.s.StatGCInstAnd, g); 1064 rc = iomInterpret AND(pVM, pCtxCore, GCPhysFault, &Cpu, pRange);1131 rc = iomInterpretOrXorAnd(pVM, pCtxCore, GCPhysFault, &Cpu, pRange, EMEmulateAnd); 1065 1132 STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstAnd, g); 1133 break; 1134 1135 case OP_OR: 1136 STAM_PROFILE_START(&pVM->iom.s.StatGCInstOr, k); 1137 rc = iomInterpretOrXorAnd(pVM, pCtxCore, GCPhysFault, &Cpu, pRange, EMEmulateOr); 1138 STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstOr, k); 1139 break; 1140 1141 case OP_XOR: 1142 STAM_PROFILE_START(&pVM->iom.s.StatGCInstXor, m); 1143 rc = iomInterpretOrXorAnd(pVM, pCtxCore, GCPhysFault, &Cpu, pRange, EMEmulateXor); 1144 STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstXor, m); 1066 1145 break; 1067 1146 … … 1071 1150 rc = iomInterpretTEST(pVM, pCtxCore, GCPhysFault, &Cpu, pRange); 1072 1151 STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstTest, h); 1152 break; 1153 1154 case OP_BT: 1155 Assert(!(uErrorCode & X86_TRAP_PF_RW)); 1156 STAM_PROFILE_START(&pVM->iom.s.StatGCInstBt, l); 1157 rc = iomInterpretBT(pVM, pCtxCore, GCPhysFault, &Cpu, pRange); 1158 STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstBt, l); 1073 1159 break; 1074 1160
Note:
See TracChangeset
for help on using the changeset viewer.