Changeset 41830 in vbox for trunk/src/VBox/VMM/VMMAll/EMAll.cpp
- Timestamp:
- Jun 19, 2012 2:46:27 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r41824 r41830 660 660 661 661 662 /** 663 * Interpret CPUID given the parameters in the CPU context 664 * 665 * @returns VBox status code. 666 * @param pVM Pointer to the VM. 667 * @param pVCpu Pointer to the VMCPU. 668 * @param pRegFrame The register frame. 669 * 670 */ 671 VMMDECL(int) EMInterpretCpuId(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame) 672 { 673 uint32_t iLeaf = pRegFrame->eax; 674 NOREF(pVM); 675 676 /* cpuid clears the high dwords of the affected 64 bits registers. */ 677 pRegFrame->rax = 0; 678 pRegFrame->rbx = 0; 679 pRegFrame->rcx &= UINT64_C(0x00000000ffffffff); 680 pRegFrame->rdx = 0; 681 682 /* Note: operates the same in 64 and non-64 bits mode. */ 683 CPUMGetGuestCpuId(pVCpu, iLeaf, &pRegFrame->eax, &pRegFrame->ebx, &pRegFrame->ecx, &pRegFrame->edx); 684 Log(("Emulate: CPUID %x -> %08x %08x %08x %08x\n", iLeaf, pRegFrame->eax, pRegFrame->ebx, pRegFrame->ecx, pRegFrame->edx)); 685 return VINF_SUCCESS; 686 } 687 662 688 663 689 /** … … 790 816 791 817 818 /** 819 * MONITOR Emulation. 820 */ 821 VMMDECL(int) EMInterpretMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame) 822 { 823 uint32_t u32Dummy, u32ExtFeatures, cpl; 824 NOREF(pVM); 825 826 if (pRegFrame->ecx != 0) 827 { 828 Log(("emInterpretMonitor: unexpected ecx=%x -> recompiler!!\n", pRegFrame->ecx)); 829 return VERR_EM_INTERPRETER; /* illegal value. */ 830 } 831 832 /* Get the current privilege level. */ 833 cpl = CPUMGetGuestCPL(pVCpu, pRegFrame); 834 if (cpl != 0) 835 return VERR_EM_INTERPRETER; /* supervisor only */ 836 837 CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Dummy); 838 if (!(u32ExtFeatures & X86_CPUID_FEATURE_ECX_MONITOR)) 839 return VERR_EM_INTERPRETER; /* not supported */ 840 841 EMMonitorWaitPrepare(pVCpu, pRegFrame->rax, pRegFrame->rcx, pRegFrame->rdx); 842 return VINF_SUCCESS; 843 } 844 845 792 846 793 847 /* VT-x only: */ 848 849 /** 850 * Interpret INVLPG 851 * 852 * @returns VBox status code. 853 * @param pVM Pointer to the VM. 854 * @param pVCpu Pointer to the VMCPU. 855 * @param pRegFrame The register frame. 856 * @param pAddrGC Operand address 857 * 858 */ 859 VMMDECL(VBOXSTRICTRC) EMInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pAddrGC) 860 { 861 /** @todo is addr always a flat linear address or ds based 862 * (in absence of segment override prefixes)???? 863 */ 864 NOREF(pVM); NOREF(pRegFrame); 865 #ifdef IN_RC 866 LogFlow(("RC: EMULATE: invlpg %RGv\n", pAddrGC)); 867 #endif 868 VBOXSTRICTRC rc = PGMInvalidatePage(pVCpu, pAddrGC); 869 if ( rc == VINF_SUCCESS 870 || rc == VINF_PGM_SYNC_CR3 /* we can rely on the FF */) 871 return VINF_SUCCESS; 872 AssertMsgReturn(rc == VINF_EM_RAW_EMULATE_INSTR, 873 ("%Rrc addr=%RGv\n", VBOXSTRICTRC_VAL(rc), pAddrGC), 874 VERR_EM_INTERPRETER); 875 return rc; 876 } 877 794 878 795 879 /** … … 2439 2523 2440 2524 /** 2441 * Interpret INVLPG2442 *2443 * @returns VBox status code.2444 * @param pVM Pointer to the VM.2445 * @param pVCpu Pointer to the VMCPU.2446 * @param pRegFrame The register frame.2447 * @param pAddrGC Operand address2448 *2449 */2450 VMMDECL(VBOXSTRICTRC) EMInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pAddrGC)2451 {2452 /** @todo is addr always a flat linear address or ds based2453 * (in absence of segment override prefixes)????2454 */2455 NOREF(pVM); NOREF(pRegFrame);2456 #ifdef IN_RC2457 LogFlow(("RC: EMULATE: invlpg %RGv\n", pAddrGC));2458 #endif2459 VBOXSTRICTRC rc = PGMInvalidatePage(pVCpu, pAddrGC);2460 if ( rc == VINF_SUCCESS2461 || rc == VINF_PGM_SYNC_CR3 /* we can rely on the FF */)2462 return VINF_SUCCESS;2463 AssertMsgReturn(rc == VINF_EM_RAW_EMULATE_INSTR,2464 ("%Rrc addr=%RGv\n", VBOXSTRICTRC_VAL(rc), pAddrGC),2465 VERR_EM_INTERPRETER);2466 return rc;2467 }2468 2469 2470 /**2471 2525 * INVLPG Emulation. 2472 2526 */ … … 2513 2567 2514 2568 /** 2515 * Interpret CPUID given the parameters in the CPU context2516 *2517 * @returns VBox status code.2518 * @param pVM Pointer to the VM.2519 * @param pVCpu Pointer to the VMCPU.2520 * @param pRegFrame The register frame.2521 *2522 */2523 VMMDECL(int) EMInterpretCpuId(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)2524 {2525 uint32_t iLeaf = pRegFrame->eax;2526 NOREF(pVM);2527 2528 /* cpuid clears the high dwords of the affected 64 bits registers. */2529 pRegFrame->rax = 0;2530 pRegFrame->rbx = 0;2531 pRegFrame->rcx &= UINT64_C(0x00000000ffffffff);2532 pRegFrame->rdx = 0;2533 2534 /* Note: operates the same in 64 and non-64 bits mode. */2535 CPUMGetGuestCpuId(pVCpu, iLeaf, &pRegFrame->eax, &pRegFrame->ebx, &pRegFrame->ecx, &pRegFrame->edx);2536 Log(("Emulate: CPUID %x -> %08x %08x %08x %08x\n", iLeaf, pRegFrame->eax, pRegFrame->ebx, pRegFrame->ecx, pRegFrame->edx));2537 return VINF_SUCCESS;2538 }2539 2540 2541 /**2542 2569 * CPUID Emulation. 2543 2570 */ … … 2834 2861 2835 2862 2836 /**2837 * MONITOR Emulation.2838 */2839 VMMDECL(int) EMInterpretMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)2840 {2841 uint32_t u32Dummy, u32ExtFeatures, cpl;2842 NOREF(pVM);2843 2844 if (pRegFrame->ecx != 0)2845 {2846 Log(("emInterpretMonitor: unexpected ecx=%x -> recompiler!!\n", pRegFrame->ecx));2847 return VERR_EM_INTERPRETER; /* illegal value. */2848 }2849 2850 /* Get the current privilege level. */2851 cpl = CPUMGetGuestCPL(pVCpu, pRegFrame);2852 if (cpl != 0)2853 return VERR_EM_INTERPRETER; /* supervisor only */2854 2855 CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Dummy);2856 if (!(u32ExtFeatures & X86_CPUID_FEATURE_ECX_MONITOR))2857 return VERR_EM_INTERPRETER; /* not supported */2858 2859 EMMonitorWaitPrepare(pVCpu, pRegFrame->rax, pRegFrame->rcx, pRegFrame->rdx);2860 return VINF_SUCCESS;2861 }2862 2863 2863 static int emInterpretMonitor(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2864 2864 { … … 2866 2866 return EMInterpretMonitor(pVM, pVCpu, pRegFrame); 2867 2867 } 2868 2868 2869 2869 2870 static VBOXSTRICTRC emInterpretMWait(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
Note:
See TracChangeset
for help on using the changeset viewer.