Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 Switch to the temporary stack right away ...



details:   https://anonhg.NetBSD.org/src/rev/8362c980c54c
branches:  trunk
changeset: 355701:8362c980c54c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Aug 10 14:13:45 2017 +0000

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

diffstat:

 sys/arch/i386/i386/locore.S |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r 33d647f343a7 -r 8362c980c54c sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S       Thu Aug 10 13:48:19 2017 +0000
+++ b/sys/arch/i386/i386/locore.S       Thu Aug 10 14:13:45 2017 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index