WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 5/5] x86: merge final linking scripts

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 5/5] x86: merge final linking scripts
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 10 Jul 2009 15:55:42 +0100
Delivery-date: Fri, 10 Jul 2009 07:56:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
While unrelated to the previous four patches, I realized that the two
scripts are nearly identical when coding those earlier patches, and
this patch depends on them in order to apply cleanly.

As an extra measure, it also adjusts the (unused) space freed at the
end of the per-CPU area to include all alignment space needed before
the first actual constituent of the .bss section (up to 7 pages on
x86-64).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2009-07-10.orig/xen/arch/x86/Makefile       2009-02-04 11:33:19.000000000 
+0100
+++ 2009-07-10/xen/arch/x86/Makefile    2009-07-10 13:57:45.000000000 +0200
@@ -82,7 +82,7 @@ $(TARGET)-syms: $(ALL_OBJS) xen.lds
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
        $(CC) $(CFLAGS) -S -o $@ $<
 
-xen.lds: $(TARGET_SUBARCH)/xen.lds.S
+xen.lds: xen.lds.S
        $(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
--- 2009-07-10.orig/xen/arch/x86/setup.c        2009-07-10 13:57:36.000000000 
+0200
+++ 2009-07-10/xen/arch/x86/setup.c     2009-07-10 13:58:29.000000000 +0200
@@ -191,7 +191,8 @@ void __init discard_initial_images(void)
     init_domheap_pages(initial_images_base, initial_images_end);
 }
 
-extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
+extern char __init_begin[], __bss_start[];
+extern char __per_cpu_start[], __per_cpu_data_end[];
 
 static void __init percpu_init_areas(void)
 {
@@ -213,10 +214,11 @@ static void __init percpu_init_areas(voi
 
 #ifndef MEMORY_GUARD
     init_xenheap_pages(__pa(__per_cpu_start) + (first_unused << PERCPU_SHIFT),
-                       __pa(__per_cpu_end));
+                       __pa(__bss_start));
 #endif
     memguard_guard_range(&__per_cpu_start[first_unused << PERCPU_SHIFT],
-                         (NR_CPUS - first_unused) << PERCPU_SHIFT);
+                         __bss_start - &__per_cpu_start[first_unused <<
+                                                        PERCPU_SHIFT]);
 #if defined(CONFIG_X86_64)
     /* Also zap the mapping in the 1:1 area. */
     memguard_guard_range(__va(__pa(__per_cpu_start)) +
@@ -1127,8 +1129,6 @@ int xen_in_range(paddr_t start, paddr_t 
     /* initialize first time */
     if ( !xen_regions[0].s )
     {
-        extern char __init_begin[], __bss_start[];
-
         /* S3 resume code (and other real mode trampoline code) */
         xen_regions[0].s = bootsym_phys(trampoline_start);
         xen_regions[0].e = bootsym_phys(trampoline_end);
--- 2009-07-10.orig/xen/arch/x86/x86_32/xen.lds.S       2009-07-10 
13:57:36.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,110 +0,0 @@
-/* ld script to make i386 Linux kernel
- * Written by Martin Mares <mj@xxxxxxxxxxxxxxxxxxxxxxxx>
- * Modified for i386 Xen by Keir Fraser
- */
-
-#include <xen/config.h>
-#include <xen/cache.h>
-#include <asm/page.h>
-#include <asm/percpu.h>
-#undef ENTRY
-#undef ALIGN
-
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
-ENTRY(start)
-PHDRS
-{
-  text PT_LOAD ;
-}
-SECTIONS
-{
-  . = 0xFF000000 + 0x100000;
-  _start = .;
-  _stext = .;                  /* Text and read-only data */
-  .text : {
-       *(.text)
-       *(.fixup)
-       *(.gnu.warning)
-       } :text =0x9090
-
-  _etext = .;                  /* End of text section */
-
-  .rodata : { *(.rodata) *(.rodata.*) } :text
-
-  . = ALIGN(32);               /* Exception table */
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) } :text
-  __stop___ex_table = .;
-
-  . = ALIGN(32);               /* Pre-exception table */
-  __start___pre_ex_table = .;
-  __pre_ex_table : { *(__pre_ex_table) } :text
-  __stop___pre_ex_table = .;
-
-  .data : {                    /* Data */
-       *(.data)
-       CONSTRUCTORS
-       } :text
-
-  . = ALIGN(128);
-  .data.read_mostly : { *(.data.read_mostly) } :text
-
-  . = ALIGN(4096);             /* Init code and data */
-  __init_begin = .;
-  _sinittext = .;
-  .init.text : { *(.init.text) } :text
-  _einittext = .;
-  .init.data : { *(.init.data) } :text
-  . = ALIGN(32);
-  __setup_start = .;
-  .init.setup : { *(.init.setup) } :text
-  __setup_end = .;
-  __initcall_start = .;
-  .initcall.init : { *(.initcall1.init) } :text
-  __initcall_end = .;
-  __xsm_initcall_start = .; 
-  .xsm_initcall.init : { *(.xsm_initcall.init) } :text
-  __xsm_initcall_end = .;
-  . = ALIGN(PAGE_SIZE);
-  __init_end = .;
-
-  __per_cpu_shift = PERCPU_SHIFT; /* kdump assist */
-  .data.percpu : {
-       __per_cpu_start = .;
-       *(.data.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.data.percpu.read_mostly)
-       __per_cpu_data_end = .;
-  } :text
-  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
-  . = ALIGN(PAGE_SIZE);
-  __per_cpu_end = .;
-
-  __bss_start = .;             /* BSS */
-  .bss : {
-       . = ALIGN(STACK_SIZE);
-       *(.bss.stack_aligned)
-       . = ALIGN(PAGE_SIZE);
-       *(.bss.page_aligned)
-       *(.bss)
-       } :text
-  _end = . ;
-
-  /* Sections to be discarded */
-  /DISCARD/ : {
-       *(.exit.text)
-       *(.exit.data)
-       *(.exitcall.exit)
-       *(.eh_frame)
-       }
-
-  /* Stabs debugging sections.  */
-  .stab 0 : { *(.stab) }
-  .stabstr 0 : { *(.stabstr) }
-  .stab.excl 0 : { *(.stab.excl) }
-  .stab.exclstr 0 : { *(.stab.exclstr) }
-  .stab.index 0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-  .comment 0 : { *(.comment) }
-}
--- 2009-07-10.orig/xen/arch/x86/x86_64/xen.lds.S       2009-07-10 
13:57:36.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,108 +0,0 @@
-/* Excerpts written by Martin Mares <mj@xxxxxxxxxxxxxxxxxxxxxxxx> */
-/* Modified for x86-64 Xen by Keir Fraser */
-
-#include <xen/config.h>
-#include <xen/cache.h>
-#include <asm/page.h>
-#include <asm/percpu.h>
-#undef ENTRY
-#undef ALIGN
-
-OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
-OUTPUT_ARCH(i386:x86-64)
-ENTRY(start)
-PHDRS
-{
-  text PT_LOAD ;
-}
-SECTIONS
-{
-  . = __XEN_VIRT_START + 0x100000;
-  _start = .;
-  _stext = .;                  /* Text and read-only data */
-  .text : {
-       *(.text)
-       *(.fixup)
-       *(.gnu.warning)
-       } :text = 0x9090
-
-  _etext = .;                  /* End of text section */
-
-  .rodata : { *(.rodata) *(.rodata.*) } :text
-
-  . = ALIGN(32);               /* Exception table */
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) } :text
-  __stop___ex_table = .;
-
-  . = ALIGN(32);                /* Pre-exception table */
-  __start___pre_ex_table = .;
-  __pre_ex_table : { *(__pre_ex_table) } :text
-  __stop___pre_ex_table = .;
-
-  .data : {                    /* Data */
-       *(.data)
-       CONSTRUCTORS
-       } :text
-
-  . = ALIGN(128);
-  .data.read_mostly : { *(.data.read_mostly) } :text
-
-  . = ALIGN(4096);             /* Init code and data */
-  __init_begin = .;
-  _sinittext = .;
-  .init.text : { *(.init.text) } :text
-  _einittext = .;
-  .init.data : { *(.init.data) } :text
-  . = ALIGN(32);
-  __setup_start = .;
-  .init.setup : { *(.init.setup) } :text
-  __setup_end = .;
-  __initcall_start = .;
-  .initcall.init : { *(.initcall1.init) } :text
-  __initcall_end = .;
-  __xsm_initcall_start = .; 
-  .xsm_initcall.init : { *(.xsm_initcall.init) } :text
-  __xsm_initcall_end = .;
-  . = ALIGN(PAGE_SIZE);
-  __init_end = .;
-
-  __per_cpu_shift = PERCPU_SHIFT; /* kdump assist */
-  .data.percpu : {
-       __per_cpu_start = .;
-       *(.data.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.data.percpu.read_mostly)
-       __per_cpu_data_end = .;
-  } :text
-  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
-  . = ALIGN(PAGE_SIZE);
-  __per_cpu_end = .;
-
-  __bss_start = .;             /* BSS */
-  .bss : {
-       . = ALIGN(STACK_SIZE);
-       *(.bss.stack_aligned)
-       . = ALIGN(PAGE_SIZE);
-       *(.bss.page_aligned)
-       *(.bss)
-       } :text
-  _end = . ;
-
-  /* Sections to be discarded */
-  /DISCARD/ : {
-       *(.exit.text)
-       *(.exit.data)
-       *(.exitcall.exit)
-       *(.eh_frame)
-       }
-
-  /* Stabs debugging sections.  */
-  .stab 0 : { *(.stab) }
-  .stabstr 0 : { *(.stabstr) }
-  .stab.excl 0 : { *(.stab.excl) }
-  .stab.exclstr 0 : { *(.stab.exclstr) }
-  .stab.index 0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-  .comment 0 : { *(.comment) }
-}
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ 2009-07-10/xen/arch/x86/xen.lds.S   2009-07-10 13:57:45.000000000 +0200
@@ -0,0 +1,136 @@
+/* Excerpts written by Martin Mares <mj@xxxxxxxxxxxxxxxxxxxxxxxx> */
+/* Modified for i386/x86-64 Xen by Keir Fraser */
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <asm/page.h>
+#include <asm/percpu.h>
+#undef ENTRY
+#undef ALIGN
+
+#ifdef __x86_64__
+OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
+OUTPUT_ARCH(i386:x86-64)
+#else
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+#endif
+
+ENTRY(start)
+PHDRS
+{
+  text PT_LOAD ;
+}
+SECTIONS
+{
+  . = __XEN_VIRT_START + 0x100000;
+  _start = .;
+  .text : {
+        _stext = .;            /* Text and read-only data */
+       *(.text)
+       *(.fixup)
+       *(.gnu.warning)
+       _etext = .;             /* End of text section */
+  } :text = 0x9090
+
+  .rodata : {
+       *(.rodata)
+       *(.rodata.*)
+  } :text
+
+  . = ALIGN(32);               /* Exception table */
+  __ex_table : {
+       __start___ex_table = .;
+       *(__ex_table)
+       __stop___ex_table = .;
+  } :text
+
+  . = ALIGN(32);               /* Pre-exception table */
+  __pre_ex_table : {
+       __start___pre_ex_table = .;
+       *(__pre_ex_table)
+       __stop___pre_ex_table = .;
+  } :text
+
+  .data : {                    /* Data */
+       *(.data)
+       CONSTRUCTORS
+  } :text
+
+  . = ALIGN(128);
+  .data.read_mostly : {
+       *(.data.read_mostly)
+  } :text
+
+  . = ALIGN(4096);             /* Init code and data */
+  __init_begin = .;
+  .init.text : {
+       _sinittext = .;
+       *(.init.text)
+       _einittext = .;
+  } :text
+  .init.data : {
+       *(.init.data)
+  } :text
+  . = ALIGN(32);
+  .init.setup : {
+       __setup_start = .;
+       *(.init.setup)
+       __setup_end = .;
+  } :text
+  .initcall.init : {
+       __initcall_start = .;
+       *(.initcall1.init)
+       __initcall_end = .;
+  } :text
+  .xsm_initcall.init : {
+       __xsm_initcall_start = .;
+       *(.xsm_initcall.init)
+       __xsm_initcall_end = .;
+  } :text
+  . = ALIGN(PAGE_SIZE);
+  __init_end = .;
+
+  __per_cpu_shift = PERCPU_SHIFT; /* kdump assist */
+  .data.percpu : {
+       __per_cpu_start = .;
+       *(.data.percpu)
+       . = ALIGN(SMP_CACHE_BYTES);
+       *(.data.percpu.read_mostly)
+       __per_cpu_data_end = .;
+  } :text
+  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
+  . = ALIGN(PAGE_SIZE);
+
+  /*
+   * Do not insert anything here - the unused portion of .data.percpu
+   * will be freed/unmapped up to __bss_start (defined below).
+   */
+
+  .bss : {                     /* BSS */
+       . = ALIGN(STACK_SIZE);
+       __bss_start = .;
+       *(.bss.stack_aligned)
+       . = ALIGN(PAGE_SIZE);
+       *(.bss.page_aligned)
+       *(.bss)
+  } :text
+  _end = . ;
+
+  /* Sections to be discarded */
+  /DISCARD/ : {
+       *(.exit.text)
+       *(.exit.data)
+       *(.exitcall.exit)
+       *(.eh_frame)
+  }
+
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+}



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 5/5] x86: merge final linking scripts, Jan Beulich <=