Enable CR4.VME to improve the performance of vm86 emulation.
PATCH 1/1 Enable CR4.VME to improve the performance of vm86 emulation.
Enable CR4.VME to improve the performance of vm86 emulation.
Setting this bit eliminates the calls to the vm86 monitor to handle interrupts and exceptions that occur while executing programs in vm86 mode.
Signed-off-by Asit Mallick <[email protected]>
Signed-off-by Arun Sharma <[email protected]>
tools/firmware/vmxassist/Makefile +1 -1
@@ -24,7 +24,7 @@ # The emulator code lives in ROM space TEXTADDR=0x000D0000 -DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR} -D_ACPI_ +DEFINES=-DDEBUG -DENABLE_VME -DTEXTADDR=${TEXTADDR} XENINC=-I$(XEN_ROOT)/xen/include -I$(XEN_ROOT)/tools/libxc #DEFINES=-DDEBUG -DTEST -DTEXTADDR=${TEXTADDR} #XENINC=-I/home/leendert/xen/xeno-unstable.bk/xen/include
tools/firmware/vmxassist/machine.h +17 -13
@@ -40,7 +40,8 @@#define EFLAGS_TF (1 << 8)#define EFLAGS_IF (1 << 9)#define EFLAGS_DF (1 << 10) -#define EFLAGS_VM (1 << 17) +#define EFLAGS_IOPL (3 << 12) +#define EFLAGS_VM ((1 << 17) | EFLAGS_IOPL)#define EFLAGS_VIF (1 << 19)#define EFLAGS_VIP (1 << 20)
@@ -109,6 +110,9 @@unsigned short _5;unsigned short _6;unsigned short iomap_base; +#ifdef ENABLE_VME +unsigned long int_redir[8 ]; +#endif unsigned char iomap[8192 ]; };
@@ -177,20 +181,20 @@return rv; } +static inline void +set_cr3 (unsigned addr) +{ + __asm__ __volatile__("movl %0, %%cr3" :/* no outputs */ :"r" (addr)); +} + +static inline void +set_cr4 (unsigned value) +{ + __asm__ __volatile__("movl %0, %%cr4" :/* no outputs */ :"r" (value)); +} +#ifdef TEST static inline void -set_cr3 (unsigned addr) -{ - __asm__ __volatile__("movl %0, %%cr3" :/* no outputs */ :"r" (addr)); -} - -static inline void -set_cr4 (unsigned value) -{ - __asm__ __volatile__("movl %0, %%cr4" :/* no outputs */ :"r" (value)); -} - -static inline void breakpoint (void ) {outw (0x8A00 ,0x8AE0 );
tools/firmware/vmxassist/setup.c +4 -1
@@ -121,7 +121,7 @@setup_gdt (void) {/* setup task state segment */ -memset (&tss,0 ,sizeof (0 )); +memset (&tss,0 ,sizeof (tss)); tss.ss0 =DATA_SELECTOR ; tss.esp0 = (unsigned ) stack_top -4 *4 ; tss.iomap_base = offsetof(struct tss , iomap);
@@ -353,6 +353,9 @@#endif setup_gdt ();setup_idt (); +#ifdef ENABLE_VME +set_cr4 (get_cr4 () |CR4_VME ); +#endif setup_ctx ();setup_pic ();start_bios ();