Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64 Restore multiboot 2 header in amd64 kernel



details:   https://anonhg.NetBSD.org/src/rev/3bae70528818
branches:  trunk
changeset: 967582:3bae70528818
user:      manu <manu%NetBSD.org@localhost>
date:      Sun Dec 15 02:56:40 2019 +0000

description:
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.

diffstat:

 sys/arch/amd64/amd64/locore.S     |   4 ++--
 sys/arch/amd64/conf/kern.ldscript |  14 ++++++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r a60a0d96bc2f -r 3bae70528818 sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Sun Dec 15 01:16:33 2019 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Sun Dec 15 02:56:40 2019 +0000
@@ -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 @@
        .space  512
 tmpstk:
 
-.section multiboot,"ax",@progbits
+.section multiboot,"a"
 #if defined(MULTIBOOT)
        .align  8
        .globl  Multiboot2_Header
diff -r a60a0d96bc2f -r 3bae70528818 sys/arch/amd64/conf/kern.ldscript
--- a/sys/arch/amd64/conf/kern.ldscript Sun Dec 15 01:16:33 2019 +0000
+++ b/sys/arch/amd64/conf/kern.ldscript Sun Dec 15 02:56:40 2019 +0000
@@ -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 @@
 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 = . ;



Home | Main Index | Thread Index | Old Index