X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_lowlevel.h;h=7863d1929230da04c12cea6598d68a978c29edd9;hp=687069f6d143f0ef57fcc884aa0ca0dc48c15e77;hb=794a794cec97cecc8c7de7f8b5fe33381a1e02e0;hpb=e070c6feb9e35665efa6e50ed7549d20c26ff426 diff --git a/palacios/include/palacios/vmm_lowlevel.h b/palacios/include/palacios/vmm_lowlevel.h index 687069f..7863d19 100644 --- a/palacios/include/palacios/vmm_lowlevel.h +++ b/palacios/include/palacios/vmm_lowlevel.h @@ -81,3 +81,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" (x) + : + :"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