Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/stand unrevert the changes made last night, n...



details:   https://anonhg.NetBSD.org/src/rev/31d9ba596895
branches:  trunk
changeset: 471467:31d9ba596895
user:      cgd <cgd%NetBSD.org@localhost>
date:      Fri Apr 02 03:11:57 1999 +0000

description:
unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on.  No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.

diffstat:

 sys/arch/alpha/stand/Makefile.bootprogs        |  64 ++++++++++++++++---
 sys/arch/alpha/stand/boot/Makefile             |  22 +++---
 sys/arch/alpha/stand/bootxx/Makefile           |  26 ++++---
 sys/arch/alpha/stand/bootxx/bootxx.c           |   2 +-
 sys/arch/alpha/stand/common/boot.c             |   2 +-
 sys/arch/alpha/stand/common/common.h           |   5 +-
 sys/arch/alpha/stand/common/headersize.c       |  86 --------------------------
 sys/arch/alpha/stand/common/prom.c             |  64 +++++++++++--------
 sys/arch/alpha/stand/common/start.S            |  33 +--------
 sys/arch/alpha/stand/installboot/installboot.c |  23 +-----
 sys/arch/alpha/stand/netboot/Makefile          |  24 +++---
 11 files changed, 144 insertions(+), 207 deletions(-)

diffs (truncated from 573 to 300 lines):

diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/Makefile.bootprogs
--- a/sys/arch/alpha/stand/Makefile.bootprogs   Fri Apr 02 03:08:02 1999 +0000
+++ b/sys/arch/alpha/stand/Makefile.bootprogs   Fri Apr 02 03:11:57 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bootprogs,v 1.7 1999/04/01 11:08:39 ross Exp $
+# $NetBSD: Makefile.bootprogs,v 1.8 1999/04/02 03:11:57 cgd Exp $
 
 S=     ${.CURDIR}/../../../..
 
@@ -10,6 +10,8 @@
 
 STRIP?=        strip
 
+CHECKSIZE_CMD= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
+
 .PHONY: machine-links
 beforedepend: machine-links
 # ${MACHINE} then ${MACHINE_ARCH}
@@ -26,23 +28,66 @@
 #CPPFLAGS+= -nostdinc -I${.OBJDIR}
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS += -D_STANDALONE -I${.CURDIR}/../.. -I${S}
-CFLAGS = ${CWARNFLAGS} -mno-fp-regs -g
+CFLAGS = ${CWARNFLAGS} -Os -mno-fp-regs -g
 
 # For descriptions of regions available to bootstrap programs, see
 # section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
 # the Alpha AXP Architecture Reference Manual.
 
-PRIMARY_LOAD_ADDRESS=  20000000        # "Region 1 start"
-SECONDARY_LOAD_ADDRESS=        20004000        # "Region 1 start" + 32k
-HEAP_LIMIT=            20040000        # "Region 1 start" + 256k
+REGION1_START=         0x20000000              # "Region 1 start"
+REGION1_SIZE!=         expr 256 \* 1024        # 256k
+
+# our memory lauout:
+
+#      'unified' boot loaders (e.g. netboot) can consume all of region
+#      1 for their text+data, or text+data+bss.
+
+UNIFIED_LOAD_ADDRESS=  ${REGION1_START}
+UNIFIED_MAX_LOAD!=     expr ${REGION1_SIZE}
+UNIFIED_MAX_TOTAL!=    expr ${REGION1_SIZE}
+
+#UNIFIED_HEAP_START=   right after secondary bss
+UNIFIED_HEAP_LIMIT=    (${REGION1_START} + ${REGION1_SIZE})
+
+#      two-stage boot loaders must share region 1.  The first stage
+#      loads into the lowest portion, and uses the higest portion
+#      for its heap.  The second stage loads in between the primary image
+#      and the heap, and can reuse the memory after it (i.e. the primary's
+#      heap) for its own heap.
+
+PRIMARY_LOAD_ADDRESS=  ${REGION1_START}
+#PRIMARY_MAX_LOAD=     booter dependent, no more than ${PRIMARY_MAX_TOTAL}
+PRIMARY_MAX_TOTAL!=    expr 16 \* 1024
 
-CPPFLAGS+=             -DPRIMARY_LOAD_ADDRESS="0x${PRIMARY_LOAD_ADDRESS}"
-CPPFLAGS+=             -DSECONDARY_LOAD_ADDRESS="0x${SECONDARY_LOAD_ADDRESS}"
-CPPFLAGS+=             -DHEAP_LIMIT="0x${HEAP_LIMIT}"
+# XXX SECONDARY_LOAD_ADDRESS should be
+# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
+# XXX way to do that calculation and 'ld' wants a single number.
+SECONDARY_LOAD_ADDRESS=        0x20004000      # XXX
+SECONDARY_MAX_LOAD!=   expr 112 \* 1024
+SECONDARY_MAX_TOTAL!=  expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
+
+PRIMARY_HEAP_START=    (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
+PRIMARY_HEAP_LIMIT=    (${REGION1_START} + ${REGION1_SIZE})
+
+#SECONDARY_HEAP_START= right after secondary bss
+SECONDARY_HEAP_LIMIT=  (${REGION1_START} + ${REGION1_SIZE})
 
-PRIMARY_CPPFLAGS=      -DPRIMARY_BOOTBLOCK
 FILE_FORMAT_CPPFLAGS=  -DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF
 
+UNIFIED_CPPFLAGS=      -DUNIFIED_BOOTBLOCK \
+                       -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
+                       ${FILE_FORMAT_CPP_FLAGS}
+
+PRIMARY_CPPFLAGS=      -DPRIMARY_BOOTBLOCK \
+                       -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
+                       -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
+                       -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
+                       -DHEAP_START="${PRIMARY_HEAP_START}"
+
+SECONDARY_CPPFLAGS=    -DSECONDARY_BOOTBLOCK \
+                       -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
+                       ${FILE_FORMAT_CPP_FLAGS}
+
 .include <bsd.prog.mk>
 
 ### find out what to use for libkern
@@ -57,6 +102,5 @@
 
 ### find out what to use for libsa
 SA_AS=         library
-SAMISCMAKEFLAGS= SA_USE_CREAD=yes
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=         ${SALIB}
diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/boot/Makefile
--- a/sys/arch/alpha/stand/boot/Makefile        Fri Apr 02 03:08:02 1999 +0000
+++ b/sys/arch/alpha/stand/boot/Makefile        Fri Apr 02 03:11:57 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 1999/04/01 11:08:39 ross Exp $
+# $NetBSD: Makefile,v 1.23 1999/04/02 03:11:57 cgd Exp $
 
 PROG = boot
 
@@ -6,20 +6,20 @@
 SRCS+= devopen.c filesystem.c prom_swpal.S
 
 BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS}
-HEADERSIZE_PROG = headersize
 
-CPPFLAGS += ${FILE_FORMAT_CPPFLAGS}
+CPPFLAGS += ${SECONDARY_CPPFLAGS}
 
-CLEANFILES+= vers.c vers.o ${PROG}.sym ${PROG}.nosym ${HEADERSIZE_PROG}
+CLEANFILES+= vers.c vers.o ${PROG}.sym
 
-${PROG}.nosym: ${PROG}.sym
-       cp ${PROG}.sym ${PROG}.nosym
-       ${STRIP} ${PROG}.nosym
+${PROG}: ${PROG}.sym
+       @echo creating ${PROG} from ${PROG}.sym...
+       @objcopy --output-target=binary ${PROG}.sym ${PROG}
+       @chmod 644 ${PROG}
+       @ls -l ${PROG}
+       @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${SECONDARY_MAX_LOAD} \
+           ${SECONDARY_MAX_TOTAL} || (rm -f ${PROG} ; false)
 
-${PROG}: ${PROG}.nosym ${HEADERSIZE_PROG}
-       dd if=${PROG}.nosym of=${PROG} \
-           bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${PROG}.nosym` skip=1
-
+SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=yes
 .include "../Makefile.bootprogs"
 
 ${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/bootxx/Makefile
--- a/sys/arch/alpha/stand/bootxx/Makefile      Fri Apr 02 03:08:02 1999 +0000
+++ b/sys/arch/alpha/stand/bootxx/Makefile      Fri Apr 02 03:11:57 1999 +0000
@@ -1,25 +1,26 @@
-# $NetBSD: Makefile,v 1.18 1999/04/01 11:08:39 ross Exp $
+# $NetBSD: Makefile,v 1.19 1999/04/02 03:11:57 cgd Exp $
 
 PROG = bootxx
 
 SRCS = start.S bootxx.c prom.c prom_disp.S puts.c
 
 BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS}
-HEADERSIZE_PROG = headersize
+PRIMARY_MAX_LOAD!=     expr 8192 - 512
 
 CPPFLAGS += ${PRIMARY_CPPFLAGS}
 
-CLEANFILES+= ${PROG}.sym ${PROG}.nosym ${HEADERSIZE_PROG}
-
-${PROG}.nosym: ${PROG}.sym
-       cp ${PROG}.sym ${PROG}.nosym
-       ${STRIP} ${PROG}.nosym
+CLEANFILES+= ${PROG}.sym ${PROG}.trunc
 
-${PROG}: ${PROG}.nosym ${HEADERSIZE_PROG}
-       dd if=${PROG}.nosym of=${PROG} \
-           ibs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${PROG}.nosym` skip=1 \
-           obs=`expr 15 \* 512` conv=osync
+${PROG}: ${PROG}.sym
+       @echo creating ${PROG} from ${PROG}.sym...
+       @objcopy --output-target=binary ${PROG}.sym ${PROG}.trunc
+       @chmod 644 ${PROG}.trunc
+       @dd if=${PROG}.trunc of=${PROG} obs=`expr 15 \* 512` conv=osync
+       @ls -l ${PROG}
+       @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${PRIMARY_MAX_LOAD} \
+           ${PRIMARY_MAX_TOTAL} || (rm -f ${PROG} ; false)
 
+SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=no
 .include "../Makefile.bootprogs"
 
 NETBSD_VERS!=sh ${.CURDIR}/../../../../conf/osrelease.sh
@@ -28,4 +29,5 @@
 ${PROG}.sym: ${OBJS} ${LIBKERN}
        ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym ${OBJS} \
            ${LIBKERN}
-       ${SIZE} ${PROG}.sym
+       @chmod 644 ${PROG}.sym
+       @${SIZE} ${PROG}.sym
diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/bootxx/bootxx.c
--- a/sys/arch/alpha/stand/bootxx/bootxx.c      Fri Apr 02 03:08:02 1999 +0000
+++ b/sys/arch/alpha/stand/bootxx/bootxx.c      Fri Apr 02 03:11:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootxx.c,v 1.10 1999/04/01 11:08:39 ross Exp $ */
+/* $NetBSD: bootxx.c,v 1.11 1999/04/02 03:11:57 cgd Exp $ */
 
 /*
  * Copyright (C) 1998 by Ross Harvey
diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/common/boot.c
--- a/sys/arch/alpha/stand/common/boot.c        Fri Apr 02 03:08:02 1999 +0000
+++ b/sys/arch/alpha/stand/common/boot.c        Fri Apr 02 03:11:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.15 1999/04/01 11:08:39 ross Exp $ */
+/* $NetBSD: boot.c,v 1.16 1999/04/02 03:11:57 cgd Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/common/common.h
--- a/sys/arch/alpha/stand/common/common.h      Fri Apr 02 03:08:02 1999 +0000
+++ b/sys/arch/alpha/stand/common/common.h      Fri Apr 02 03:11:57 1999 +0000
@@ -1,9 +1,10 @@
-/*     $NetBSD: common.h,v 1.6 1999/04/01 11:08:39 ross Exp $  */
+/*     $NetBSD: common.h,v 1.7 1999/04/02 03:11:57 cgd Exp $   */
+
+#define        alpha_pal_imb() __asm__("imb")
 
 void init_prom_calls __P((void));
 void OSFpal __P((void));
 void halt __P((void));
 u_int64_t prom_dispatch __P((int, ...));
-int cpu_number __P((void));
 void switch_palcode __P((void));
 void close_primary_device __P((int));
diff -r 2b835d7a0590 -r 31d9ba596895 sys/arch/alpha/stand/common/headersize.c
--- a/sys/arch/alpha/stand/common/headersize.c  Fri Apr 02 03:08:02 1999 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/* $NetBSD: headersize.c,v 1.5 1999/04/01 11:08:39 ross Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- * 
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- * 
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
- * Carnegie Mellon requests users of this software to return to
- *
- *  Software Distribution Coordinator  or  Software.Distribution%CS.CMU.EDU@localhost
- *  School of Computer Science
- *  Carnegie Mellon University
- *  Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#define        ELFSIZE         64
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/exec.h>
-#include <sys/exec_ecoff.h>
-#include <sys/exec_elf.h>
-
-#include <unistd.h>
-#include <stdio.h>
-#include <err.h>
-
-#define        HDR_BUFSIZE     512
-
-int
-main(argc, argv)
-       int argc;
-       char *argv[];
-{
-       char buf[HDR_BUFSIZE], *fname;
-       struct ecoff_exechdr *ecoffp;
-       Elf_Ehdr *elfp;
-       int fd;
-       unsigned long loadaddr;
-
-       if (argc != 3)
-               errx(1, "must be given two arguments (load addr, file name)");
-       if (sscanf(argv[1], "%lx", &loadaddr) != 1)
-               errx(1, "load addr argument (%s) not valid", argv[1]);
-       fname = argv[2];
-
-       if ((fd = open(fname, O_RDONLY, 0)) == -1)
-               err(1, "%s: open failed", fname);
-
-       if (read(fd, &buf, HDR_BUFSIZE) < HDR_BUFSIZE)
-               err(1, "%s: read failed", fname);
-       ecoffp = (struct ecoff_exechdr *)buf;
-       elfp = (Elf_Ehdr *)buf;
-
-       if (!ECOFF_BADMAG(ecoffp)) {
-               printf("%ld\n", ECOFF_TXTOFF(ecoffp));
-       } else if (memcmp(Elf_e_ident, elfp->e_ident, Elf_e_siz) == 0) {
-               Elf_Phdr phdr;
-
-               /* XXX assume the first segment is the one we want */



Home | Main Index | Thread Index | Old Index