Module Name:    src
Committed By:   maxv
Date:           Thu Aug 10 14:13:45 UTC 2017

Modified Files:
        src/sys/arch/i386/i386: locore.S

Log Message:
Switch to the temporary stack right away when booted via multiboot. GRUB
happens to give a correct stack, but it is not guaranteed by the spec. This
temporary stack will be reset later, which is fine.

Fixes PR/50245.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/i386/i386/locore.S

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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.149 src/sys/arch/i386/i386/locore.S:1.150
--- src/sys/arch/i386/i386/locore.S:1.149	Sat Jul 29 12:34:34 2017
+++ src/sys/arch/i386/i386/locore.S	Thu Aug 10 14:13:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.149 2017/07/29 12:34:34 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.150 2017/08/10 14:13:45 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.149 2017/07/29 12:34:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.150 2017/08/10 14:13:45 maxv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -342,11 +342,13 @@ _C_LABEL(Multiboot_Header):
 	jne	1f
 
 	/*
-	 * Indeed, a multiboot-compliant boot loader executed us.  We copy
-	 * the received Multiboot information structure into kernel's data
-	 * space to process it later -- after we are relocated.  It will
-	 * be safer to run complex C code than doing it at this point.
+	 * Indeed, a multiboot-compliant boot loader executed us. We switch
+	 * to the temporary stack, and copy the received Multiboot information
+	 * structure into kernel's data space to process it later -- after we
+	 * are relocated. It will be safer to run complex C code than doing it
+	 * at this point.
 	 */
+	movl	$_RELOC(tmpstk),%esp
 	pushl	%ebx		/* Address of Multiboot information */
 	call	_C_LABEL(multiboot_pre_reloc)
 	addl	$4,%esp

Reply via email to