direct-io.hg
changeset 7084:b1327ae8f414
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@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
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@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Wed Sep 28 14:05:58 2005 +0100 (2005-09-28) |
parents | 868b8c599dfb |
children | 5fb211049b3f |
files | tools/firmware/vmxassist/gen.c tools/firmware/vmxassist/head.S tools/firmware/vmxassist/setup.c tools/firmware/vmxassist/vmxloader.c |
line diff
1.1 --- a/tools/firmware/vmxassist/gen.c Wed Sep 28 13:49:33 2005 +0100 1.2 +++ b/tools/firmware/vmxassist/gen.c Wed Sep 28 14:05:58 2005 +0100 1.3 @@ -23,7 +23,7 @@ 1.4 #include <vm86.h> 1.5 1.6 int 1.7 -main() 1.8 +main(void) 1.9 { 1.10 printf("/* MACHINE GENERATED; DO NOT EDIT */\n"); 1.11 printf("#define VMX_ASSIST_CTX_GS_SEL 0x%x\n",
2.1 --- a/tools/firmware/vmxassist/head.S Wed Sep 28 13:49:33 2005 +0100 2.2 +++ b/tools/firmware/vmxassist/head.S Wed Sep 28 14:05:58 2005 +0100 2.3 @@ -110,6 +110,10 @@ 1: 2.4 _start: 2.5 cli 2.6 2.7 + /* save register parameters to C land */ 2.8 + movl %edx, booting_cpu 2.9 + movl %ebx, booting_vector 2.10 + 2.11 /* clear bss */ 2.12 cld 2.13 xorb %al, %al 2.14 @@ -129,7 +133,6 @@ 1: 2.15 call main 2.16 jmp halt 2.17 2.18 - 2.19 /* 2.20 * Something bad happened, print invoking %eip and loop forever 2.21 */
3.1 --- a/tools/firmware/vmxassist/setup.c Wed Sep 28 13:49:33 2005 +0100 3.2 +++ b/tools/firmware/vmxassist/setup.c Wed Sep 28 14:05:58 2005 +0100 3.3 @@ -29,6 +29,9 @@ 3.4 3.5 #define min(a, b) ((a) > (b) ? (b) : (a)) 3.6 3.7 +/* Which CPU are we booting, and what is the initial CS segment? */ 3.8 +int booting_cpu, booting_vector; 3.9 + 3.10 unsigned long long gdt[] __attribute__ ((aligned(32))) = { 3.11 0x0000000000000000ULL, /* 0x00: reserved */ 3.12 0x0000890000000000ULL, /* 0x08: 32-bit TSS */ 3.13 @@ -201,12 +204,17 @@ enter_real_mode(struct regs *regs) 3.14 initialize_real_mode = 0; 3.15 regs->eflags |= EFLAGS_VM | 0x02; 3.16 regs->ves = regs->vds = regs->vfs = regs->vgs = 0xF000; 3.17 - regs->cs = 0xF000; /* ROM BIOS POST entry point */ 3.18 + if (booting_cpu == 0) { 3.19 + regs->cs = 0xF000; /* ROM BIOS POST entry point */ 3.20 #ifdef TEST 3.21 - regs->eip = 0xFFE0; 3.22 + regs->eip = 0xFFE0; 3.23 #else 3.24 - regs->eip = 0xFFF0; 3.25 + regs->eip = 0xFFF0; 3.26 #endif 3.27 + } else { 3.28 + regs->cs = booting_vector << 8; /* AP entry point */ 3.29 + regs->eip = 0; 3.30 + } 3.31 regs->uesp = 0; 3.32 regs->uss = 0; 3.33 printf("Starting emulated 16-bit real-mode: ip=%04x:%04x\n", 3.34 @@ -215,8 +223,8 @@ enter_real_mode(struct regs *regs) 3.35 mode = VM86_REAL; /* becomes previous mode */ 3.36 set_mode(regs, VM86_REAL); 3.37 3.38 - /* this should get us into 16-bit mode */ 3.39 - return; 3.40 + /* this should get us into 16-bit mode */ 3.41 + return; 3.42 } else { 3.43 /* go from protected to real mode */ 3.44 regs->eflags |= EFLAGS_VM; 3.45 @@ -334,7 +342,12 @@ start_bios(void) 3.46 { 3.47 unsigned long cr0; 3.48 3.49 - printf("Start BIOS ...\n"); 3.50 + if (booting_cpu == 0) 3.51 + printf("Start BIOS ...\n"); 3.52 + else 3.53 + printf("Start AP %d from %08x ...\n", 3.54 + booting_cpu, booting_vector << 12); 3.55 + 3.56 initialize_real_mode = 1; 3.57 cr0 = get_cr0(); 3.58 #ifndef TEST 3.59 @@ -345,20 +358,28 @@ start_bios(void) 3.60 } 3.61 3.62 int 3.63 -main() 3.64 +main(void) 3.65 { 3.66 - banner(); 3.67 + if (booting_cpu == 0) 3.68 + banner(); 3.69 + 3.70 #ifdef TEST 3.71 setup_paging(); 3.72 #endif 3.73 + 3.74 setup_gdt(); 3.75 setup_idt(); 3.76 + 3.77 #ifndef TEST 3.78 - set_cr4(get_cr4() | CR4_VME); 3.79 + set_cr4(get_cr4() | CR4_VME); 3.80 #endif 3.81 + 3.82 setup_ctx(); 3.83 - setup_pic(); 3.84 + 3.85 + if (booting_cpu == 0) 3.86 + setup_pic(); 3.87 + 3.88 start_bios(); 3.89 + 3.90 return 0; 3.91 } 3.92 -
4.1 --- a/tools/firmware/vmxassist/vmxloader.c Wed Sep 28 13:49:33 2005 +0100 4.2 +++ b/tools/firmware/vmxassist/vmxloader.c Wed Sep 28 14:05:58 2005 +0100 4.3 @@ -132,11 +132,12 @@ main(void) 4.4 memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi, sizeof(acpi)); 4.5 } 4.6 #endif 4.7 - 4.8 + 4.9 puts("Loading VMXAssist ...\n"); 4.10 memcpy((void *)TEXTADDR, vmxassist, sizeof(vmxassist)); 4.11 + 4.12 puts("Go ...\n"); 4.13 - ((void (*)())TEXTADDR)(); 4.14 + asm volatile ( "jmp *%%eax" : : "a" (TEXTADDR), "d" (0) ); 4.15 + 4.16 return 0; 4.17 } 4.18 -