[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
ChangeSet 1.1380, 2005/03/28 18:52:25+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk mtrr/generic.c | 3 +- mtrr/main.c | 3 -- smpboot.c | 71 +++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 27 deletions(-) diff -Nru a/xen/arch/x86/mtrr/generic.c b/xen/arch/x86/mtrr/generic.c --- a/xen/arch/x86/mtrr/generic.c 2005-03-28 13:04:02 -05:00 +++ b/xen/arch/x86/mtrr/generic.c 2005-03-28 13:04:02 -05:00 @@ -51,7 +51,8 @@ unsigned lo, dummy; if (!mtrr_state.var_ranges) { - mtrr_state.var_ranges = xmalloc(num_var_ranges * sizeof (struct mtrr_var_range)); + mtrr_state.var_ranges = xmalloc_array(struct mtrr_var_range, + num_var_ranges); if (!mtrr_state.var_ranges) return; } diff -Nru a/xen/arch/x86/mtrr/main.c b/xen/arch/x86/mtrr/main.c --- a/xen/arch/x86/mtrr/main.c 2005-03-28 13:04:02 -05:00 +++ b/xen/arch/x86/mtrr/main.c 2005-03-28 13:04:02 -05:00 @@ -136,8 +136,7 @@ int i, max; max = num_var_ranges; - if ((usage_table = xmalloc(max * sizeof *usage_table)) - == NULL) { + if ((usage_table = xmalloc_array(unsigned int, max)) == NULL) { printk(KERN_ERR "mtrr: could not allocate\n"); return; } diff -Nru a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c 2005-03-28 13:04:02 -05:00 +++ b/xen/arch/x86/smpboot.c 2005-03-28 13:04:02 -05:00 @@ -374,44 +374,49 @@ static int cpucount; +#ifdef __i386__ +static void construct_percpu_idt(unsigned int cpu) +{ + unsigned char idt_load[10]; + + idt_tables[cpu] = xmalloc_array(idt_entry_t, IDT_ENTRIES); + memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES*sizeof(idt_entry_t)); + + *(unsigned short *)(&idt_load[0]) = (IDT_ENTRIES*sizeof(idt_entry_t))-1; + *(unsigned long *)(&idt_load[2]) = (unsigned long)idt_tables[cpu]; + __asm__ __volatile__ ( "lidt %0" : "=m" (idt_load) ); +} +#endif + /* * Activate a secondary processor. */ void __init start_secondary(void) { unsigned int cpu = cpucount; - /* 6 bytes suitable for passing to LIDT instruction. */ - unsigned char idt_load[6]; + extern void percpu_traps_init(void); extern void cpu_init(void); set_current(idle_task[cpu]); - /* - * Dont put anything before smp_callin(), SMP - * booting is too fragile that we want to limit the - * things done here to the most necessary things. - */ + percpu_traps_init(); + cpu_init(); + smp_callin(); while (!atomic_read(&smp_commenced)) rep_nop(); +#ifdef __i386__ /* * At this point, boot CPU has fully initialised the IDT. It is * now safe to make ourselves a private copy. */ - idt_tables[cpu] = xmalloc(IDT_ENTRIES*8); - memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES*8); - *(unsigned short *)(&idt_load[0]) = (IDT_ENTRIES*8)-1; - *(unsigned long *)(&idt_load[2]) = (unsigned long)idt_tables[cpu]; - __asm__ __volatile__ ( "lidt %0" : "=m" (idt_load) ); + construct_percpu_idt(cpu); +#endif - /* - * low-memory mappings have been cleared, flush them from the local TLBs - * too. - */ local_flush_tlb(); startup_cpu_idle_loop(); @@ -640,22 +645,26 @@ */ { struct domain *idle; + struct exec_domain *ed; unsigned long boot_error = 0; int timeout, cpu; - unsigned long start_eip, stack; + unsigned long start_eip; + void *stack; cpu = ++cpucount; if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL ) panic("failed 'createdomain' for CPU %d", cpu); - set_bit(DF_IDLETASK, &idle->flags); + ed = idle->exec_domain[0]; - idle->mm.pagetable = mk_pagetable(__pa(idle_pg_table)); + set_bit(DF_IDLETASK, &idle->d_flags); + + ed->arch.monitor_table = mk_pagetable(__pa(idle_pg_table)); map_cpu_to_boot_apicid(cpu, apicid); - idle_task[cpu] = idle; + idle_task[cpu] = ed; /* start_eip had better be page-aligned! */ start_eip = setup_trampoline(); @@ -663,11 +672,15 @@ /* So we see what's up. */ printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip); - stack = __pa(alloc_xenheap_pages(1)); - stack_start.esp = stack + STACK_SIZE - STACK_RESERVED; + stack = (void *)alloc_xenheap_pages(STACK_ORDER); +#if defined(__i386__) + stack_start.esp = __pa(stack) + STACK_SIZE - STACK_RESERVED; +#elif defined(__x86_64__) + stack_start.esp = (unsigned long)stack + STACK_SIZE - STACK_RESERVED; +#endif /* Debug build: detect stack overflow by setting up a guard page. */ - memguard_guard_range(__va(stack), PAGE_SIZE); + memguard_guard_stack(stack); /* * This grunge runs the startup process for @@ -729,7 +742,7 @@ printk("CPU%d has booted.\n", cpu); } else { boot_error= 1; - if (*((volatile unsigned long *)phys_to_virt(start_eip)) + if (*((volatile unsigned int *)phys_to_virt(start_eip)) == 0xA5A5A5A5) /* trampoline started but...? */ printk("Stuck ??\n"); @@ -920,3 +933,13 @@ } #endif /* CONFIG_SMP */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |