[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] 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 <asit.k.mallick@xxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>

diff -r ae5dbce3f530 -r 3e44f5b38645 tools/firmware/vmxassist/Makefile
--- a/tools/firmware/vmxassist/Makefile Wed Jul 13 19:12:38 2005
+++ b/tools/firmware/vmxassist/Makefile Wed Jul 13 19:12:43 2005
@@ -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
diff -r ae5dbce3f530 -r 3e44f5b38645 tools/firmware/vmxassist/machine.h
--- a/tools/firmware/vmxassist/machine.h        Wed Jul 13 19:12:38 2005
+++ b/tools/firmware/vmxassist/machine.h        Wed Jul 13 19:12:43 2005
@@ -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);
diff -r ae5dbce3f530 -r 3e44f5b38645 tools/firmware/vmxassist/setup.c
--- a/tools/firmware/vmxassist/setup.c  Wed Jul 13 19:12:38 2005
+++ b/tools/firmware/vmxassist/setup.c  Wed Jul 13 19:12:43 2005
@@ -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();

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.