Skip to contentSkip to conversation

x86: merge final linking scripts

PATCH New Jan Beulich 1 participant 1 message Jul 10, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 x86: merge final linking scripts

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).

xen/arch/x86/Makefile +1 -1
@@ -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
xen/arch/x86/setup.c +5 -5
@@ -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);
xen/arch/x86/x86_32/xen.lds.S deleted +0 -110

110 lines not on this page · raw message

xen/arch/x86/x86_64/xen.lds.S deleted +0 -108

108 lines not on this page · raw message

xen/arch/x86/xen.lds.S new file +136 -0

136 lines not on this page · raw message