X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_lowlevel.h;h=6558884603154e11ab506fb30a09d21dda6f5712;hb=b20b234c37cae136df988f94a5461cf7a073cc9e;hp=687069f6d143f0ef57fcc884aa0ca0dc48c15e77;hpb=b7cb21f4a2443581074c0a3374ef9d88e72c51ce;p=palacios-OLD.git diff --git a/palacios/include/palacios/vmm_lowlevel.h b/palacios/include/palacios/vmm_lowlevel.h index 687069f..6558884 100644 --- a/palacios/include/palacios/vmm_lowlevel.h +++ b/palacios/include/palacios/vmm_lowlevel.h @@ -20,6 +20,10 @@ #include +#define CPUID_FEATURE_IDS 0x80000001 +#define CPUID_EXT_FEATURE_IDS 0x80000001 + + #ifdef __V3_32BIT__ static void __inline__ v3_cpuid(uint_t target, addr_t * eax, addr_t * ebx, addr_t * ecx, addr_t * edx) { @@ -81,3 +85,57 @@ static void __inline__ v3_disable_ints() { __asm__ __volatile__ ("cli"); } + + + +#ifdef __V3_32BIT__ + +static addr_t __inline__ v3_irq_save() { + addr_t state; + + __asm__ __volatile__ ("pushf \n\t" + "popl %0 \n\t" + "cli \n\t" + :"=g" (state) + : + :"memory" + ); + return state; +} + +static void __inline__ v3_irq_restore(addr_t state) { + __asm__ __volatile__("pushl %0 \n\t" + "popfl \n\t" + : + :"g" (state) + :"memory", "cc" + ); +} + +#elif __V3_64BIT__ + +static addr_t __inline__ v3_irq_save() { + addr_t state; + + __asm__ __volatile__ ("pushfq \n\t" + "popq %0 \n\t" + "cli \n\t" + :"=g" (state) + : + :"memory" + ); + + return state; +} + + +static void __inline__ v3_irq_restore(addr_t state) { + __asm__ __volatile__("pushq %0 \n\t" + "popfq \n\t" + : + :"g" (state) + :"memory", "cc" + ); +} + +#endif