Changeset 25835 in vbox for trunk/include
- Timestamp:
- Jan 14, 2010 4:27:58 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56615
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/cpum.h
r24061 r25835 661 661 VMMDECL(uint64_t) CPUMGetGuestMsr(PVMCPU pVCpu, unsigned idMsr); 662 662 VMMDECL(void) CPUMSetGuestMsr(PVMCPU pVCpu, unsigned idMsr, uint64_t valMsr); 663 VMMDECL(CPUMCPUVENDOR) CPUMGetGuestCpuVendor(PVM pVM); 664 VMMDECL(CPUMCPUVENDOR) CPUMGetHostCpuVendor(PVM pVM); 663 665 /** @} */ 664 666 … … 703 705 /** @} */ 704 706 707 705 708 /** @name Misc Guest Predicate Functions. 706 709 * @{ */ 707 710 708 709 VMMDECL(bool) CPUMIsGuestIn16BitCode(PVMCPU pVCpu); 710 VMMDECL(bool) CPUMIsGuestIn32BitCode(PVMCPU pVCpu); 711 712 VMMDECL(CPUMCPUVENDOR) CPUMGetGuestCpuVendor(PVM pVM); 713 VMMDECL(CPUMCPUVENDOR) CPUMGetHostCpuVendor(PVM pVM); 714 715 /** 716 * Tests if the guest is running in real mode or not. 717 * 718 * @returns true if in real mode, otherwise false. 719 * @param pVM The VM handle. 720 */ 721 DECLINLINE(bool) CPUMIsGuestInRealMode(PVMCPU pVCpu) 722 { 723 return !(CPUMGetGuestCR0(pVCpu) & X86_CR0_PE); 724 } 711 VMMDECL(bool) CPUMIsGuestIn16BitCode(PVMCPU pVCpu); 712 VMMDECL(bool) CPUMIsGuestIn32BitCode(PVMCPU pVCpu); 713 VMMDECL(bool) CPUMIsGuestNXEnabled(PVMCPU pVCpu); 714 VMMDECL(bool) CPUMIsGuestInRealMode(PVMCPU pVCpu); 715 VMMDECL(bool) CPUMIsGuestInProtectedMode(PVMCPU pVCpu); 716 VMMDECL(bool) CPUMIsGuestInPagedProtectedMode(PVMCPU pVCpu); 717 VMMDECL(bool) CPUMIsGuestInLongMode(PVMCPU pVCpu); 718 VMMDECL(bool) CPUMIsGuestInPAEMode(PVMCPU pVCpu); 725 719 726 720 /** … … 730 724 * @param pCtx Current CPU context 731 725 */ 732 DECLINLINE(bool) CPUMIsGuestInRealModeEx(PCPUMCTX pCtx)726 DECLINLINE(bool) CPUMIsGuestInRealModeEx(PCPUMCTX pCtx) 733 727 { 734 728 return !(pCtx->cr0 & X86_CR0_PE); … … 736 730 737 731 /** 738 * Tests if the guest is running in protected or not.739 *740 * @returns true if in protected mode, otherwise false.741 * @param pVM The VM handle.742 */743 DECLINLINE(bool) CPUMIsGuestInProtectedMode(PVMCPU pVCpu)744 {745 return !!(CPUMGetGuestCR0(pVCpu) & X86_CR0_PE);746 }747 748 /**749 732 * Tests if the guest is running in paged protected or not. 750 733 * … … 752 735 * @param pVM The VM handle. 753 736 */ 754 DECLINLINE(bool) CPUMIsGuestInPagedProtectedMode(PVMCPU pVCpu) 755 { 756 return (CPUMGetGuestCR0(pVCpu) & (X86_CR0_PE | X86_CR0_PG)) == (X86_CR0_PE | X86_CR0_PG); 757 } 758 759 /** 760 * Tests if the guest is running in paged protected or not. 761 * 762 * @returns true if in paged protected mode, otherwise false. 763 * @param pVM The VM handle. 764 */ 765 DECLINLINE(bool) CPUMIsGuestInPagedProtectedModeEx(PCPUMCTX pCtx) 737 DECLINLINE(bool) CPUMIsGuestInPagedProtectedModeEx(PCPUMCTX pCtx) 766 738 { 767 739 return (pCtx->cr0 & (X86_CR0_PE | X86_CR0_PG)) == (X86_CR0_PE | X86_CR0_PG); … … 772 744 * 773 745 * @returns true if in long mode, otherwise false. 774 * @param pVM The VM handle.775 */776 DECLINLINE(bool) CPUMIsGuestInLongMode(PVMCPU pVCpu)777 {778 return (CPUMGetGuestEFER(pVCpu) & MSR_K6_EFER_LMA) == MSR_K6_EFER_LMA;779 }780 781 /**782 * Tests if the guest is running in long mode or not.783 *784 * @returns true if in long mode, otherwise false.785 746 * @param pCtx Current CPU context 786 747 */ 787 DECLINLINE(bool) CPUMIsGuestInLongModeEx(PCPUMCTX pCtx)748 DECLINLINE(bool) CPUMIsGuestInLongModeEx(PCPUMCTX pCtx) 788 749 { 789 750 return (pCtx->msrEFER & MSR_K6_EFER_LMA) == MSR_K6_EFER_LMA; … … 797 758 * @param pCtx Current CPU context 798 759 */ 799 DECLINLINE(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu, PCCPUMCTXCORE pCtx)760 DECLINLINE(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu, PCCPUMCTXCORE pCtx) 800 761 { 801 762 if (!CPUMIsGuestInLongMode(pVCpu)) … … 812 773 * @param pCtx Current CPU context 813 774 */ 814 DECLINLINE(bool) CPUMIsGuestIn64BitCodeEx(PCCPUMCTX pCtx)775 DECLINLINE(bool) CPUMIsGuestIn64BitCodeEx(PCCPUMCTX pCtx) 815 776 { 816 777 if (!(pCtx->msrEFER & MSR_K6_EFER_LMA)) … … 824 785 * 825 786 * @returns true if in PAE mode, otherwise false. 826 * @param pVM The VM handle.827 */828 DECLINLINE(bool) CPUMIsGuestInPAEMode(PVMCPU pVCpu)829 {830 return ( CPUMIsGuestInPagedProtectedMode(pVCpu)831 && (CPUMGetGuestCR4(pVCpu) & X86_CR4_PAE)832 && !CPUMIsGuestInLongMode(pVCpu));833 }834 835 /**836 * Tests if the guest is running in PAE mode or not.837 *838 * @returns true if in PAE mode, otherwise false.839 787 * @param pCtx Current CPU context 840 788 */ 841 DECLINLINE(bool) CPUMIsGuestInPAEModeEx(PCPUMCTX pCtx)842 { 843 return ( CPUMIsGuestInPagedProtectedModeEx(pCtx)844 && (pCtx->cr4 & X86_CR4_PAE)789 DECLINLINE(bool) CPUMIsGuestInPAEModeEx(PCPUMCTX pCtx) 790 { 791 return ( (pCtx->cr4 & X86_CR4_PAE) 792 && CPUMIsGuestInPagedProtectedModeEx(pCtx) 845 793 && !CPUMIsGuestInLongModeEx(pCtx)); 846 794 }
Note:
See TracChangeset
for help on using the changeset viewer.