Date: Tue, 20 Jan 2015 05:28:03 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277411 - head/sys/powerpc/aim Message-ID: <201501200528.t0K5S3kJ086699@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Tue Jan 20 05:28:03 2015 New Revision: 277411 URL: https://svnweb.freebsd.org/changeset/base/277411 Log: Zero BSS explicitly if not started by loader(8). Add a check for the magic values that ePAPR-compliant loaders (like skiboot) put in the register loader uses for the metadata pointer to avoid confusing them. Modified: head/sys/powerpc/aim/machdep.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Tue Jan 20 05:14:07 2015 (r277410) +++ head/sys/powerpc/aim/machdep.c Tue Jan 20 05:28:03 2015 (r277411) @@ -224,6 +224,10 @@ cpu_startup(void *dummy) } extern vm_offset_t __startkernel, __endkernel; +extern unsigned char __bss_start[]; +extern unsigned char __sbss_start[]; +extern unsigned char __sbss_end[]; +extern unsigned char _end[]; #ifndef __powerpc64__ /* Bits for running on 64-bit systems in 32-bit mode. */ @@ -272,9 +276,6 @@ powerpc_init(vm_offset_t fdt, vm_offset_ trap_offset = 0; cacheline_warn = 0; - /* Store boot environment state */ - OF_initial_setup((void *)fdt, NULL, (int (*)(void *))ofentry); - /* First guess at start/end kernel positions */ startkernel = __startkernel; endkernel = __endkernel; @@ -289,6 +290,10 @@ powerpc_init(vm_offset_t fdt, vm_offset_ mdp = NULL; #endif + /* Check for ePAPR loader, which puts a magic value into r6 */ + if (mdp == (void *)0x65504150) + mdp = NULL; + /* * Parse metadata if present and fetch parameters. Must be done * before console is inited so cninit gets the right value of @@ -308,8 +313,14 @@ powerpc_init(vm_offset_t fdt, vm_offset_ db_fetch_ksymtab(ksym_start, ksym_end); #endif } + } else { + bzero(__sbss_start, __sbss_end - __sbss_start); + bzero(__bss_start, _end - __bss_start); } + /* Store boot environment state */ + OF_initial_setup((void *)fdt, NULL, (int (*)(void *))ofentry); + /* * Init params/tunables that can be overridden by the loader */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501200528.t0K5S3kJ086699>