Module Name:    src
Committed By:   maxv
Date:           Tue Aug  2 14:03:34 UTC 2016

Modified Files:
        src/sys/arch/amd64/conf: kern.ldscript.Xen
        src/sys/arch/i386/conf: kern.ldscript.Xen

Log Message:
Align the segments properly, and split text+rodata in two separate segments
on Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/conf/kern.ldscript.Xen
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/conf/kern.ldscript.Xen

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/kern.ldscript.Xen
diff -u src/sys/arch/amd64/conf/kern.ldscript.Xen:1.12 src/sys/arch/amd64/conf/kern.ldscript.Xen:1.13
--- src/sys/arch/amd64/conf/kern.ldscript.Xen:1.12	Fri May 13 05:45:13 2016
+++ src/sys/arch/amd64/conf/kern.ldscript.Xen	Tue Aug  2 14:03:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.Xen,v 1.12 2016/05/13 05:45:13 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript.Xen,v 1.13 2016/08/02 14:03:34 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -7,24 +7,26 @@ __PAGE_SIZE = 0x1000 ;
 ENTRY(_start)
 SECTIONS
 {
-	/* Read-only sections, merged into text segment: */
 	.text :
 	{
 		*(.text)
 		*(.text.*)
 		*(.stub)
-		*(.rodata)
 	}
 	_etext = . ;
 	PROVIDE (etext = .) ;
 
-	/*
-	 * Adjust the address for the data segment.  We want to adjust up to
-	 * the same address within the page on the next page up.
-	 */
-	. = ALIGN(0x100000) + (. & (0x100000 - 1));
+	. = ALIGN(__PAGE_SIZE);
 
 	__rodata_start = . ;
+	.rodata :
+	{
+		*(.rodata)
+		*(.rodata.*)
+	}
+
+	. = ALIGN(__PAGE_SIZE);
+
 	__data_start = . ;
 	.data :
 	{
@@ -53,7 +55,12 @@ SECTIONS
 		*(COMMON)
 		. = ALIGN(64 / 8);
 	}
-	. = ALIGN(64 / 8);
+
+	. = ALIGN(__PAGE_SIZE);
+
+	/* End of the kernel image */
+	__kernel_end = . ;
+
 	_end = . ;
 	PROVIDE (end = .) ;
 	.note.netbsd.ident :

Index: src/sys/arch/i386/conf/kern.ldscript.Xen
diff -u src/sys/arch/i386/conf/kern.ldscript.Xen:1.12 src/sys/arch/i386/conf/kern.ldscript.Xen:1.13
--- src/sys/arch/i386/conf/kern.ldscript.Xen:1.12	Fri May 13 05:45:13 2016
+++ src/sys/arch/i386/conf/kern.ldscript.Xen	Tue Aug  2 14:03:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.Xen,v 1.12 2016/05/13 05:45:13 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript.Xen,v 1.13 2016/08/02 14:03:34 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -6,7 +6,6 @@ __PAGE_SIZE = 0x1000 ;
 
 SECTIONS
 {
-	/* Read-only sections, merged into text segment: */
 	.text :
 	{
 		*(.text)
@@ -16,19 +15,17 @@ SECTIONS
 	_etext = . ;
 	PROVIDE (etext = .) ;
 
+	. = ALIGN(__PAGE_SIZE);
+
+	__rodata_start = . ;
 	.rodata :
 	{
 		*(.rodata)
 		*(.rodata.*)
 	}
 
-	/*
-	 * Adjust the address for the data segment.  We want to adjust up to
-	 * the same address within the page on the next page up.
-	 */
-	. = ALIGN(0x1000) + (. & (0x1000 - 1));
+	. = ALIGN(__PAGE_SIZE);
 
-	__rodata_start = . ;
 	__data_start = . ;
 	.data :
 	{
@@ -46,8 +43,8 @@ SECTIONS
 		*(.data.read_mostly)
 	}
 	. = ALIGN(COHERENCY_UNIT);
-	_edata = . ;
 
+	_edata = . ;
 	PROVIDE (edata = .) ;
 	__bss_start = . ;
 	.bss :
@@ -57,7 +54,12 @@ SECTIONS
 		*(COMMON)
 		. = ALIGN(32 / 8);
 	}
-	. = ALIGN(32 / 8);
+
+	. = ALIGN(__PAGE_SIZE);
+
+	/* End of the kernel image */
+	__kernel_end = . ;
+
 	_end = . ;
 	PROVIDE (end = .) ;
 	.note.netbsd.ident :

Reply via email to