Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/amd64



On Tue, Dec 31, 2019 at 09:32:05AM +0100, Maxime Villard wrote:
> I think max-page-size=0x1000 is the right thing to do, but someone needs to
> verify that the resulting binary is correct and that the resulting in-memory
> layout is correct too.

Attached is an updated patch with this approach. I tested at mine and
it seems fine.

I am especially interested by feedback from msaitoh@ who reported the
crash at cpu attacch that I suspect to be the (probably unrelated) 
problem describred here:
http://mail-index.netbsd.org/tech-kern/2020/01/02/msg025911.html

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost
Index: sys/arch/amd64/amd64/locore.S
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/locore.S,v
retrieving revision 1.195
diff -U4 -r1.195 locore.S
--- sys/arch/amd64/amd64/locore.S	15 Dec 2019 02:58:21 -0000	1.195
+++ sys/arch/amd64/amd64/locore.S	4 Jan 2020 01:48:11 -0000
@@ -431,10 +431,10 @@
 	.size	tmpstk, tmpstk - .
 	.space	512
 tmpstk:
 
-.section multiboot,"a"
 #if defined(MULTIBOOT)
+.section multiboot,"",@note
 	.align	8
 	.globl	Multiboot2_Header
 _C_LABEL(Multiboot2_Header):
 	.int	MULTIBOOT2_HEADER_MAGIC
Index: sys/arch/amd64/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/GENERIC,v
retrieving revision 1.551
diff -U4 -r1.551 GENERIC
--- sys/arch/amd64/conf/GENERIC	14 Dec 2019 07:45:20 -0000	1.551
+++ sys/arch/amd64/conf/GENERIC	4 Jan 2020 01:48:11 -0000
@@ -25,9 +25,9 @@
 #ident		"GENERIC-$Revision: 1.551 $"
 
 maxusers	64		# estimated number of users
 
-#options 	MULTIBOOT	# Multiboot support (see multiboot(8)) 
+options 	MULTIBOOT	# Multiboot support (see multiboot(8)) 
 
 # delay between "rebooting ..." message and hardware reset, in milliseconds
 #options 	CPURESET_DELAY=2000
 
Index: sys/arch/amd64/conf/Makefile.amd64
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/Makefile.amd64,v
retrieving revision 1.80
diff -U4 -r1.80 Makefile.amd64
--- sys/arch/amd64/conf/Makefile.amd64	14 Nov 2019 16:23:52 -0000	1.80
+++ sys/arch/amd64/conf/Makefile.amd64	4 Jan 2020 01:48:11 -0000
@@ -90,12 +90,12 @@
 ## (5) link settings
 ##
 TEXTADDR?=	0xffffffff80200000
 .if defined(KASLR)
-EXTRA_LINKFLAGS=	--split-by-file=0x100000 -r -d
+EXTRA_LINKFLAGS=	--split-by-file=0x100000 -z max-page-size=0x1000 -r -d
 KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
 .else
-EXTRA_LINKFLAGS=	-z max-page-size=0x200000
+EXTRA_LINKFLAGS=	-z max-page-size=0x1000
 KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript
 .endif
 LINKFLAGS_NORMAL=	-X
 
Index: sys/arch/amd64/conf/kern.ldscript
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/kern.ldscript,v
retrieving revision 1.30
diff -U4 -r1.30 kern.ldscript
--- sys/arch/amd64/conf/kern.ldscript	15 Dec 2019 02:56:40 -0000	1.30
+++ sys/arch/amd64/conf/kern.ldscript	4 Jan 2020 01:48:11 -0000
@@ -12,20 +12,11 @@
 
 ENTRY(_start)
 SECTIONS
 {
-	/*
-	 * multiboot (file_offset) : AT (load_address) 
-	 * file_offset must be below 32k for multiboot 2 specification
-	 * BIOS boot requires load_address above 0x200000
-	 */
-	multiboot 0x1000 : AT (0x200000)
+	.text : AT (ADDR(.text) & 0x0fffffff)
 	{
-		. = ALIGN(8);
 		KEEP(*(multiboot));
-	}
-	.text : AT (0x200000 + SIZEOF(multiboot))
-	{
 		. = ALIGN(__PAGE_SIZE);
 		__text_user_start = . ;
 		*(.text.user)
 		. = ALIGN(__PAGE_SIZE);


Home | Main Index | Thread Index | Old Index