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 Revert recent changes, which either don...



details:   https://anonhg.NetBSD.org/src/rev/b58937159238
branches:  trunk
changeset: 467987:b58937159238
user:      ross <ross%NetBSD.org@localhost>
date:      Thu Apr 01 11:08:39 1999 +0000

description:
Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.

diffstat:

 sys/arch/alpha/stand/Makefile.bootprogs  |  64 +++--------------------
 sys/arch/alpha/stand/boot/Makefile       |  22 ++++----
 sys/arch/alpha/stand/bootxx/Makefile     |  25 ++++----
 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       |  66 ++++++++++--------------
 sys/arch/alpha/stand/common/start.S      |  33 ++++++++++-
 sys/arch/alpha/stand/netboot/Makefile    |  24 ++++----
 10 files changed, 191 insertions(+), 138 deletions(-)

diffs (truncated from 526 to 300 lines):

diff -r dc94da0075cd -r b58937159238 sys/arch/alpha/stand/Makefile.bootprogs
--- a/sys/arch/alpha/stand/Makefile.bootprogs   Thu Apr 01 11:02:20 1999 +0000
+++ b/sys/arch/alpha/stand/Makefile.bootprogs   Thu Apr 01 11:08:39 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bootprogs,v 1.6 1999/03/31 06:30:51 cgd Exp $
+# $NetBSD: Makefile.bootprogs,v 1.7 1999/04/01 11:08:39 ross Exp $
 
 S=     ${.CURDIR}/../../../..
 
@@ -10,8 +10,6 @@
 
 STRIP?=        strip
 
-CHECKSIZE_CMD= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
-
 .PHONY: machine-links
 beforedepend: machine-links
 # ${MACHINE} then ${MACHINE_ARCH}
@@ -28,66 +26,23 @@
 #CPPFLAGS+= -nostdinc -I${.OBJDIR}
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS += -D_STANDALONE -I${.CURDIR}/../.. -I${S}
-CFLAGS = ${CWARNFLAGS} -Os -mno-fp-regs -g
+CFLAGS = ${CWARNFLAGS} -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.
 
-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
+PRIMARY_LOAD_ADDRESS=  20000000        # "Region 1 start"
+SECONDARY_LOAD_ADDRESS=        20004000        # "Region 1 start" + 32k
+HEAP_LIMIT=            20040000        # "Region 1 start" + 256k
 
-# 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}
+CPPFLAGS+=             -DPRIMARY_LOAD_ADDRESS="0x${PRIMARY_LOAD_ADDRESS}"
+CPPFLAGS+=             -DSECONDARY_LOAD_ADDRESS="0x${SECONDARY_LOAD_ADDRESS}"
+CPPFLAGS+=             -DHEAP_LIMIT="0x${HEAP_LIMIT}"
 
-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
@@ -102,5 +57,6 @@
 
 ### 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 dc94da0075cd -r b58937159238 sys/arch/alpha/stand/boot/Makefile
--- a/sys/arch/alpha/stand/boot/Makefile        Thu Apr 01 11:02:20 1999 +0000
+++ b/sys/arch/alpha/stand/boot/Makefile        Thu Apr 01 11:08:39 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 1999/03/31 02:52:11 cgd Exp $
+# $NetBSD: Makefile,v 1.22 1999/04/01 11:08:39 ross Exp $
 
 PROG = boot
 
@@ -6,20 +6,20 @@
 SRCS+= devopen.c filesystem.c prom_swpal.S
 
 BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS}
+HEADERSIZE_PROG = headersize
 
-CPPFLAGS += ${SECONDARY_CPPFLAGS}
+CPPFLAGS += ${FILE_FORMAT_CPPFLAGS}
 
-CLEANFILES+= vers.c vers.o ${PROG}.sym
+CLEANFILES+= vers.c vers.o ${PROG}.sym ${PROG}.nosym ${HEADERSIZE_PROG}
 
-${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}.nosym: ${PROG}.sym
+       cp ${PROG}.sym ${PROG}.nosym
+       ${STRIP} ${PROG}.nosym
 
-SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=yes
+${PROG}: ${PROG}.nosym ${HEADERSIZE_PROG}
+       dd if=${PROG}.nosym of=${PROG} \
+           bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${PROG}.nosym` skip=1
+
 .include "../Makefile.bootprogs"
 
 ${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
diff -r dc94da0075cd -r b58937159238 sys/arch/alpha/stand/bootxx/Makefile
--- a/sys/arch/alpha/stand/bootxx/Makefile      Thu Apr 01 11:02:20 1999 +0000
+++ b/sys/arch/alpha/stand/bootxx/Makefile      Thu Apr 01 11:08:39 1999 +0000
@@ -1,25 +1,25 @@
-# $NetBSD: Makefile,v 1.17 1999/03/31 02:52:11 cgd Exp $
+# $NetBSD: Makefile,v 1.18 1999/04/01 11:08:39 ross Exp $
 
 PROG = bootxx
 
 SRCS = start.S bootxx.c prom.c prom_disp.S puts.c
 
 BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS}
-PRIMARY_MAX_LOAD!=     expr 8192 - 512
+HEADERSIZE_PROG = headersize
 
 CPPFLAGS += ${PRIMARY_CPPFLAGS}
 
-CLEANFILES+= ${PROG}.sym
+CLEANFILES+= ${PROG}.sym ${PROG}.nosym ${HEADERSIZE_PROG}
+
+${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} ${PRIMARY_MAX_LOAD} \
-           ${PRIMARY_MAX_TOTAL} || (rm -f ${PROG} ; false)
+${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
 
-SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=no
 .include "../Makefile.bootprogs"
 
 NETBSD_VERS!=sh ${.CURDIR}/../../../../conf/osrelease.sh
@@ -28,5 +28,4 @@
 ${PROG}.sym: ${OBJS} ${LIBKERN}
        ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym ${OBJS} \
            ${LIBKERN}
-       @chmod 644 ${PROG}.sym
-       @${SIZE} ${PROG}.sym
+       ${SIZE} ${PROG}.sym
diff -r dc94da0075cd -r b58937159238 sys/arch/alpha/stand/bootxx/bootxx.c
--- a/sys/arch/alpha/stand/bootxx/bootxx.c      Thu Apr 01 11:02:20 1999 +0000
+++ b/sys/arch/alpha/stand/bootxx/bootxx.c      Thu Apr 01 11:08:39 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootxx.c,v 1.9 1999/03/31 16:12:51 cgd Exp $ */
+/* $NetBSD: bootxx.c,v 1.10 1999/04/01 11:08:39 ross Exp $ */
 
 /*
  * Copyright (C) 1998 by Ross Harvey
diff -r dc94da0075cd -r b58937159238 sys/arch/alpha/stand/common/boot.c
--- a/sys/arch/alpha/stand/common/boot.c        Thu Apr 01 11:02:20 1999 +0000
+++ b/sys/arch/alpha/stand/common/boot.c        Thu Apr 01 11:08:39 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.14 1999/03/31 16:12:51 cgd Exp $ */
+/* $NetBSD: boot.c,v 1.15 1999/04/01 11:08:39 ross Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
diff -r dc94da0075cd -r b58937159238 sys/arch/alpha/stand/common/common.h
--- a/sys/arch/alpha/stand/common/common.h      Thu Apr 01 11:02:20 1999 +0000
+++ b/sys/arch/alpha/stand/common/common.h      Thu Apr 01 11:08:39 1999 +0000
@@ -1,10 +1,9 @@
-/*     $NetBSD: common.h,v 1.5 1999/03/31 03:04:21 cgd Exp $   */
-
-#define        alpha_pal_imb() __asm__("imb")
+/*     $NetBSD: common.h,v 1.6 1999/04/01 11:08:39 ross Exp $  */
 
 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 dc94da0075cd -r b58937159238 sys/arch/alpha/stand/common/headersize.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/alpha/stand/common/headersize.c  Thu Apr 01 11:08:39 1999 +0000
@@ -0,0 +1,86 @@
+/* $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 */
+               if (lseek(fd, elfp->e_phoff, SEEK_SET) == -1)



Home | Main Index | Thread Index | Old Index