Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbmips/cavium Only clear BSS up to "end" symbol, n...



details:   https://anonhg.NetBSD.org/src/rev/1252caf51a19
branches:  trunk
changeset: 934024:1252caf51a19
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu Jun 04 03:08:59 2020 +0000

description:
Only clear BSS up to "end" symbol, not all the way to mips_round_page(end).
U-Boot puts some data immediately after the BSS section cleared in the ELF
segments, and we don't want to overwrite that.

XXX: Stop using mips_round_page(end) on all MIPS?

diffstat:

 sys/arch/evbmips/cavium/machdep.c |  21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diffs (57 lines):

diff -r af32c0d45f33 -r 1252caf51a19 sys/arch/evbmips/cavium/machdep.c
--- a/sys/arch/evbmips/cavium/machdep.c Thu Jun 04 03:08:33 2020 +0000
+++ b/sys/arch/evbmips/cavium/machdep.c Thu Jun 04 03:08:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.11 2020/05/31 14:05:21 simonb Exp $      */
+/*     $NetBSD: machdep.c,v 1.12 2020/06/04 03:08:59 simonb Exp $      */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -115,7 +115,7 @@
 #include "opt_cavium.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.11 2020/05/31 14:05:21 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2020/06/04 03:08:59 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,7 +154,6 @@
 
 #include <evbmips/cavium/octeon_uboot.h>
 
-static void    mach_init_bss(void);
 static void    mach_init_vector(void);
 static void    mach_init_bus_space(void);
 static void    mach_init_console(void);
@@ -191,8 +190,11 @@
        uint64_t btinfo_paddr;
        u_quad_t memsize;
        int corefreq;
+       extern char edata[], end[];
 
-       mach_init_bss();
+       /* clear the BSS segment */
+       memset(edata, 0, end - edata);
+
 
        KASSERT(MIPS_XKPHYS_P(arg3));
        btinfo_paddr = mips3_ld(arg3 + OCTEON_BTINFO_PADDR_OFFSET);
@@ -270,17 +272,6 @@
 }
 
 void
-mach_init_bss(void)
-{
-       extern char edata[], end[];
-
-       /*
-        * Clear the BSS segment.
-        */
-       memset(edata, 0, mips_round_page(end) - (uintptr_t)edata);
-}
-
-void
 mach_init_vector(void)
 {
 



Home | Main Index | Thread Index | Old Index