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

[Xen-changelog] Enable CR4.VME to improve the performance of vm86 emulation.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 637127cded4ea46aacea378fc93e274c6cf02da7
# Parent  9d2ca2da280ec34c09ceed6ac583586357000d09

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 9d2ca2da280e -r 637127cded4e tools/firmware/vmxassist/machine.h
--- a/tools/firmware/vmxassist/machine.h        Thu Jul 14 07:39:18 2005
+++ b/tools/firmware/vmxassist/machine.h        Thu Jul 14 08:00:23 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 9d2ca2da280e -r 637127cded4e tools/firmware/vmxassist/setup.c
--- a/tools/firmware/vmxassist/setup.c  Thu Jul 14 07:39:18 2005
+++ b/tools/firmware/vmxassist/setup.c  Thu Jul 14 08:00:23 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();
diff -r 9d2ca2da280e -r 637127cded4e tools/firmware/vmxassist/Makefile
--- a/tools/firmware/vmxassist/Makefile Thu Jul 14 07:39:18 2005
+++ b/tools/firmware/vmxassist/Makefile Thu Jul 14 08:00:23 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

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


 


Rackspace

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