cpum.h revision 90e6b90c36958bb8eb46e30484412e9b500612d6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CPUM - CPU Monitor(/ Manager).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (C) 2006-2013 Oracle Corporation
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This file is part of VirtualBox Open Source Edition (OSE), as
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * available from http://www.virtualbox.org. This file is free software;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * you can redistribute it and/or modify it under the terms of the GNU
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * General Public License (GPL) as published by the Free Software
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Foundation, in version 2 as it comes in the "COPYING" file of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file may alternatively be used under the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License Version 1.0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * VirtualBox OSE distribution, in which case the provisions of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CDDL are applicable instead of those of the GPL.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You may elect to license modified versions of this file under the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * terms and conditions of either the GPL or the CDDL or both.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/** @defgroup grp_cpum The CPU Monitor / Manager API
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CPUID feature to set or clear.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The APIC feature bit. (Std+Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The sysenter/sysexit feature bit. (Std) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The SYSCALL/SYSEXIT feature bit (64 bits mode only for Intel CPUs). (Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The PAE feature bit. (Std+Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The NX feature bit. (Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The LAHF/SAHF feature bit (64 bits mode only). (Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The LONG MODE feature bit. (Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The PAT feature bit. (Std+Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The x2APIC feature bit. (Std) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The RDTSCP feature bit. (Ext) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** The Hypervisor Present bit. (Std) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** 32bit hackishness. */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CPU Vendor.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** 32bit hackishness. */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * X86 and AMD64 CPU microarchitectures and in processor generations.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @remarks The separation here is sometimes a little bit too finely grained,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and the differences is more like processor generation than micro
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * arch. This can be useful, so we'll provide functions for getting at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * more coarse grained info.
kCpumMicroarch_Intel_NB_Gallatin, /**< 90nm Xeon, Pentium 4 Extreme Edition ("Emergency Edition"). */
kCpumMicroarch_AMD_K8_130nm = kCpumMicroarch_AMD_K8_First, /**< 130nm Clawhammer, Sledgehammer, Newcastle, Paris, Odessa, Dublin */
((a_enmMicroarch) >= kCpumMicroarch_Intel_NB_First && (a_enmMicroarch) <= kCpumMicroarch_Intel_NB_End)
((a_enmMicroarch) >= kCpumMicroarch_Intel_Core7_First && (a_enmMicroarch) <= kCpumMicroarch_Intel_Core7_End)
#define CPUMMICROARCH_IS_AMD_FAM_11H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_K10_Lion)
#define CPUMMICROARCH_IS_AMD_FAM_12H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_K10_Llano)
#define CPUMMICROARCH_IS_AMD_FAM_14H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_Bobcat)
((a_enmMicroarch) >= kCpumMicroarch_AMD_15h_First && (a_enmMicroarch) <= kCpumMicroarch_AMD_15h_End)
((a_enmMicroarch) >= kCpumMicroarch_AMD_16h_First && (a_enmMicroarch) <= kCpumMicroarch_AMD_16h_End)
typedef struct CPUMCPUIDLEAF
typedef enum CPUMUKNOWNCPUID
VMMDECL(void) CPUMGetGuestCpuId(PVMCPU pVCpu, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
#ifndef VBOX_WITHOUT_UNNAMED_UNIONS
|| pCtx->eflags.Bits.u1VM; /* Cannot be set in long mode. Intel spec 2.3.1 "System Flags and Fields in IA-32e Mode". */
/* Intel mentions EFER.LMA and EFER.LME in different parts of their spec. We shall use EFER.LMA rather
VMM_INT_DECL(void) CPUMSetHyperState(PVMCPU pVCpu, uint32_t u32EIP, uint32_t u32ESP, uint32_t u32EAX, uint32_t u32EDX);
| CPUM_CHANGED_CR0 \
| CPUM_CHANGED_CR4 \
| CPUM_CHANGED_CR3 \
| CPUM_CHANGED_TR \
#ifdef IN_RING3
VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMethod, PCPUMCPUID pDefUnknown);
VMMR3DECL(CPUMCPUVENDOR) CPUMR3CpuIdDetectVendorEx(uint32_t uEAX, uint32_t uEBX, uint32_t uECX, uint32_t uEDX);
#ifdef IN_RC
#ifdef VBOX_WITH_RAW_RING1
#ifdef IN_RING0