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

[Xen-changelog] With this patch, we can enable VMXAssist to bring up APs of SMP VMX



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b1327ae8f41402081456f5813e6882298d50a735
# Parent  868b8c599dfb6d4609bd4def71b44ea311bf8da3
With this patch, we can enable VMXAssist to bring up APs of SMP VMX
guest. On entry to VMXAssist:
 1) %edx is the processor number, i.e. vcpu id, and for BSP it's 0.
 2) %ebx is the vector number from SIPI.
Also removed some ugly tailing space.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>
Signed-off-by: Jun Nakajima  <jun.nakajima@xxxxxxxxx>

diff -r 868b8c599dfb -r b1327ae8f414 tools/firmware/vmxassist/gen.c
--- a/tools/firmware/vmxassist/gen.c    Wed Sep 28 12:49:33 2005
+++ b/tools/firmware/vmxassist/gen.c    Wed Sep 28 13:05:58 2005
@@ -23,7 +23,7 @@
 #include <vm86.h>
 
 int
-main()
+main(void)
 {
        printf("/* MACHINE GENERATED; DO NOT EDIT */\n");
        printf("#define VMX_ASSIST_CTX_GS_SEL   0x%x\n",
diff -r 868b8c599dfb -r b1327ae8f414 tools/firmware/vmxassist/head.S
--- a/tools/firmware/vmxassist/head.S   Wed Sep 28 12:49:33 2005
+++ b/tools/firmware/vmxassist/head.S   Wed Sep 28 13:05:58 2005
@@ -110,6 +110,10 @@
 _start:
        cli
 
+       /* save register parameters to C land */
+       movl    %edx, booting_cpu
+       movl    %ebx, booting_vector
+
        /* clear bss */
        cld
        xorb    %al, %al
@@ -128,7 +132,6 @@
        /* go ... */
        call    main
        jmp     halt
-
 
 /*
  * Something bad happened, print invoking %eip and loop forever
diff -r 868b8c599dfb -r b1327ae8f414 tools/firmware/vmxassist/setup.c
--- a/tools/firmware/vmxassist/setup.c  Wed Sep 28 12:49:33 2005
+++ b/tools/firmware/vmxassist/setup.c  Wed Sep 28 13:05:58 2005
@@ -29,6 +29,9 @@
 
 #define        min(a, b)       ((a) > (b) ? (b) : (a))
 
+/* Which CPU are we booting, and what is the initial CS segment? */
+int booting_cpu, booting_vector;
+
 unsigned long long gdt[] __attribute__ ((aligned(32))) = {
        0x0000000000000000ULL,          /* 0x00: reserved */
        0x0000890000000000ULL,          /* 0x08: 32-bit TSS */
@@ -201,12 +204,17 @@
                initialize_real_mode = 0;
                regs->eflags |= EFLAGS_VM | 0x02;
                regs->ves = regs->vds = regs->vfs = regs->vgs = 0xF000;
-               regs->cs = 0xF000; /* ROM BIOS POST entry point */
-#ifdef TEST
-               regs->eip = 0xFFE0;
+               if (booting_cpu == 0) {
+                       regs->cs = 0xF000; /* ROM BIOS POST entry point */
+#ifdef TEST
+                       regs->eip = 0xFFE0;
 #else
-               regs->eip = 0xFFF0;
-#endif
+                       regs->eip = 0xFFF0;
+#endif
+               } else {
+                       regs->cs = booting_vector << 8; /* AP entry point */
+                       regs->eip = 0;
+               }
                regs->uesp = 0;
                regs->uss = 0;
                printf("Starting emulated 16-bit real-mode: ip=%04x:%04x\n",
@@ -215,8 +223,8 @@
                mode = VM86_REAL; /* becomes previous mode */
                set_mode(regs, VM86_REAL);
 
-                /* this should get us into 16-bit mode */
-                return;
+               /* this should get us into 16-bit mode */
+               return;
        } else {
                /* go from protected to real mode */
                regs->eflags |= EFLAGS_VM;
@@ -334,7 +342,12 @@
 {
        unsigned long cr0;
 
-       printf("Start BIOS ...\n");
+       if (booting_cpu == 0)
+               printf("Start BIOS ...\n");
+       else
+               printf("Start AP %d from %08x ...\n",
+                      booting_cpu, booting_vector << 12);
+
        initialize_real_mode = 1;
        cr0 = get_cr0();
 #ifndef TEST
@@ -345,20 +358,28 @@
 }
 
 int
-main()
-{
-       banner();
+main(void)
+{
+       if (booting_cpu == 0)
+               banner();
+
 #ifdef TEST
        setup_paging();
 #endif
+
        setup_gdt();
        setup_idt();
+
 #ifndef        TEST
-       set_cr4(get_cr4() | CR4_VME); 
-#endif
+       set_cr4(get_cr4() | CR4_VME);
+#endif
+
        setup_ctx();
-       setup_pic();
+
+       if (booting_cpu == 0)
+               setup_pic();
+
        start_bios();
+
        return 0;
 }
-
diff -r 868b8c599dfb -r b1327ae8f414 tools/firmware/vmxassist/vmxloader.c
--- a/tools/firmware/vmxassist/vmxloader.c      Wed Sep 28 12:49:33 2005
+++ b/tools/firmware/vmxassist/vmxloader.c      Wed Sep 28 13:05:58 2005
@@ -132,11 +132,12 @@
                 memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi, sizeof(acpi));
        }
 #endif
-                       
+
        puts("Loading VMXAssist ...\n");
        memcpy((void *)TEXTADDR, vmxassist, sizeof(vmxassist));
+
        puts("Go ...\n");
-       ((void (*)())TEXTADDR)();
+       asm volatile ( "jmp *%%eax" : : "a" (TEXTADDR), "d" (0) );
+
        return 0;
 }
-

_______________________________________________
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®.