ia64/xen-unstable

changeset 8457:b54e981957eb

Various fixes to Xen stack management. Ensure the cpu0_stack
is always sufficiently aligned (requires some linker script
tricks). Small fixes to show_trace() and ensure that Xen
stack pointers are always below the 'struct cpu_info' region.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Dec 29 16:59:12 2005 +0100 (2005-12-29)
parents 8d0b62f0aa8d
children 4dbca1428acd
files .hgignore xen/arch/x86/Makefile xen/arch/x86/boot/x86_32.S xen/arch/x86/boot/x86_64.S xen/arch/x86/domain.c xen/arch/x86/setup.c xen/arch/x86/traps.c xen/arch/x86/x86_32/xen.lds.S xen/arch/x86/x86_64/xen.lds.S xen/include/asm-x86/current.h
line diff
     1.1 --- a/.hgignore	Thu Dec 29 15:47:23 2005 +0100
     1.2 +++ b/.hgignore	Thu Dec 29 16:59:12 2005 +0100
     1.3 @@ -181,6 +181,7 @@
     1.4  ^xen/TAGS$
     1.5  ^xen/arch/x86/asm-offsets\.s$
     1.6  ^xen/arch/x86/boot/mkelf32$
     1.7 +^xen/arch/x86/xen\.lds$
     1.8  ^xen/ddb/.*$
     1.9  ^xen/include/asm$
    1.10  ^xen/include/asm-.*/asm-offsets\.h$
     2.1 --- a/xen/arch/x86/Makefile	Thu Dec 29 15:47:23 2005 +0100
     2.2 +++ b/xen/arch/x86/Makefile	Thu Dec 29 16:59:12 2005 +0100
     2.3 @@ -29,6 +29,7 @@ ifeq ($(TARGET_SUBARCH),x86_32)
     2.4  endif
     2.5  
     2.6  OBJS := $(subst $(TARGET_SUBARCH)/asm-offsets.o,,$(OBJS))
     2.7 +OBJS := $(subst $(TARGET_SUBARCH)/xen.lds.o,,$(OBJS))
     2.8  
     2.9  ifneq ($(crash_debug),y)
    2.10  OBJS := $(patsubst cdb%.o,,$(OBJS))
    2.11 @@ -43,22 +44,25 @@ default: $(TARGET)
    2.12  $(CURDIR)/arch.o: $(OBJS)
    2.13  	$(LD) $(LDFLAGS) -r -o $@ $(OBJS)
    2.14  
    2.15 -$(TARGET)-syms: boot/$(TARGET_SUBARCH).o $(ALL_OBJS) $(TARGET_SUBARCH)/xen.lds
    2.16 -	$(LD) $(LDFLAGS) -T $(TARGET_SUBARCH)/xen.lds -N \
    2.17 +$(TARGET)-syms: boot/$(TARGET_SUBARCH).o $(ALL_OBJS) xen.lds
    2.18 +	$(LD) $(LDFLAGS) -T xen.lds -N \
    2.19  	    boot/$(TARGET_SUBARCH).o $(ALL_OBJS) -o $@
    2.20  	$(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S
    2.21  	$(MAKE) $(BASEDIR)/xen-syms.o
    2.22 -	$(LD) $(LDFLAGS) -T $(TARGET_SUBARCH)/xen.lds -N \
    2.23 +	$(LD) $(LDFLAGS) -T xen.lds -N \
    2.24  	    boot/$(TARGET_SUBARCH).o $(ALL_OBJS) $(BASEDIR)/xen-syms.o -o $@
    2.25  	$(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S
    2.26  	$(MAKE) $(BASEDIR)/xen-syms.o
    2.27 -	$(LD) $(LDFLAGS) -T $(TARGET_SUBARCH)/xen.lds -N \
    2.28 +	$(LD) $(LDFLAGS) -T xen.lds -N \
    2.29  	    boot/$(TARGET_SUBARCH).o $(ALL_OBJS) $(BASEDIR)/xen-syms.o -o $@
    2.30  	rm -f $(BASEDIR)/xen-syms.S $(BASEDIR)/xen-syms.o
    2.31  
    2.32  asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
    2.33  	$(CC) $(CFLAGS) -S -o $@ $<
    2.34  
    2.35 +xen.lds: $(TARGET_SUBARCH)/xen.lds.S $(HDRS)
    2.36 +	$(CC) $(CFLAGS) -P -E -Ui386 -D__ASSEMBLY__ -o $@ $<
    2.37 +
    2.38  boot/mkelf32: boot/mkelf32.c
    2.39  	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
    2.40  
    2.41 @@ -73,5 +77,6 @@ clean:
    2.42  	rm -f dm/*.o dm/*~ dm/core
    2.43  	rm -f genapic/*.o genapic/*~ genapic/core
    2.44  	rm -f cpu/*.o cpu/*~ cpu/core
    2.45 +	rm -f xen.lds
    2.46  
    2.47  .PHONY: default clean
     3.1 --- a/xen/arch/x86/boot/x86_32.S	Thu Dec 29 15:47:23 2005 +0100
     3.2 +++ b/xen/arch/x86/boot/x86_32.S	Thu Dec 29 16:59:12 2005 +0100
     3.3 @@ -189,7 +189,7 @@ 1:      jmp     1b
     3.4  /*** STACK LOCATION ***/
     3.5          
     3.6  ENTRY(stack_start)
     3.7 -        .long cpu0_stack + STACK_SIZE - 200 - __PAGE_OFFSET
     3.8 +        .long cpu0_stack + STACK_SIZE - __PAGE_OFFSET
     3.9          .long __HYPERVISOR_DS
    3.10          
    3.11  /*** DESCRIPTOR TABLES ***/
    3.12 @@ -256,10 +256,6 @@ ENTRY(idle_pg_table_l2)
    3.13          .fill 1*PAGE_SIZE,1,0
    3.14  #endif
    3.15  
    3.16 -#if (STACK_ORDER == 0)
    3.17 -.section ".bss.page_aligned","w"
    3.18 -#else
    3.19 -.section ".bss.twopage_aligned","w"
    3.20 -#endif
    3.21 +.section ".bss.stack_aligned","w"
    3.22  ENTRY(cpu0_stack)
    3.23          .fill STACK_SIZE,1,0
     4.1 --- a/xen/arch/x86/boot/x86_64.S	Thu Dec 29 15:47:23 2005 +0100
     4.2 +++ b/xen/arch/x86/boot/x86_64.S	Thu Dec 29 16:59:12 2005 +0100
     4.3 @@ -219,7 +219,7 @@ idt:
     4.4          .quad   idt_table
     4.5  
     4.6  ENTRY(stack_start)
     4.7 -        .quad   cpu0_stack + STACK_SIZE - 200
     4.8 +        .quad   cpu0_stack + STACK_SIZE
     4.9  
    4.10  high_start:
    4.11          .quad   __high_start
    4.12 @@ -265,10 +265,6 @@ ENTRY(idle_pg_table_l2)
    4.13          .org 0x4000 + PAGE_SIZE
    4.14          .code64
    4.15  
    4.16 -#if (STACK_ORDER == 0)
    4.17 -.section ".bss.page_aligned","w"
    4.18 -#else
    4.19 -.section ".bss.twopage_aligned","w"
    4.20 -#endif
    4.21 +.section ".bss.stack_aligned","w"
    4.22  ENTRY(cpu0_stack)
    4.23          .fill STACK_SIZE,1,0
     5.1 --- a/xen/arch/x86/domain.c	Thu Dec 29 15:47:23 2005 +0100
     5.2 +++ b/xen/arch/x86/domain.c	Thu Dec 29 16:59:12 2005 +0100
     5.3 @@ -98,7 +98,7 @@ void startup_cpu_idle_loop(void)
     5.4      cpu_set(smp_processor_id(), v->domain->cpumask);
     5.5      v->arch.schedule_tail = continue_idle_task;
     5.6  
     5.7 -    idle_loop();
     5.8 +    reset_stack_and_jump(idle_loop);
     5.9  }
    5.10  
    5.11  static long no_idt[2];
     6.1 --- a/xen/arch/x86/setup.c	Thu Dec 29 15:47:23 2005 +0100
     6.2 +++ b/xen/arch/x86/setup.c	Thu Dec 29 16:59:12 2005 +0100
     6.3 @@ -138,10 +138,18 @@ static void __init do_initcalls(void)
     6.4          (*call)();
     6.5  }
     6.6  
     6.7 -static void __init start_of_day(void)
     6.8 +/* Variables handed off from __start_xen() to start_of_day(). */
     6.9 +static unsigned long initial_images_start, initial_images_end;
    6.10 +static multiboot_info_t *mbi;
    6.11 +
    6.12 +void __init start_of_day(void)
    6.13  {
    6.14      int i;
    6.15      unsigned long vgdt, gdt_pfn;
    6.16 +    char *cmdline;
    6.17 +    unsigned long _initrd_start = 0, _initrd_len = 0;
    6.18 +    unsigned int initrdidx = 1;
    6.19 +    module_t *mod = (module_t *)__va(mbi->mods_addr);
    6.20  
    6.21      early_cpu_init();
    6.22  
    6.23 @@ -249,20 +257,93 @@ static void __init start_of_day(void)
    6.24      schedulers_start();
    6.25  
    6.26      watchdog_enable();
    6.27 +
    6.28 +    shadow_mode_init();
    6.29 +
    6.30 +    /* initialize access control security module */
    6.31 +    acm_init(&initrdidx, mbi, initial_images_start);
    6.32 +
    6.33 +    /* Create initial domain 0. */
    6.34 +    dom0 = do_createdomain(0, 0);
    6.35 +    if ( dom0 == NULL )
    6.36 +        panic("Error creating domain 0\n");
    6.37 +
    6.38 +    set_bit(_DOMF_privileged, &dom0->domain_flags);
    6.39 +    /* post-create hooks sets security label */
    6.40 +    acm_post_domain0_create(dom0->domain_id);
    6.41 +
    6.42 +    /* Grab the DOM0 command line. */
    6.43 +    cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
    6.44 +    if ( cmdline != NULL )
    6.45 +    {
    6.46 +        static char dom0_cmdline[MAX_GUEST_CMDLINE];
    6.47 +
    6.48 +        /* Skip past the image name and copy to a local buffer. */
    6.49 +        while ( *cmdline == ' ' ) cmdline++;
    6.50 +        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
    6.51 +        {
    6.52 +            while ( *cmdline == ' ' ) cmdline++;
    6.53 +            strcpy(dom0_cmdline, cmdline);
    6.54 +        }
    6.55 +
    6.56 +        cmdline = dom0_cmdline;
    6.57 +
    6.58 +        /* Append any extra parameters. */
    6.59 +        if ( skip_ioapic_setup && !strstr(cmdline, "noapic") )
    6.60 +            strcat(cmdline, " noapic");
    6.61 +        if ( acpi_skip_timer_override &&
    6.62 +             !strstr(cmdline, "acpi_skip_timer_override") )
    6.63 +            strcat(cmdline, " acpi_skip_timer_override");
    6.64 +        if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") )
    6.65 +        {
    6.66 +            strcat(cmdline, " acpi=");
    6.67 +            strcat(cmdline, acpi_param);
    6.68 +        }
    6.69 +    }
    6.70 +
    6.71 +    if ( (initrdidx > 0) && (initrdidx < mbi->mods_count) )
    6.72 +    {
    6.73 +        _initrd_start = initial_images_start +
    6.74 +            (mod[initrdidx].mod_start - mod[0].mod_start);
    6.75 +        _initrd_len   = mod[initrdidx].mod_end - mod[initrdidx].mod_start;
    6.76 +    }
    6.77 +
    6.78 +    /*
    6.79 +     * We're going to setup domain0 using the module(s) that we stashed safely
    6.80 +     * above our heap. The second module, if present, is an initrd ramdisk.
    6.81 +     */
    6.82 +    if ( construct_dom0(dom0,
    6.83 +                        initial_images_start, 
    6.84 +                        mod[0].mod_end-mod[0].mod_start,
    6.85 +                        _initrd_start,
    6.86 +                        _initrd_len,
    6.87 +                        cmdline) != 0)
    6.88 +        panic("Could not set up DOM0 guest OS\n");
    6.89 +
    6.90 +    /* Scrub RAM that is still free and so may go to an unprivileged domain. */
    6.91 +    scrub_heap_pages();
    6.92 +
    6.93 +    init_trace_bufs();
    6.94 +
    6.95 +    /* Give up the VGA console if DOM0 is configured to grab it. */
    6.96 +    console_endboot(cmdline && strstr(cmdline, "tty0"));
    6.97 +
    6.98 +    /* Hide UART from DOM0 if we're using it */
    6.99 +    serial_endboot();
   6.100 +
   6.101 +    domain_unpause_by_systemcontroller(dom0);
   6.102 +
   6.103 +    startup_cpu_idle_loop();
   6.104  }
   6.105  
   6.106  #define EARLY_FAIL() for ( ; ; ) __asm__ __volatile__ ( "hlt" )
   6.107  
   6.108  static struct e820entry e820_raw[E820MAX];
   6.109  
   6.110 -void __init __start_xen(multiboot_info_t *mbi)
   6.111 +void __init __start_xen(multiboot_info_t *__mbi)
   6.112  {
   6.113 -    char *cmdline;
   6.114 -    module_t *mod = (module_t *)__va(mbi->mods_addr);
   6.115 +    module_t *mod = (module_t *)__va(__mbi->mods_addr);
   6.116      unsigned long nr_pages, modules_length;
   6.117 -    unsigned long initial_images_start, initial_images_end;
   6.118 -    unsigned long _initrd_start = 0, _initrd_len = 0;
   6.119 -    unsigned int initrdidx = 1;
   6.120      physaddr_t s, e;
   6.121      int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0;
   6.122      struct ns16550_defaults ns16550 = {
   6.123 @@ -271,6 +352,8 @@ void __init __start_xen(multiboot_info_t
   6.124          .stop_bits = 1
   6.125      };
   6.126  
   6.127 +    mbi = __mbi;
   6.128 +
   6.129      /* Parse the command-line options. */
   6.130      if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) )
   6.131          cmdline_parse(__va(mbi->cmdline));
   6.132 @@ -486,84 +569,7 @@ void __init __start_xen(multiboot_info_t
   6.133  
   6.134      early_boot = 0;
   6.135  
   6.136 -    start_of_day();
   6.137 -
   6.138 -    shadow_mode_init();
   6.139 -
   6.140 -    /* initialize access control security module */
   6.141 -    acm_init(&initrdidx, mbi, initial_images_start);
   6.142 -
   6.143 -    /* Create initial domain 0. */
   6.144 -    dom0 = do_createdomain(0, 0);
   6.145 -    if ( dom0 == NULL )
   6.146 -        panic("Error creating domain 0\n");
   6.147 -
   6.148 -    set_bit(_DOMF_privileged, &dom0->domain_flags);
   6.149 -    /* post-create hooks sets security label */
   6.150 -    acm_post_domain0_create(dom0->domain_id);
   6.151 -
   6.152 -    /* Grab the DOM0 command line. */
   6.153 -    cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
   6.154 -    if ( cmdline != NULL )
   6.155 -    {
   6.156 -        static char dom0_cmdline[MAX_GUEST_CMDLINE];
   6.157 -
   6.158 -        /* Skip past the image name and copy to a local buffer. */
   6.159 -        while ( *cmdline == ' ' ) cmdline++;
   6.160 -        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
   6.161 -        {
   6.162 -            while ( *cmdline == ' ' ) cmdline++;
   6.163 -            strcpy(dom0_cmdline, cmdline);
   6.164 -        }
   6.165 -
   6.166 -        cmdline = dom0_cmdline;
   6.167 -
   6.168 -        /* Append any extra parameters. */
   6.169 -        if ( skip_ioapic_setup && !strstr(cmdline, "noapic") )
   6.170 -            strcat(cmdline, " noapic");
   6.171 -        if ( acpi_skip_timer_override &&
   6.172 -             !strstr(cmdline, "acpi_skip_timer_override") )
   6.173 -            strcat(cmdline, " acpi_skip_timer_override");
   6.174 -        if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") )
   6.175 -        {
   6.176 -            strcat(cmdline, " acpi=");
   6.177 -            strcat(cmdline, acpi_param);
   6.178 -        }
   6.179 -    }
   6.180 -
   6.181 -    if ( (initrdidx > 0) && (initrdidx < mbi->mods_count) )
   6.182 -    {
   6.183 -        _initrd_start = initial_images_start +
   6.184 -            (mod[initrdidx].mod_start - mod[0].mod_start);
   6.185 -        _initrd_len   = mod[initrdidx].mod_end - mod[initrdidx].mod_start;
   6.186 -    }
   6.187 -
   6.188 -    /*
   6.189 -     * We're going to setup domain0 using the module(s) that we stashed safely
   6.190 -     * above our heap. The second module, if present, is an initrd ramdisk.
   6.191 -     */
   6.192 -    if ( construct_dom0(dom0,
   6.193 -                        initial_images_start, 
   6.194 -                        mod[0].mod_end-mod[0].mod_start,
   6.195 -                        _initrd_start,
   6.196 -                        _initrd_len,
   6.197 -                        cmdline) != 0)
   6.198 -        panic("Could not set up DOM0 guest OS\n");
   6.199 -
   6.200 -    /* Scrub RAM that is still free and so may go to an unprivileged domain. */
   6.201 -    scrub_heap_pages();
   6.202 -
   6.203 -    init_trace_bufs();
   6.204 -
   6.205 -    /* Give up the VGA console if DOM0 is configured to grab it. */
   6.206 -    console_endboot(cmdline && strstr(cmdline, "tty0"));
   6.207 -
   6.208 -    /* Hide UART from DOM0 if we're using it */
   6.209 -    serial_endboot();
   6.210 -
   6.211 -    domain_unpause_by_systemcontroller(dom0);
   6.212 -
   6.213 -    startup_cpu_idle_loop();
   6.214 +    reset_stack_and_jump(start_of_day);
   6.215  }
   6.216  
   6.217  void arch_get_xen_caps(xen_capabilities_info_t info)
     7.1 --- a/xen/arch/x86/traps.c	Thu Dec 29 15:47:23 2005 +0100
     7.2 +++ b/xen/arch/x86/traps.c	Thu Dec 29 16:59:12 2005 +0100
     7.3 @@ -192,7 +192,8 @@ static void show_trace(struct cpu_user_r
     7.4  
     7.5      /* Bounds for range of valid frame pointer. */
     7.6      low  = (unsigned long)(ESP_BEFORE_EXCEPTION(regs) - 2);
     7.7 -    high = (low & ~(STACK_SIZE - 1)) + (STACK_SIZE - sizeof(struct cpu_info));
     7.8 +    high = (low & ~(STACK_SIZE - 1)) + 
     7.9 +        (STACK_SIZE - sizeof(struct cpu_info) - 2*sizeof(unsigned long));
    7.10  
    7.11      /* The initial frame pointer. */
    7.12      next = regs->ebp;
    7.13 @@ -200,14 +201,14 @@ static void show_trace(struct cpu_user_r
    7.14      for ( ; ; )
    7.15      {
    7.16          /* Valid frame pointer? */
    7.17 -        if ( (next < low) || (next > high) )
    7.18 +        if ( (next < low) || (next >= high) )
    7.19          {
    7.20              /*
    7.21               * Exception stack frames have a different layout, denoted by an
    7.22               * inverted frame pointer.
    7.23               */
    7.24              next = ~next;
    7.25 -            if ( (next < low) || (next > high) )
    7.26 +            if ( (next < low) || (next >= high) )
    7.27                  break;
    7.28              frame = (unsigned long *)next;
    7.29              next  = frame[0];
     8.1 --- a/xen/arch/x86/x86_32/xen.lds	Thu Dec 29 15:47:23 2005 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,79 +0,0 @@
     8.4 -/* ld script to make i386 Linux kernel
     8.5 - * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
     8.6 - * Modified for i386 Xen by Keir Fraser
     8.7 - */
     8.8 -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
     8.9 -OUTPUT_ARCH(i386)
    8.10 -ENTRY(start)
    8.11 -PHDRS
    8.12 -{
    8.13 -  text PT_LOAD ;
    8.14 -}
    8.15 -SECTIONS
    8.16 -{
    8.17 -  . = 0xFF000000 + 0x100000;
    8.18 -  _text = .;			/* Text and read-only data */
    8.19 -  .text : {
    8.20 -	*(.text)
    8.21 -	*(.fixup)
    8.22 -	*(.gnu.warning)
    8.23 -	} :text =0x9090
    8.24 -  .text.lock : { *(.text.lock) } :text	/* out-of-line lock text */
    8.25 -
    8.26 -  _etext = .;			/* End of text section */
    8.27 -
    8.28 -  .rodata : { *(.rodata) *(.rodata.*) } :text
    8.29 -
    8.30 -  . = ALIGN(32);		/* Exception table */
    8.31 -  __start___ex_table = .;
    8.32 -  __ex_table : { *(__ex_table) } :text
    8.33 -  __stop___ex_table = .;
    8.34 -
    8.35 -  . = ALIGN(32);		/* Pre-exception table */
    8.36 -  __start___pre_ex_table = .;
    8.37 -  __pre_ex_table : { *(__pre_ex_table) } :text
    8.38 -  __stop___pre_ex_table = .;
    8.39 -
    8.40 -  .data : {			/* Data */
    8.41 -	*(.data)
    8.42 -	CONSTRUCTORS
    8.43 -	} :text
    8.44 -
    8.45 -  . = ALIGN(4096);		/* Init code and data */
    8.46 -  __init_begin = .;
    8.47 -  .text.init : { *(.text.init) } :text
    8.48 -  .data.init : { *(.data.init) } :text
    8.49 -  . = ALIGN(32);
    8.50 -  __setup_start = .;
    8.51 -  .setup.init : { *(.setup.init) } :text
    8.52 -  __setup_end = .;
    8.53 -  __initcall_start = .;
    8.54 -  .initcall.init : { *(.initcall.init) } :text
    8.55 -  __initcall_end = .;
    8.56 -  . = ALIGN(8192);
    8.57 -  __init_end = .;
    8.58 -
    8.59 -  __bss_start = .;		/* BSS */
    8.60 -  .bss : {
    8.61 -	*(.bss.twopage_aligned)
    8.62 -	*(.bss.page_aligned)
    8.63 -	*(.bss)
    8.64 -	} :text
    8.65 -  _end = . ;
    8.66 -
    8.67 -  /* Sections to be discarded */
    8.68 -  /DISCARD/ : {
    8.69 -	*(.text.exit)
    8.70 -	*(.data.exit)
    8.71 -	*(.exitcall.exit)
    8.72 -	}
    8.73 -
    8.74 -  /* Stabs debugging sections.  */
    8.75 -  .stab 0 : { *(.stab) }
    8.76 -  .stabstr 0 : { *(.stabstr) }
    8.77 -  .stab.excl 0 : { *(.stab.excl) }
    8.78 -  .stab.exclstr 0 : { *(.stab.exclstr) }
    8.79 -  .stab.index 0 : { *(.stab.index) }
    8.80 -  .stab.indexstr 0 : { *(.stab.indexstr) }
    8.81 -  .comment 0 : { *(.comment) }
    8.82 -}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/xen/arch/x86/x86_32/xen.lds.S	Thu Dec 29 16:59:12 2005 +0100
     9.3 @@ -0,0 +1,85 @@
     9.4 +/* ld script to make i386 Linux kernel
     9.5 + * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
     9.6 + * Modified for i386 Xen by Keir Fraser
     9.7 + */
     9.8 +
     9.9 +#include <xen/config.h>
    9.10 +#include <asm/page.h>
    9.11 +#undef ENTRY
    9.12 +#undef ALIGN
    9.13 +
    9.14 +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
    9.15 +OUTPUT_ARCH(i386)
    9.16 +ENTRY(start)
    9.17 +PHDRS
    9.18 +{
    9.19 +  text PT_LOAD ;
    9.20 +}
    9.21 +SECTIONS
    9.22 +{
    9.23 +  . = 0xFF000000 + 0x100000;
    9.24 +  _text = .;			/* Text and read-only data */
    9.25 +  .text : {
    9.26 +	*(.text)
    9.27 +	*(.fixup)
    9.28 +	*(.gnu.warning)
    9.29 +	} :text =0x9090
    9.30 +  .text.lock : { *(.text.lock) } :text	/* out-of-line lock text */
    9.31 +
    9.32 +  _etext = .;			/* End of text section */
    9.33 +
    9.34 +  .rodata : { *(.rodata) *(.rodata.*) } :text
    9.35 +
    9.36 +  . = ALIGN(32);		/* Exception table */
    9.37 +  __start___ex_table = .;
    9.38 +  __ex_table : { *(__ex_table) } :text
    9.39 +  __stop___ex_table = .;
    9.40 +
    9.41 +  . = ALIGN(32);		/* Pre-exception table */
    9.42 +  __start___pre_ex_table = .;
    9.43 +  __pre_ex_table : { *(__pre_ex_table) } :text
    9.44 +  __stop___pre_ex_table = .;
    9.45 +
    9.46 +  .data : {			/* Data */
    9.47 +	*(.data)
    9.48 +	CONSTRUCTORS
    9.49 +	} :text
    9.50 +
    9.51 +  . = ALIGN(4096);		/* Init code and data */
    9.52 +  __init_begin = .;
    9.53 +  .text.init : { *(.text.init) } :text
    9.54 +  .data.init : { *(.data.init) } :text
    9.55 +  . = ALIGN(32);
    9.56 +  __setup_start = .;
    9.57 +  .setup.init : { *(.setup.init) } :text
    9.58 +  __setup_end = .;
    9.59 +  __initcall_start = .;
    9.60 +  .initcall.init : { *(.initcall.init) } :text
    9.61 +  __initcall_end = .;
    9.62 +  . = ALIGN(STACK_SIZE);
    9.63 +  __init_end = .;
    9.64 +
    9.65 +  __bss_start = .;		/* BSS */
    9.66 +  .bss : {
    9.67 +	*(.bss.stack_aligned)
    9.68 +	*(.bss.page_aligned)
    9.69 +	*(.bss)
    9.70 +	} :text
    9.71 +  _end = . ;
    9.72 +
    9.73 +  /* Sections to be discarded */
    9.74 +  /DISCARD/ : {
    9.75 +	*(.text.exit)
    9.76 +	*(.data.exit)
    9.77 +	*(.exitcall.exit)
    9.78 +	}
    9.79 +
    9.80 +  /* Stabs debugging sections.  */
    9.81 +  .stab 0 : { *(.stab) }
    9.82 +  .stabstr 0 : { *(.stabstr) }
    9.83 +  .stab.excl 0 : { *(.stab.excl) }
    9.84 +  .stab.exclstr 0 : { *(.stab.exclstr) }
    9.85 +  .stab.index 0 : { *(.stab.index) }
    9.86 +  .stab.indexstr 0 : { *(.stab.indexstr) }
    9.87 +  .comment 0 : { *(.comment) }
    9.88 +}
    10.1 --- a/xen/arch/x86/x86_64/xen.lds	Thu Dec 29 15:47:23 2005 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,77 +0,0 @@
    10.4 -/* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */
    10.5 -/* Modified for x86-64 Xen by Keir Fraser */
    10.6 -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
    10.7 -OUTPUT_ARCH(i386:x86-64)
    10.8 -ENTRY(start)
    10.9 -PHDRS
   10.10 -{
   10.11 -  text PT_LOAD ;
   10.12 -}
   10.13 -SECTIONS
   10.14 -{
   10.15 -  . = 0xFFFF830000100000;
   10.16 -  _text = .;			/* Text and read-only data */
   10.17 -  .text : {
   10.18 -	*(.text)
   10.19 -	*(.fixup)
   10.20 -	*(.gnu.warning)
   10.21 -	} :text = 0x9090
   10.22 -  .text.lock : { *(.text.lock) } :text	/* out-of-line lock text */
   10.23 -
   10.24 -  _etext = .;			/* End of text section */
   10.25 -
   10.26 -  .rodata : { *(.rodata) *(.rodata.*) } :text
   10.27 -
   10.28 -  . = ALIGN(32);		/* Exception table */
   10.29 -  __start___ex_table = .;
   10.30 -  __ex_table : { *(__ex_table) } :text
   10.31 -  __stop___ex_table = .;
   10.32 -
   10.33 -  . = ALIGN(32);                /* Pre-exception table */
   10.34 -  __start___pre_ex_table = .;
   10.35 -  __pre_ex_table : { *(__pre_ex_table) } :text
   10.36 -  __stop___pre_ex_table = .;
   10.37 -
   10.38 -  .data : {			/* Data */
   10.39 -	*(.data)
   10.40 -	CONSTRUCTORS
   10.41 -	} :text
   10.42 -
   10.43 -  . = ALIGN(4096);		/* Init code and data */
   10.44 -  __init_begin = .;
   10.45 -  .text.init : { *(.text.init) } :text
   10.46 -  .data.init : { *(.data.init) } :text
   10.47 -  . = ALIGN(32);
   10.48 -  __setup_start = .;
   10.49 -  .setup.init : { *(.setup.init) } :text
   10.50 -  __setup_end = .;
   10.51 -  __initcall_start = .;
   10.52 -  .initcall.init : { *(.initcall.init) } :text
   10.53 -  __initcall_end = .;
   10.54 -  . = ALIGN(8192);
   10.55 -  __init_end = .;
   10.56 -
   10.57 -  __bss_start = .;		/* BSS */
   10.58 -  .bss : {
   10.59 -	*(.bss.twopage_aligned)
   10.60 -	*(.bss.page_aligned)
   10.61 -	*(.bss)
   10.62 -	} :text
   10.63 -  _end = . ;
   10.64 -
   10.65 -  /* Sections to be discarded */
   10.66 -  /DISCARD/ : {
   10.67 -	*(.text.exit)
   10.68 -	*(.data.exit)
   10.69 -	*(.exitcall.exit)
   10.70 -	}
   10.71 -
   10.72 -  /* Stabs debugging sections.  */
   10.73 -  .stab 0 : { *(.stab) }
   10.74 -  .stabstr 0 : { *(.stabstr) }
   10.75 -  .stab.excl 0 : { *(.stab.excl) }
   10.76 -  .stab.exclstr 0 : { *(.stab.exclstr) }
   10.77 -  .stab.index 0 : { *(.stab.index) }
   10.78 -  .stab.indexstr 0 : { *(.stab.indexstr) }
   10.79 -  .comment 0 : { *(.comment) }
   10.80 -}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/xen/arch/x86/x86_64/xen.lds.S	Thu Dec 29 16:59:12 2005 +0100
    11.3 @@ -0,0 +1,83 @@
    11.4 +/* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */
    11.5 +/* Modified for x86-64 Xen by Keir Fraser */
    11.6 +
    11.7 +#include <xen/config.h>
    11.8 +#include <asm/page.h>
    11.9 +#undef ENTRY
   11.10 +#undef ALIGN
   11.11 +
   11.12 +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
   11.13 +OUTPUT_ARCH(i386:x86-64)
   11.14 +ENTRY(start)
   11.15 +PHDRS
   11.16 +{
   11.17 +  text PT_LOAD ;
   11.18 +}
   11.19 +SECTIONS
   11.20 +{
   11.21 +  . = 0xFFFF830000100000;
   11.22 +  _text = .;			/* Text and read-only data */
   11.23 +  .text : {
   11.24 +	*(.text)
   11.25 +	*(.fixup)
   11.26 +	*(.gnu.warning)
   11.27 +	} :text = 0x9090
   11.28 +  .text.lock : { *(.text.lock) } :text	/* out-of-line lock text */
   11.29 +
   11.30 +  _etext = .;			/* End of text section */
   11.31 +
   11.32 +  .rodata : { *(.rodata) *(.rodata.*) } :text
   11.33 +
   11.34 +  . = ALIGN(32);		/* Exception table */
   11.35 +  __start___ex_table = .;
   11.36 +  __ex_table : { *(__ex_table) } :text
   11.37 +  __stop___ex_table = .;
   11.38 +
   11.39 +  . = ALIGN(32);                /* Pre-exception table */
   11.40 +  __start___pre_ex_table = .;
   11.41 +  __pre_ex_table : { *(__pre_ex_table) } :text
   11.42 +  __stop___pre_ex_table = .;
   11.43 +
   11.44 +  .data : {			/* Data */
   11.45 +	*(.data)
   11.46 +	CONSTRUCTORS
   11.47 +	} :text
   11.48 +
   11.49 +  . = ALIGN(4096);		/* Init code and data */
   11.50 +  __init_begin = .;
   11.51 +  .text.init : { *(.text.init) } :text
   11.52 +  .data.init : { *(.data.init) } :text
   11.53 +  . = ALIGN(32);
   11.54 +  __setup_start = .;
   11.55 +  .setup.init : { *(.setup.init) } :text
   11.56 +  __setup_end = .;
   11.57 +  __initcall_start = .;
   11.58 +  .initcall.init : { *(.initcall.init) } :text
   11.59 +  __initcall_end = .;
   11.60 +  . = ALIGN(STACK_SIZE);
   11.61 +  __init_end = .;
   11.62 +
   11.63 +  __bss_start = .;		/* BSS */
   11.64 +  .bss : {
   11.65 +	*(.bss.stack_aligned)
   11.66 +	*(.bss.page_aligned)
   11.67 +	*(.bss)
   11.68 +	} :text
   11.69 +  _end = . ;
   11.70 +
   11.71 +  /* Sections to be discarded */
   11.72 +  /DISCARD/ : {
   11.73 +	*(.text.exit)
   11.74 +	*(.data.exit)
   11.75 +	*(.exitcall.exit)
   11.76 +	}
   11.77 +
   11.78 +  /* Stabs debugging sections.  */
   11.79 +  .stab 0 : { *(.stab) }
   11.80 +  .stabstr 0 : { *(.stabstr) }
   11.81 +  .stab.excl 0 : { *(.stab.excl) }
   11.82 +  .stab.exclstr 0 : { *(.stab.exclstr) }
   11.83 +  .stab.index 0 : { *(.stab.index) }
   11.84 +  .stab.indexstr 0 : { *(.stab.indexstr) }
   11.85 +  .comment 0 : { *(.comment) }
   11.86 +}
    12.1 --- a/xen/include/asm-x86/current.h	Thu Dec 29 15:47:23 2005 +0100
    12.2 +++ b/xen/include/asm-x86/current.h	Thu Dec 29 16:59:12 2005 +0100
    12.3 @@ -49,7 +49,7 @@ static inline struct cpu_info *get_cpu_i
    12.4  #define reset_stack_and_jump(__fn)              \
    12.5      __asm__ __volatile__ (                      \
    12.6          "mov %0,%%"__OP"sp; jmp "STR(__fn)      \
    12.7 -        : : "r" (guest_cpu_user_regs()) )
    12.8 +        : : "r" (guest_cpu_user_regs()) : "memory" )
    12.9  
   12.10  #define schedule_tail(_ed) (((_ed)->arch.schedule_tail)(_ed))
   12.11