Module Name:    src
Committed By:   manu
Date:           Sun Dec 15 02:56:40 UTC 2019

Modified Files:
        src/sys/arch/amd64/amd64: locore.S
        src/sys/arch/amd64/conf: kern.ldscript

Log Message:
Restore multiboot 2 header in amd64 kernel

The header must appear below 32k offset in the kernel file, but we
have to make sure it does not load at low addresses, otherwise we
break BIOS boot.

.text section used to load at 0x200000, we just load multiboot section
there, and have .text loaded just after.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/conf/kern.ldscript

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/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.193 src/sys/arch/amd64/amd64/locore.S:1.194
--- src/sys/arch/amd64/amd64/locore.S:1.193	Tue Dec 10 02:06:07 2019
+++ src/sys/arch/amd64/amd64/locore.S	Sun Dec 15 02:56:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.193 2019/12/10 02:06:07 manu Exp $	*/
+/*	$NetBSD: locore.S,v 1.194 2019/12/15 02:56:40 manu Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -432,7 +432,7 @@ END(farjmp64)
 	.space	512
 tmpstk:
 
-.section multiboot,"ax",@progbits
+.section multiboot,"a"
 #if defined(MULTIBOOT)
 	.align	8
 	.globl	Multiboot2_Header

Index: src/sys/arch/amd64/conf/kern.ldscript
diff -u src/sys/arch/amd64/conf/kern.ldscript:1.29 src/sys/arch/amd64/conf/kern.ldscript:1.30
--- src/sys/arch/amd64/conf/kern.ldscript:1.29	Wed Dec 11 02:31:44 2019
+++ src/sys/arch/amd64/conf/kern.ldscript	Sun Dec 15 02:56:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript,v 1.29 2019/12/11 02:31:44 manu Exp $	*/
+/*	$NetBSD: kern.ldscript,v 1.30 2019/12/15 02:56:40 manu Exp $	*/
 
 #include "assym.h"
 
@@ -13,7 +13,17 @@ __LARGE_PAGE_SIZE = 0x200000 ;
 ENTRY(_start)
 SECTIONS
 {
-	.text : AT (ADDR(.text) & 0x0fffffff)
+	/*
+	 * 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)
+	{
+		. = ALIGN(8);
+		KEEP(*(multiboot));
+	}
+	.text : AT (0x200000 + SIZEOF(multiboot))
 	{
 		. = ALIGN(__PAGE_SIZE);
 		__text_user_start = . ;

Reply via email to