X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_lowlevel.h;h=8e85162fcf9a8f77e8425df7844c60b412af8b99;hp=687069f6d143f0ef57fcc884aa0ca0dc48c15e77;hb=c06413341bf1dca02f22c0502fa5c2d1c2c11eab;hpb=b7cb21f4a2443581074c0a3374ef9d88e72c51ce diff --git a/palacios/include/palacios/vmm_lowlevel.h b/palacios/include/palacios/vmm_lowlevel.h index 687069f..8e85162 100644 --- a/palacios/include/palacios/vmm_lowlevel.h +++ b/palacios/include/palacios/vmm_lowlevel.h @@ -20,36 +20,22 @@ #include -#ifdef __V3_32BIT__ +#define CPUID_FEATURE_IDS 0x00000001 +#define CPUID_EXT_FEATURE_IDS 0x80000001 -static void __inline__ v3_cpuid(uint_t target, addr_t * eax, addr_t * ebx, addr_t * ecx, addr_t * edx) { - __asm__ __volatile__ ( - "pushl %%ebx\n\t" - "cpuid\n\t" - "movl %%ebx, %%esi\n\t" - "popl %%ebx\n\t" - : "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx) - : "a" (target) - ); - return; -} -#elif __V3_64BIT__ -static void __inline__ v3_cpuid(uint_t target, addr_t * eax, addr_t * ebx, addr_t * ecx, addr_t * edx) { +static void __inline__ v3_cpuid(uint32_t target, + uint32_t * eax, uint32_t * ebx, + uint32_t * ecx, uint32_t * edx) { __asm__ __volatile__ ( - "pushq %%rbx\n\t" "cpuid\n\t" - "movq %%rbx, %%rsi\n\t" - "popq %%rbx\n\t" : "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx) - : "a" (target) + : "0" (target), "2" (*ecx) ); return; } -#endif - static void __inline__ v3_set_msr(uint_t msr, uint_t high_byte, uint_t low_byte) { __asm__ __volatile__ ( @@ -81,3 +67,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