[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Merge 2.0-testing change:
ChangeSet 1.1438, 2005/04/02 22:30:42+01:00, cl349@xxxxxxxxxxxxxxxxxxxx Merge 2.0-testing change: From: YAMAMOTO Takashi <yamt@xxxxxxxxxxxxxxxxx> Add support to domain0 builder to load a (Net)BSD symtab for domain0. Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> arch/x86/domain.c | 1266 ++++++++++++++++++++++++++++------------------------ common/elf.c | 37 - include/xen/elf.h | 5 include/xen/sched.h | 282 ++++++++--- 4 files changed, 909 insertions(+), 681 deletions(-) diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c 2005-04-03 05:03:31 -04:00 +++ b/xen/arch/x86/domain.c 2005-04-03 05:03:31 -04:00 @@ -19,6 +19,7 @@ #include <xen/smp.h> #include <xen/delay.h> #include <xen/softirq.h> +#include <xen/grant_table.h> #include <asm/regs.h> #include <asm/mc146818rtc.h> #include <asm/system.h> @@ -33,33 +34,29 @@ #include <asm/shadow.h> #include <xen/console.h> #include <xen/elf.h> +#include <asm/vmx.h> +#include <asm/vmx_vmcs.h> +#include <asm/msr.h> +#include <xen/kernel.h> +#include <public/io/ioreq.h> #include <xen/multicall.h> /* opt_noreboot: If true, machine will need manual reset on error. */ static int opt_noreboot = 0; boolean_param("noreboot", opt_noreboot); -#if !defined(CONFIG_X86_64BITMODE) -/* No ring-3 access in initial page tables. */ -#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED) -#else -/* Allow ring-3 access in long mode as guest cannot use ring 1. */ -#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER) -#endif -#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER) -#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER) -#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER) - -#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) -#define round_pgdown(_p) ((_p)&PAGE_MASK) +struct percpu_ctxt { + struct exec_domain *curr_ed; +} __cacheline_aligned; +static struct percpu_ctxt percpu_ctxt[NR_CPUS]; static void default_idle(void) { - __cli(); + local_irq_disable(); if ( !softirq_pending(smp_processor_id()) ) safe_halt(); else - __sti(); + local_irq_enable(); } static __attribute_used__ void idle_loop(void) @@ -80,8 +77,10 @@ void startup_cpu_idle_loop(void) { /* Just some sanity to ensure that the scheduler is set up okay. */ - ASSERT(current->id == IDLE_DOMAIN_ID); - domain_unpause_by_systemcontroller(current); + ASSERT(current->domain->id == IDLE_DOMAIN_ID); + percpu_ctxt[smp_processor_id()].curr_ed = current; + set_bit(smp_processor_id(), ¤t->domain->cpuset); + domain_unpause_by_systemcontroller(current->domain); raise_softirq(SCHEDULE_SOFTIRQ); do_softirq(); @@ -97,106 +96,79 @@ static long no_idt[2]; static int reboot_mode; -int reboot_thru_bios = 0; - -#ifdef CONFIG_SMP -int reboot_smp = 0; -static int reboot_cpu = -1; -/* shamelessly grabbed from lib/vsprintf.c for readability */ -#define is_digit(c) ((c) >= '0' && (c) <= '9') -#endif - static inline void kb_wait(void) { int i; - for (i=0; i<0x10000; i++) - if ((inb_p(0x64) & 0x02) == 0) + for ( i = 0; i < 0x10000; i++ ) + if ( (inb_p(0x64) & 0x02) == 0 ) break; } - void machine_restart(char * __unused) { -#ifdef CONFIG_SMP - int cpuid; -#endif + int i; if ( opt_noreboot ) { printk("Reboot disabled on cmdline: require manual reset\n"); - for ( ; ; ) __asm__ __volatile__ ("hlt"); + for ( ; ; ) + safe_halt(); } -#ifdef CONFIG_SMP - cpuid = GET_APIC_ID(apic_read(APIC_ID)); - - /* KAF: Need interrupts enabled for safe IPI. */ - __sti(); + local_irq_enable(); - if (reboot_smp) { - - /* check to see if reboot_cpu is valid - if its not, default to the BSP */ - if ((reboot_cpu == -1) || - (reboot_cpu > (NR_CPUS -1)) || - !(phys_cpu_present_map & (1<<cpuid))) - reboot_cpu = boot_cpu_physical_apicid; - - reboot_smp = 0; /* use this as a flag to only go through this once*/ - /* re-run this function on the other CPUs - it will fall though this section since we have - cleared reboot_smp, and do the reboot if it is the - correct CPU, otherwise it halts. */ - if (reboot_cpu != cpuid) - smp_call_function((void *)machine_restart , NULL, 1, 0); - } - - /* if reboot_cpu is still -1, then we want a tradional reboot, - and if we are not running on the reboot_cpu,, halt */ - if ((reboot_cpu != -1) && (cpuid != reboot_cpu)) { - for (;;) - __asm__ __volatile__ ("hlt"); + /* Ensure we are the boot CPU. */ + if ( GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid ) + { + smp_call_function((void *)machine_restart, NULL, 1, 0); + for ( ; ; ) + safe_halt(); } + /* * Stop all CPUs and turn off local APICs and the IO-APIC, so * other OSs see a clean IRQ state. */ smp_send_stop(); disable_IO_APIC(); + +#ifdef CONFIG_VMX + stop_vmx(); #endif - if(!reboot_thru_bios) { - /* rebooting needs to touch the page at absolute addr 0 */ - *((unsigned short *)__va(0x472)) = reboot_mode; - for (;;) { - int i; - for (i=0; i<100; i++) { - kb_wait(); - udelay(50); - outb(0xfe,0x64); /* pulse reset low */ - udelay(50); - } - /* That didn't work - force a triple fault.. */ - __asm__ __volatile__("lidt %0": "=m" (no_idt)); - __asm__ __volatile__("int3"); + /* Rebooting needs to touch the page at absolute address 0. */ + *((unsigned short *)__va(0x472)) = reboot_mode; + + for ( ; ; ) + { + /* Pulse the keyboard reset line. */ + for ( i = 0; i < 100; i++ ) + { + kb_wait(); + udelay(50); + outb(0xfe,0x64); /* pulse reset low */ + udelay(50); } - } - panic("Need to reinclude BIOS reboot code\n"); + /* That didn't work - force a triple fault.. */ + __asm__ __volatile__("lidt %0": "=m" (no_idt)); + __asm__ __volatile__("int3"); + } } void __attribute__((noreturn)) __machine_halt(void *unused) { for ( ; ; ) - __asm__ __volatile__ ( "cli; hlt" ); + safe_halt(); } void machine_halt(void) { - smp_call_function(__machine_halt, NULL, 1, 1); + watchdog_on = 0; + smp_call_function(__machine_halt, NULL, 1, 0); __machine_halt(NULL); } @@ -220,158 +192,373 @@ page->u.inuse.type_info); } -xmem_cache_t *domain_struct_cachep; -void __init domain_startofday(void) +struct domain *arch_alloc_domain_struct(void) { - domain_struct_cachep = xmem_cache_create( - "domain_cache", sizeof(struct domain), - 0, SLAB_HWCACHE_ALIGN, NULL, NULL); - if ( domain_struct_cachep == NULL ) - panic("No slab cache for domain structs."); + return xmalloc(struct domain); } -struct domain *arch_alloc_domain_struct(void) +void arch_free_domain_struct(struct domain *d) { - return xmem_cache_alloc(domain_struct_cachep); + xfree(d); } -void arch_free_domain_struct(struct domain *d) +struct exec_domain *arch_alloc_exec_domain_struct(void) +{ + return xmalloc(struct exec_domain); +} + +void arch_free_exec_domain_struct(struct exec_domain *ed) { - xmem_cache_free(domain_struct_cachep, d); + xfree(ed); } void free_perdomain_pt(struct domain *d) { - free_xenheap_page((unsigned long)d->mm.perdomain_pt); + free_xenheap_page((unsigned long)d->arch.mm_perdomain_pt); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |