Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/stand/ofwboot Provide an option to use libsa...



details:   https://anonhg.NetBSD.org/src/rev/bb56cb7e3f9f
branches:  trunk
changeset: 319678:bb56cb7e3f9f
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Jun 06 22:56:25 2018 +0000

description:
Provide an option to use libsa allocator.  Not yet enabled.  Same
binary code is generated.

To enable uncomment -DHEAP_VARIABLE and comment out alloc.c in the
makefile.

PR port-macppc/44895

diffstat:

 sys/arch/macppc/stand/ofwboot/Locore.c |  19 ++++++++++++++++++-
 sys/arch/macppc/stand/ofwboot/Makefile |   8 ++++++--
 sys/arch/macppc/stand/ofwboot/boot.c   |   4 +++-
 3 files changed, 27 insertions(+), 4 deletions(-)

diffs (93 lines):

diff -r 11e872a6ad2c -r bb56cb7e3f9f sys/arch/macppc/stand/ofwboot/Locore.c
--- a/sys/arch/macppc/stand/ofwboot/Locore.c    Wed Jun 06 20:38:00 2018 +0000
+++ b/sys/arch/macppc/stand/ofwboot/Locore.c    Wed Jun 06 22:56:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: Locore.c,v 1.29 2016/04/22 18:25:41 christos Exp $     */
+/*     $NetBSD: Locore.c,v 1.30 2018/06/06 22:56:25 uwe Exp $  */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -31,6 +31,7 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/param.h>
 #include <lib/libsa/stand.h>
 
 #include <machine/cpu.h>
@@ -43,6 +44,13 @@
                __attribute__((__used__));
 static void setup(void);
 
+#ifdef HEAP_VARIABLE
+#ifndef HEAP_SIZE
+#define HEAP_SIZE 0x20000
+#endif
+char *heapspace;
+#endif
+
 static int stack[8192/4 + 4] __attribute__((__used__));
 
 #ifdef XCOFF_GLUE
@@ -621,6 +629,15 @@
            OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) !=
            sizeof(stdout))
                OF_exit();
+
+#ifdef HEAP_VARIABLE
+       heapspace = OF_claim(0, HEAP_SIZE, NBPG);
+       if (heapspace == (char *)-1) {
+               panic("Failed to allocate heap");
+       }
+
+       setheap(heapspace, heapspace + HEAP_SIZE);
+#endif /* HEAP_VARIABLE */
 }
 
 void
diff -r 11e872a6ad2c -r bb56cb7e3f9f sys/arch/macppc/stand/ofwboot/Makefile
--- a/sys/arch/macppc/stand/ofwboot/Makefile    Wed Jun 06 20:38:00 2018 +0000
+++ b/sys/arch/macppc/stand/ofwboot/Makefile    Wed Jun 06 22:56:25 2018 +0000
@@ -1,10 +1,10 @@
-#      $NetBSD: Makefile,v 1.58 2017/04/20 19:09:29 uwe Exp $
+#      $NetBSD: Makefile,v 1.59 2018/06/06 22:56:25 uwe Exp $
 
 S=     ${.CURDIR}/../../../..
 
 PROG=          ofwboot
 FILES=         ${PROG}.elf ${PROG}.xcf
-SRCS=          Locore.c boot.c ofdev.c hfs.c net.c netif_of.c alloc.c
+SRCS=          Locore.c boot.c ofdev.c hfs.c net.c netif_of.c
 XCOFFXTRA=     Xcoffxtra.c
 XCOFFXTRAOBJ=  Xcoffxtra.o
 CFLAGS+=       -ffreestanding
@@ -16,6 +16,10 @@
 CPPFLAGS+=     -DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK
 DBG=           -Os
 
+# PR port-macppc/44895
+SRCS+=         alloc.c                 # use ./alloc.c
+#CPPFLAGS+=    -DHEAP_VARIABLE         # use libsa alloc.c
+
 LIBCRT0=       # nothing
 LIBCRTI=       # nothing
 LIBCRTBEGIN=   # nothing
diff -r 11e872a6ad2c -r bb56cb7e3f9f sys/arch/macppc/stand/ofwboot/boot.c
--- a/sys/arch/macppc/stand/ofwboot/boot.c      Wed Jun 06 20:38:00 2018 +0000
+++ b/sys/arch/macppc/stand/ofwboot/boot.c      Wed Jun 06 22:56:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.28 2016/06/11 06:32:45 dholland Exp $       */
+/*     $NetBSD: boot.c,v 1.29 2018/06/06 22:56:25 uwe Exp $    */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -181,7 +181,9 @@
        extern char end[];
        int l;
 
+#if !defined(HEAP_VARIABLE)
        freeall();
+#endif
 
        /*
         * Stash pointer to end of symbol table after the argument



Home | Main Index | Thread Index | Old Index