diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-10-30 22:41:57 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-10-30 22:41:57 +0000 |
commit | 072b56c97e17e8e69ddab5a735b5297387a88a70 (patch) | |
tree | 22eaee09956502609c240ddff8a108d8733521f9 /sys/arch/alpha/stand | |
parent | b85b15782739220b5bf2563ccdc7ac9e256a31d2 (diff) |
Merge to NetBSD 961020. Retained our kernel APIs where NetBSD has changed.
-Wall -Wstrict-prototypes -Wmissing-prototypes too.
Diffstat (limited to 'sys/arch/alpha/stand')
36 files changed, 1262 insertions, 271 deletions
diff --git a/sys/arch/alpha/stand/Makefile b/sys/arch/alpha/stand/Makefile index a5346cabaf3..e2b081bc13b 100644 --- a/sys/arch/alpha/stand/Makefile +++ b/sys/arch/alpha/stand/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.3 1996/07/29 23:01:13 niklas Exp $ -# $NetBSD: Makefile,v 1.3 1995/11/23 02:38:45 cgd Exp $ +# $OpenBSD: Makefile,v 1.4 1996/10/30 22:40:26 niklas Exp $ +# $NetBSD: Makefile,v 1.4 1996/09/23 04:28:23 cgd Exp $ -SUBDIR= boot bootxx installboot +SUBDIR= boot bootxx installboot netboot .include <bsd.subdir.mk> diff --git a/sys/arch/alpha/stand/Makefile.inc b/sys/arch/alpha/stand/Makefile.inc index ba63f5a62ea..351d0e2ef81 100644 --- a/sys/arch/alpha/stand/Makefile.inc +++ b/sys/arch/alpha/stand/Makefile.inc @@ -1,5 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.2 1996/07/29 23:01:14 niklas Exp $ -# $NetBSD: Makefile.inc,v 1.1 1995/11/23 02:38:48 cgd Exp $ +# $OpenBSD: Makefile.inc,v 1.3 1996/10/30 22:40:27 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.3 1996/10/06 18:32:22 cgd Exp $ + +.include <bsd.own.mk> # for ELF_TOOLCHAIN definition BINDIR= /usr/mdec @@ -8,3 +10,8 @@ SECONDARY_LOAD_ADDRESS= 20020000 CPPFLAGS+= -DPRIMARY_LOAD_ADDRESS="0x${PRIMARY_LOAD_ADDRESS}" CPPFLAGS+= -DSECONDARY_LOAD_ADDRESS="0x${SECONDARY_LOAD_ADDRESS}" + +.if !defined(ELF_TOOLCHAIN) +CPPFLAGS+= -DECOFF_COMPAT +.endif + diff --git a/sys/arch/alpha/stand/OSFpal.c b/sys/arch/alpha/stand/OSFpal.c index 0dfe77e087f..0bf89c96fd0 100644 --- a/sys/arch/alpha/stand/OSFpal.c +++ b/sys/arch/alpha/stand/OSFpal.c @@ -1,5 +1,5 @@ -/* $OpenBSD: OSFpal.c,v 1.3 1996/07/29 23:01:16 niklas Exp $ */ -/* $NetBSD: OSFpal.c,v 1.2 1996/04/12 06:09:30 cgd Exp $ */ +/* $OpenBSD: OSFpal.c,v 1.4 1996/10/30 22:40:27 niklas Exp $ */ +/* $NetBSD: OSFpal.c,v 1.4 1996/10/13 03:00:24 christos Exp $ */ /* * Copyright (c) 1994, 1996 Carnegie-Mellon University. diff --git a/sys/arch/alpha/stand/bbinfo.h b/sys/arch/alpha/stand/bbinfo.h index 71c2bcdbde7..ee15a99b7aa 100644 --- a/sys/arch/alpha/stand/bbinfo.h +++ b/sys/arch/alpha/stand/bbinfo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bbinfo.h,v 1.3 1996/07/29 23:01:17 niklas Exp $ */ +/* $OpenBSD: bbinfo.h,v 1.4 1996/10/30 22:40:28 niklas Exp $ */ /* $NetBSD: bbinfo.h,v 1.2 1996/04/12 06:09:34 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile index d3c510de833..bf32ff1073a 100644 --- a/sys/arch/alpha/stand/boot/Makefile +++ b/sys/arch/alpha/stand/boot/Makefile @@ -1,12 +1,13 @@ -# $OpenBSD: Makefile,v 1.4 1996/07/29 23:01:31 niklas Exp $ -# $NetBSD: Makefile,v 1.6 1996/04/12 01:35:15 cgd Exp $ +# $OpenBSD: Makefile,v 1.5 1996/10/30 22:40:38 niklas Exp $ +# $NetBSD: Makefile,v 1.10 1996/10/18 06:01:41 thorpej Exp $ .PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa BOOT_PROG = boot BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS} -BOOT_SRCS = start.S boot.c disk.c conf.c prom.c prom_disp.S OSFpal.c +BOOT_SRCS = start.S boot.c loadfile.c disk.c conf.c prom.c prom_disp.S OSFpal.c + BOOT_SRCS+= alloc.c bzero.c close.c dev.c devopen.c disklabel.c dkcksum.c BOOT_SRCS+= getfile.c gets.c ioctl.c lseek.c open.c printf.c read.c BOOT_SRCS+= strcmp.c ufs.c write.c bcopy.c filesystem.c strlen.c @@ -15,9 +16,11 @@ BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g} HEADERSIZE_PROG = headersize -AFLAGS += -DASSEMBLER +DEFNS= -DCOMPAT_UFS -DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF + +AFLAGS += -DASSEMBLER ${DEFNS} CPPFLAGS += -I${.CURDIR}/../.. -I${.CURDIR}/../../../.. -CFLAGS = -Werror -mno-fp-regs -g -DCOMPAT_UFS +CFLAGS = -Werror -mno-fp-regs -g ${DEFNS} CLEANFILES+= vers.c vers.o @@ -28,21 +31,21 @@ all: ${BOOT_PROG} ${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG} sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${COMPILE.c} vers.c - ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.coff \ + ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.hdr \ ${BOOT_OBJS} vers.o -lc # XXX - size ${BOOT_PROG}.coff - strip ${BOOT_PROG}.coff - dd if=${BOOT_PROG}.coff of=${BOOT_PROG} \ - bs=`./${HEADERSIZE_PROG} < ${BOOT_PROG}.coff` skip=1 + size ${BOOT_PROG}.hdr + strip ${BOOT_PROG}.hdr + dd if=${BOOT_PROG}.hdr of=${BOOT_PROG} \ + bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${BOOT_PROG}.hdr` skip=1 install: - install -c -o bin -g bin -m 444 ${BOOT_PROG} \ + ${INSTALL} -c -o bin -g bin -m 444 ${BOOT_PROG} \ ${DESTDIR}${BINDIR}/${BOOT_PROG} clean: _SUBDIRUSE rm -f a.out [Ee]rrs mklog core *.core \ ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \ - ${BOOT_PROG}.coff ${HEADERSIZE_PROG} + ${BOOT_PROG}.hdr ${HEADERSIZE_PROG} cleandir: _SUBDIRUSE clean diff --git a/sys/arch/alpha/stand/boot/boot.c b/sys/arch/alpha/stand/boot/boot.c index 2ce83ae8f00..a585b2b3ed6 100644 --- a/sys/arch/alpha/stand/boot/boot.c +++ b/sys/arch/alpha/stand/boot/boot.c @@ -1,5 +1,5 @@ -/* $OpenBSD: boot.c,v 1.5 1996/07/31 16:24:11 niklas Exp $ */ -/* $NetBSD: boot.c,v 1.6 1996/05/10 00:15:08 cgd Exp $ */ +/* $OpenBSD: boot.c,v 1.6 1996/10/30 22:40:39 niklas Exp $ */ +/* $NetBSD: boot.c,v 1.8 1996/09/17 22:00:26 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -51,52 +51,25 @@ #define _KERNEL #include "include/pte.h" -static int aout_exec __P((int, struct exec *, u_int64_t *)); -static int coff_exec __P((int, struct ecoff_exechdr *, u_int64_t *)); -static int loadfile __P((char *, u_int64_t *)); - -char line[64] = "/bsd"; +int loadfile __P((char *, u_int64_t *)); char boot_file[128]; -char boot_dev[128]; char boot_flags[128]; -char boot_console[8]; extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; -#define KERNEL_ARGC 4 -char *kernel_argv[KERNEL_ARGC+1] = { - boot_file, - boot_flags, - boot_console, - boot_dev, - NULL -}; - vm_offset_t ffp_save, ptbr_save; void -main(argc, argv, envp) - int argc; - char **argv; - char **envp; +main() { u_int64_t entry; - int ask; - prom_return_t ret; - -#ifdef notdef - { - extern char *_EDATA, *_end; - bzero(_EDATA, _end - _EDATA); - } -#endif /* Init prom callback vector. */ init_prom_calls(); /* print a banner */ - printf("\n\n"); + printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); printf("\n"); @@ -106,177 +79,19 @@ main(argc, argv, envp) printf("\n"); - prom_getenv(PROM_E_BOOTED_DEV, boot_dev, sizeof(boot_dev)); prom_getenv(PROM_E_BOOTED_FILE, boot_file, sizeof(boot_file)); prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags)); - prom_getenv(PROM_E_TTY_DEV, boot_console, sizeof(boot_console)); - - printf("boot_dev = \"%s\"\n", boot_dev); - printf("boot_file = \"%s\"\n", boot_file); - printf("boot_flags = \"%s\"\n", boot_flags); - printf("boot_console = \"%s\"\n", boot_console); if (boot_file[0] == '\0') - bcopy(line, boot_file, strlen(line)+1); - -#ifdef JUSTASK - ask = 1; -#else - ask = 0; -#endif - for (;;) { - if (ask) { - (void)printf("Boot: "); - gets(line); - if (line[0] == '\0') - continue; - if (!strcmp(line, "halt")) - halt(); -/* XXX TURN LINE INTO BOOT FILE/FLAGS */ - bcopy(line, boot_file, strlen(line)+1); - } else - (void)printf("Boot: %s %s\n", boot_file, boot_flags); - - if (!loadfile(boot_file, &entry)) { - -printf("calling %lx with %lx, %lx, %lx, %lx, %lx\n", entry, -ffp_save, ptbr_save, KERNEL_ARGC, kernel_argv, NULL); - (*(void (*)())entry)(ffp_save, ptbr_save, KERNEL_ARGC, - kernel_argv, NULL); - } - - ask = 1; - } - /* NOTREACHED */ -} - -/* - * Open 'filename', read in program and return the entry point or -1 if error. - */ -static int -loadfile(fname, entryp) - char *fname; - u_int64_t *entryp; -{ - struct devices *dp; - union { - struct exec aout; - struct ecoff_exechdr coff; - } hdr; - ssize_t nr; - int fd, rval; - - /* Open the file. */ - rval = 1; - if ((fd = open(fname, 0)) < 0) { - (void)printf("open error: %d\n", errno); - goto err; - } - - /* Read the exec header. */ - if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) { - (void)printf("read error: %d\n", errno); - goto err; - } - - /* Exec a.out or COFF. */ - rval = ECOFF_BADMAG(&hdr.coff) ? /* XXX check aouthdr */ - aout_exec(fd, &hdr.aout, entryp) : - coff_exec(fd, &hdr.coff, entryp); + bcopy("bsd", boot_file, sizeof "bsd"); -err: -#ifndef SMALL - if (fd >= 0) - (void)close(fd); -#endif - if (rval) - (void)printf("can't boot '%s'\n", fname); - return (rval); -} - -static int -aout_exec(fd, aout, entryp) - int fd; - struct exec *aout; - u_int64_t *entryp; -{ - size_t sz; + (void)printf("Boot: %s %s\n", boot_file, boot_flags); - /* Check the magic number. */ - if (N_GETMAGIC(*aout) != OMAGIC) { - (void)printf("bad magic: %o\n", N_GETMAGIC(*aout)); - return (1); - } - - /* Read in text, data. */ - (void)printf("%lu+%lu", aout->a_text, aout->a_data); - if (lseek(fd, (off_t)N_TXTOFF(*aout), SEEK_SET) < 0) { - (void)printf("lseek: %d\n", errno); - return (1); - } - sz = aout->a_text + aout->a_data; - if (read(fd, (void *)aout->a_entry, sz) != sz) { - (void)printf("read text/data: %d\n", errno); - return (1); + if (!loadfile(boot_file, &entry)) { + (void)printf("Entering kernel at 0x%lx...\n", entry); + (*(void (*)())entry)(ffp_save, ptbr_save, 0); } - /* Zero out bss. */ - if (aout->a_bss != 0) { - (void)printf("+%lu", aout->a_bss); - bzero(aout->a_entry + sz, aout->a_bss); - } - - ffp_save = aout->a_entry + aout->a_text + aout->a_data + aout->a_bss; - ffp_save = k0segtophys((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT; - ffp_save += 2; /* XXX OSF/1 does this, no idea why. */ - - (void)printf("\n"); - *entryp = aout->a_entry; - return (0); -} - -static int -coff_exec(fd, coff, entryp) - int fd; - struct ecoff_exechdr *coff; - u_int64_t *entryp; -{ - - /* Read in text. */ - (void)printf("%lu", coff->a.tsize); - (void)lseek(fd, ECOFF_TXTOFF(coff), 0); - if (read(fd, (void *)coff->a.text_start, coff->a.tsize) != - coff->a.tsize) { - (void)printf("read text: %d\n", errno); - return (1); - } - - /* Read in data. */ - if (coff->a.dsize != 0) { - (void)printf("+%lu", coff->a.dsize); - if (read(fd, (void *)coff->a.data_start, coff->a.dsize) != - coff->a.dsize) { - (void)printf("read data: %d\n", errno); - return (1); - } - } - - - /* Zero out bss. */ - if (coff->a.bsize != 0) { - (void)printf("+%lu", coff->a.bsize); - bzero(coff->a.bss_start, coff->a.bsize); - } - - ffp_save = coff->a.text_start + coff->a.tsize; - if (ffp_save < coff->a.data_start + coff->a.dsize) - ffp_save = coff->a.data_start + coff->a.dsize; - if (ffp_save < coff->a.bss_start + coff->a.bsize) - ffp_save = coff->a.bss_start + coff->a.bsize; - ffp_save = k0segtophys((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT; - ffp_save += 2; /* XXX OSF/1 does this, no idea why. */ - - (void)printf("\n"); - *entryp = coff->a.entry; - return (0); + (void)printf("Boot failed! Halting...\n"); + halt(); } diff --git a/sys/arch/alpha/stand/boot/conf.c b/sys/arch/alpha/stand/boot/conf.c index 4c275c4513c..3883551a738 100644 --- a/sys/arch/alpha/stand/boot/conf.c +++ b/sys/arch/alpha/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.3 1996/07/29 23:01:35 niklas Exp $ */ +/* $OpenBSD: conf.c,v 1.4 1996/10/30 22:40:40 niklas Exp $ */ /* $NetBSD: conf.c,v 1.3 1995/11/23 02:39:31 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/devopen.c b/sys/arch/alpha/stand/boot/devopen.c index b25bdfb7318..2e9cbc1951d 100644 --- a/sys/arch/alpha/stand/boot/devopen.c +++ b/sys/arch/alpha/stand/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.2 1996/07/29 23:01:36 niklas Exp $ */ +/* $OpenBSD: devopen.c,v 1.3 1996/10/30 22:40:41 niklas Exp $ */ /* $NetBSD: devopen.c,v 1.1 1995/11/23 02:39:37 cgd Exp $ */ /*- diff --git a/sys/arch/alpha/stand/boot/disk.c b/sys/arch/alpha/stand/boot/disk.c index 3566a0036b3..5b70adf9a61 100644 --- a/sys/arch/alpha/stand/boot/disk.c +++ b/sys/arch/alpha/stand/boot/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.3 1996/07/29 23:01:38 niklas Exp $ */ +/* $OpenBSD: disk.c,v 1.4 1996/10/30 22:40:42 niklas Exp $ */ /* $NetBSD: disk.c,v 1.3 1995/11/23 02:39:40 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/disk.h b/sys/arch/alpha/stand/boot/disk.h index 43f5e0be52b..264c773ceea 100644 --- a/sys/arch/alpha/stand/boot/disk.h +++ b/sys/arch/alpha/stand/boot/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.2 1996/07/29 23:01:39 niklas Exp $ */ +/* $OpenBSD: disk.h,v 1.3 1996/10/30 22:40:42 niklas Exp $ */ /* $NetBSD: disk.h,v 1.1 1995/11/23 02:39:42 cgd Exp $ */ int diskstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); diff --git a/sys/arch/alpha/stand/boot/filesystem.c b/sys/arch/alpha/stand/boot/filesystem.c index 4833ce6acec..1956f3504fa 100644 --- a/sys/arch/alpha/stand/boot/filesystem.c +++ b/sys/arch/alpha/stand/boot/filesystem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filesystem.c,v 1.2 1996/07/29 23:01:41 niklas Exp $ */ +/* $OpenBSD: filesystem.c,v 1.3 1996/10/30 22:40:43 niklas Exp $ */ /* $NetBSD: filesystem.c,v 1.1 1995/11/23 02:39:46 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/newvers.sh b/sys/arch/alpha/stand/boot/newvers.sh index a65d3cfb37d..605d7141d93 100644 --- a/sys/arch/alpha/stand/boot/newvers.sh +++ b/sys/arch/alpha/stand/boot/newvers.sh @@ -1,7 +1,7 @@ #!/bin/sh - # -# $OpenBSD: newvers.sh,v 1.4 1996/07/31 16:24:12 niklas Exp $ -# $NetBSD: newvers.sh,v 1.2 1995/11/23 02:39:48 cgd Exp $ +# $OpenBSD: newvers.sh,v 1.5 1996/10/30 22:40:44 niklas Exp $ +# $NetBSD: newvers.sh,v 1.3 1996/06/14 20:03:04 cgd Exp $ # # Copyright (c) 1984, 1986, 1990, 1993 # The Regents of the University of California. All rights reserved. @@ -37,9 +37,9 @@ # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 u=${USER-root} h=`hostname` t=`date` -r=`head -1 $1` +r=`head -1 $1 | awk ' { print $3 } '` -echo "char bootprog_name[] = \"OpenBSD/Alpha boot\";" > vers.c +echo "char bootprog_name[] = \"OpenBSD/Alpha Secondary Boot\";" > vers.c echo "char bootprog_rev[] = \"${r}\";" >> vers.c echo "char bootprog_date[] = \"${t}\";" >> vers.c echo "char bootprog_maker[] = \"${u}@${h}\";" >> vers.c diff --git a/sys/arch/alpha/stand/boot/prom_swpal.S b/sys/arch/alpha/stand/boot/prom_swpal.S index 718ad653260..6b0c010ffde 100644 --- a/sys/arch/alpha/stand/boot/prom_swpal.S +++ b/sys/arch/alpha/stand/boot/prom_swpal.S @@ -1,5 +1,5 @@ -/* $OpenBSD: prom_swpal.S,v 1.2 1996/07/29 23:01:44 niklas Exp $ */ -/* $NetBSD: prom_swpal.S,v 1.2 1995/02/16 02:32:58 cgd Exp $ */ +/* $OpenBSD: prom_swpal.S,v 1.3 1996/10/30 22:40:45 niklas Exp $ */ +/* $NetBSD: prom_swpal.S,v 1.4 1996/10/17 02:50:41 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -61,13 +61,13 @@ #define PALSW_FRAME_SIZE (14*8) #define PALSW_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5 - .comm ptbr_save 8 + .comm ptbr_save,8 .text .align 4 NESTED(switch_palcode, 0, PALSW_FRAME_SIZE, ra, PALSW_REGS, 0) - SETGP(pv) + LDGP(pv) /* ldgp gp, 0(pv)*/ lda sp, -PALSW_FRAME_SIZE(sp) @@ -105,8 +105,7 @@ NESTED(switch_palcode, 0, PALSW_FRAME_SIZE, ra, PALSW_REGS, 0) call_pal PAL_VMS_mfpr_vptb mov v0, a3 -/* movi PAL_OSF, a0 */ - CONST(PAL_OSF, a0) + ldiq a0, PAL_OSF lda a1, contin ldq a2, 16(sp) diff --git a/sys/arch/alpha/stand/boot/test.c b/sys/arch/alpha/stand/boot/test.c index 3da120e34b8..82fb6684ffe 100644 --- a/sys/arch/alpha/stand/boot/test.c +++ b/sys/arch/alpha/stand/boot/test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test.c,v 1.2 1996/07/29 23:01:46 niklas Exp $ */ +/* $OpenBSD: test.c,v 1.3 1996/10/30 22:40:46 niklas Exp $ */ /* $NetBSD: test.c,v 1.2 1995/02/16 02:33:00 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/version b/sys/arch/alpha/stand/boot/version index f396a5a7ebf..4343db37627 100644 --- a/sys/arch/alpha/stand/boot/version +++ b/sys/arch/alpha/stand/boot/version @@ -1,5 +1,5 @@ -$OpenBSD: version,v 1.4 1996/07/29 23:01:48 niklas Exp $ -$NetBSD: version,v 1.5 1996/05/09 23:54:18 cgd Exp $ +$OpenBSD: version,v 1.5 1996/10/30 22:40:47 niklas Exp $ +$NetBSD: version,v 1.6 1996/06/14 20:03:07 cgd Exp $ 1.1: Initial version 1.2: don't forget the Id string! @@ -7,3 +7,6 @@ $NetBSD: version,v 1.5 1996/05/09 23:54:18 cgd Exp $ 1.4-1: Re-import from master sources 1.4-2: Complete rewrite of boot block code 1.5: Update for new ECOFF headers +1.6: Don't pass arguments to the kernel, trim unnecessary environment + calls, kill 'ask' loop (i.e. if boot fails, halt), seperate + ECOFF and a.out support into seperate options. diff --git a/sys/arch/alpha/stand/bootxx.c b/sys/arch/alpha/stand/bootxx.c index 6e6e5315e50..6586fff8011 100644 --- a/sys/arch/alpha/stand/bootxx.c +++ b/sys/arch/alpha/stand/bootxx.c @@ -1,5 +1,5 @@ -/* $OpenBSD: bootxx.c,v 1.4 1996/07/31 10:38:46 niklas Exp $ */ -/* $NetBSD: bootxx.c,v 1.2 1996/04/12 06:09:36 cgd Exp $ */ +/* $OpenBSD: bootxx.c,v 1.5 1996/10/30 22:40:29 niklas Exp $ */ +/* $NetBSD: bootxx.c,v 1.3 1996/06/14 20:04:45 cgd Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. @@ -136,7 +136,7 @@ main() /* Init prom callback vector. */ init_prom_calls(); - puts("\nOpenBSD/Alpha primary boot...\n"); + puts("\nOpenBSD/Alpha Primary Boot\n"); bbinfop = (struct bbinfo *)&_end; loadaddr = (char *)SECONDARY_LOAD_ADDRESS; diff --git a/sys/arch/alpha/stand/bootxx/Makefile b/sys/arch/alpha/stand/bootxx/Makefile index 9bd8a2fc518..f2a724efda2 100644 --- a/sys/arch/alpha/stand/bootxx/Makefile +++ b/sys/arch/alpha/stand/bootxx/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.3 1996/07/29 23:01:50 niklas Exp $ -# $NetBSD: Makefile,v 1.4 1995/11/23 02:40:29 cgd Exp $ +# $OpenBSD: Makefile,v 1.4 1996/10/30 22:40:48 niklas Exp $ +# $NetBSD: Makefile,v 1.6 1996/10/18 06:02:02 thorpej Exp $ .PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa @@ -12,7 +12,7 @@ BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g} HEADERSIZE_PROG = headersize AFLAGS += -DASSEMBLER -CPPFLAGS += -I${.CURDIR}/../.. -DPRIMARY_BOOTBLOCK +CPPFLAGS += -I${.CURDIR}/../.. -I${.CURDIR}/../../../.. -DPRIMARY_BOOTBLOCK CFLAGS = -Werror -mno-fp-regs -g .PATH: ${.CURDIR}/../../../../lib/libkern @@ -20,22 +20,22 @@ CFLAGS = -Werror -mno-fp-regs -g all: ${BOOT_PROG} ${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG} - ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.coff \ + ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.hdr \ ${BOOT_OBJS} - size ${BOOT_PROG}.coff - strip ${BOOT_PROG}.coff - dd if=${BOOT_PROG}.coff of=${BOOT_PROG}.nohdr \ - bs=`./${HEADERSIZE_PROG} < ${BOOT_PROG}.coff` skip=1 + size ${BOOT_PROG}.hdr + strip ${BOOT_PROG}.hdr + dd if=${BOOT_PROG}.hdr of=${BOOT_PROG}.nohdr \ + bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${BOOT_PROG}.hdr` skip=1 dd if=${BOOT_PROG}.nohdr of=${BOOT_PROG} bs=`expr 15 \* 512` conv=sync install: - install -c -o bin -g bin -m 444 ${BOOT_PROG} \ + ${INSTALL} -c -o bin -g bin -m 444 ${BOOT_PROG} \ ${DESTDIR}${BINDIR}/${BOOT_PROG} clean: _SUBDIRUSE rm -f a.out [Ee]rrs mklog core *.core \ ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \ - ${BOOT_PROG}.coff ${BOOT_PROG}.nohdr ${HEADERSIZE_PROG} + ${BOOT_PROG}.hdr ${BOOT_PROG}.nohdr ${HEADERSIZE_PROG} cleandir: _SUBDIRUSE clean diff --git a/sys/arch/alpha/stand/headersize.c b/sys/arch/alpha/stand/headersize.c index 3b2024e4f25..c7e853d5e18 100644 --- a/sys/arch/alpha/stand/headersize.c +++ b/sys/arch/alpha/stand/headersize.c @@ -1,5 +1,5 @@ -/* $OpenBSD: headersize.c,v 1.3 1996/07/29 23:01:20 niklas Exp $ */ -/* $NetBSD: headersize.c,v 1.3.4.1 1996/06/13 18:35:33 cgd Exp $ */ +/* $OpenBSD: headersize.c,v 1.4 1996/10/30 22:40:30 niklas Exp $ */ +/* $NetBSD: headersize.c,v 1.5 1996/09/23 04:32:59 cgd Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,22 +28,58 @@ * 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> #define HDR_BUFSIZE 512 -main() +int +main(argc, argv) + int argc; + char *argv[]; { - char buf[HDR_BUFSIZE]; - struct ecoff_exechdr *execp; + 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", 0); + + 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("%d\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) + err(1, "%s: lseek phdr failed", fname); + if (read(fd, (void *)&phdr, sizeof(phdr)) != sizeof(phdr)) + err(1, "%s: read phdr failed", fname); - if (read(0, &buf, HDR_BUFSIZE) < HDR_BUFSIZE) { - perror("read"); - exit(1); - } - execp = (struct ecoff_exechdr *)buf; + printf("%d\n", phdr.p_offset + (loadaddr - phdr.p_vaddr)); + } else + errx(1, "%s: bad magic number", fname); - printf("%d\n", ECOFF_TXTOFF(execp)); + close(fd); } diff --git a/sys/arch/alpha/stand/installboot.c b/sys/arch/alpha/stand/installboot.c index 38744a982c0..f5f664b0075 100644 --- a/sys/arch/alpha/stand/installboot.c +++ b/sys/arch/alpha/stand/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.3 1996/07/29 23:01:22 niklas Exp $ */ +/* $OpenBSD: installboot.c,v 1.4 1996/10/30 22:40:31 niklas Exp $ */ /* $NetBSD: installboot.c,v 1.2 1995/12/20 00:17:49 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/installboot/Makefile b/sys/arch/alpha/stand/installboot/Makefile index a06945bb820..68fbe7a5412 100644 --- a/sys/arch/alpha/stand/installboot/Makefile +++ b/sys/arch/alpha/stand/installboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 1996/07/29 23:01:53 niklas Exp $ +# $OpenBSD: Makefile,v 1.3 1996/10/30 22:40:49 niklas Exp $ # $NetBSD: Makefile,v 1.1 1995/11/23 02:41:18 cgd Exp $ .PATH: ${.CURDIR}/.. diff --git a/sys/arch/alpha/stand/loadfile.c b/sys/arch/alpha/stand/loadfile.c new file mode 100644 index 00000000000..ffe364ffde1 --- /dev/null +++ b/sys/arch/alpha/stand/loadfile.c @@ -0,0 +1,216 @@ +/* $OpenBSD: loadfile.c,v 1.1 1996/10/30 22:40:33 niklas Exp $ */ +/* $NetBSD: loadfile.c,v 1.3 1996/09/23 04:32:44 cgd Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)boot.c 8.1 (Berkeley) 6/10/93 + */ + +#define ELFSIZE 64 + +#include <lib/libsa/stand.h> +#include <lib/libkern/libkern.h> + +#include <sys/param.h> +#include <sys/exec.h> +#include <sys/exec_ecoff.h> +#include <sys/exec_elf.h> + +#include <machine/prom.h> + +#define _KERNEL +#include "include/pte.h" + +#ifdef ALPHA_BOOT_ECOFF +static int coff_exec __P((int, struct ecoff_exechdr *, u_int64_t *)); +#endif +#ifdef ALPHA_BOOT_ELF +static int elf_exec __P((int, Elf_Ehdr *, u_int64_t *)); +#endif +int loadfile __P((char *, u_int64_t *)); + +vm_offset_t ffp_save, ptbr_save; + +/* + * Open 'filename', read in program and return the entry point or -1 if error. + */ +int +loadfile(fname, entryp) + char *fname; + u_int64_t *entryp; +{ + struct devices *dp; + union { +#ifdef ALPHA_BOOT_ECOFF + struct ecoff_exechdr coff; +#endif +#ifdef ALPHA_BOOT_ELF + Elf_Ehdr elf; +#endif + } hdr; + ssize_t nr; + int fd, rval; + + /* Open the file. */ + rval = 1; + if ((fd = open(fname, 0)) < 0) { + (void)printf("open %s: error %d\n", fname, errno); + goto err; + } + + /* Read the exec header. */ + if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) { + (void)printf("read header: error %d\n", errno); + goto err; + } + +#ifdef ALPHA_BOOT_ECOFF + if (!ECOFF_BADMAG(&hdr.coff)) { + rval = coff_exec(fd, &hdr.coff, entryp); + } else +#endif +#ifdef ALPHA_BOOT_ELF + if (memcmp(Elf_e_ident, hdr.elf.e_ident, Elf_e_siz) == 0) { + rval = elf_exec(fd, &hdr.elf, entryp); + } else +#endif + { + (void)printf("%s: unknown executable format\n", fname); + } + +err: + if (fd >= 0) + (void)close(fd); + return (rval); +} + +#ifdef ALPHA_BOOT_ECOFF +static int +coff_exec(fd, coff, entryp) + int fd; + struct ecoff_exechdr *coff; + u_int64_t *entryp; +{ + + /* Read in text. */ + (void)printf("%lu", coff->a.tsize); + (void)lseek(fd, ECOFF_TXTOFF(coff), 0); + if (read(fd, (void *)coff->a.text_start, coff->a.tsize) != + coff->a.tsize) { + (void)printf("read text: %d\n", errno); + return (1); + } + + /* Read in data. */ + if (coff->a.dsize != 0) { + (void)printf("+%lu", coff->a.dsize); + if (read(fd, (void *)coff->a.data_start, coff->a.dsize) != + coff->a.dsize) { + (void)printf("read data: %d\n", errno); + return (1); + } + } + + + /* Zero out bss. */ + if (coff->a.bsize != 0) { + (void)printf("+%lu", coff->a.bsize); + bzero(coff->a.bss_start, coff->a.bsize); + } + + ffp_save = coff->a.text_start + coff->a.tsize; + if (ffp_save < coff->a.data_start + coff->a.dsize) + ffp_save = coff->a.data_start + coff->a.dsize; + if (ffp_save < coff->a.bss_start + coff->a.bsize) + ffp_save = coff->a.bss_start + coff->a.bsize; + ffp_save = ALPHA_K0SEG_TO_PHYS((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT; + ffp_save += 2; /* XXX OSF/1 does this, no idea why. */ + + (void)printf("\n"); + *entryp = coff->a.entry; + return (0); +} +#endif /* ALPHA_BOOT_ECOFF */ + +#ifdef ALPHA_BOOT_ELF +static int +elf_exec(fd, elf, entryp) + int fd; + Elf_Ehdr *elf; + u_int64_t *entryp; +{ + int i; + int first = 1; + + for (i = 0; i < elf->e_phnum; i++) { + Elf_Phdr phdr; + (void)lseek(fd, elf->e_phoff + sizeof(phdr) * i, 0); + if (read(fd, (void *)&phdr, sizeof(phdr)) != sizeof(phdr)) { + (void)printf("read phdr: %d\n", errno); + return (1); + } + if (phdr.p_type != Elf_pt_load || + (phdr.p_flags & (Elf_pf_w|Elf_pf_x)) == 0) + continue; + + /* Read in segment. */ + (void)printf("%s%lu", first ? "" : "+", phdr.p_filesz); + (void)lseek(fd, phdr.p_offset, 0); + if (read(fd, (void *)phdr.p_vaddr, phdr.p_filesz) != + phdr.p_filesz) { + (void)printf("read text: %d\n", errno); + return (1); + } + if (first || ffp_save < phdr.p_vaddr + phdr.p_memsz) + ffp_save = phdr.p_vaddr + phdr.p_memsz; + + /* Zero out bss. */ + if (phdr.p_filesz < phdr.p_memsz) { + (void)printf("+%lu", phdr.p_memsz - phdr.p_filesz); + bzero(phdr.p_vaddr + phdr.p_filesz, + phdr.p_memsz - phdr.p_filesz); + } + first = 0; + } + + ffp_save = ALPHA_K0SEG_TO_PHYS((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT; + ffp_save += 2; /* XXX OSF/1 does this, no idea why. */ + + (void)printf("\n"); + *entryp = elf->e_entry; + return (0); +} +#endif /* ALPHA_BOOT_ELF */ diff --git a/sys/arch/alpha/stand/netboot/Makefile b/sys/arch/alpha/stand/netboot/Makefile new file mode 100644 index 00000000000..f83b46d45ac --- /dev/null +++ b/sys/arch/alpha/stand/netboot/Makefile @@ -0,0 +1,61 @@ +# $OpenBSD: Makefile,v 1.1 1996/10/30 22:40:51 niklas Exp $ +# $NetBSD: Makefile,v 1.3 1996/10/18 06:02:24 thorpej Exp $ + +.PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa + +BOOT_PROG = netboot +BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS} + +BOOT_SRCS = start.S netboot.c prom.c prom_disp.S OSFpal.c prom_swpal.S +BOOT_SRCS+= printf.c bzero.c rpcc.S + +BOOT_SRCS+= dev_net.c conf.c devopen.c +BOOT_SRCS+= nfs.c rpc.c alloc.c ntohl.c htonl.c ntohs.c htons.c net.c bootp.c +BOOT_SRCS+= strlen.c bcopy.c dev.c bcmp.c strerror.c rarp.c read.c lseek.c +BOOT_SRCS+= in_cksum.c exit.c closeall.c arp.c strncpy.c globals.c open.c +BOOT_SRCS+= close.c ether.c netif.c + +BOOT_SRCS+= if_prom.c loadfile.c getsecs.c + +BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g} + +HEADERSIZE_PROG = headersize + +AFLAGS += -DASSEMBLER +CPPFLAGS += -I${.CURDIR}/../../../../ \ + -I${.CURDIR}/../../../../lib/libsa \ + -I${.CURDIR}/../.. -DPRIMARY_BOOTBLOCK \ + -DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF +CFLAGS = -Werror -mno-fp-regs -g + +CLEANFILES+= vers.c vers.o + +.PATH: ${.CURDIR} ${.CURDIR}/../../../../lib/libkern ${.CURDIR}/../boot + +all: ${BOOT_PROG} + +${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG} + sh ${.CURDIR}/newvers.sh ${.CURDIR}/version + ${COMPILE.c} vers.c + ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.hdr \ + ${BOOT_OBJS} vers.o -lc # XXX + size ${BOOT_PROG}.hdr + strip ${BOOT_PROG}.hdr + dd if=${BOOT_PROG}.hdr of=${BOOT_PROG} \ + bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${BOOT_PROG}.hdr` skip=1 + +install: + ${INSTALL} -c -o bin -g bin -m 444 ${BOOT_PROG} \ + ${DESTDIR}${BINDIR}/${BOOT_PROG} + +clean: _SUBDIRUSE + rm -f a.out [Ee]rrs mklog core *.core \ + ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \ + ${BOOT_PROG}.hdr ${BOOT_PROG}.nohdr ${HEADERSIZE_PROG} + +cleandir: _SUBDIRUSE clean + +.include "${.CURDIR}/../Makefile.inc" +.include <bsd.obj.mk> +.include <bsd.dep.mk> +.include <bsd.subdir.mk> diff --git a/sys/arch/alpha/stand/netboot/conf.c b/sys/arch/alpha/stand/netboot/conf.c new file mode 100644 index 00000000000..b40ffacf7be --- /dev/null +++ b/sys/arch/alpha/stand/netboot/conf.c @@ -0,0 +1,26 @@ +/* $OpenBSD: conf.c,v 1.1 1996/10/30 22:40:52 niklas Exp $ */ +/* $NetBSD: conf.c,v 1.2 1996/10/02 21:18:45 cgd Exp $ */ + +#include <sys/types.h> +#include <netinet/in.h> + +#include "stand.h" +#include "nfs.h" +#include "dev_net.h" + +struct fs_ops file_system[] = { + { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat }, +}; +int nfsys = 1; + +struct devsw devsw[] = { + { "net", net_strategy, net_open, net_close, net_ioctl }, +}; +int ndevs = 1; + +extern struct netif_driver prom_netif_driver; + +struct netif_driver *netif_drivers[] = { + &prom_netif_driver, +}; +int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0])); diff --git a/sys/arch/alpha/stand/netboot/dev_net.c b/sys/arch/alpha/stand/netboot/dev_net.c new file mode 100644 index 00000000000..ddb84da844c --- /dev/null +++ b/sys/arch/alpha/stand/netboot/dev_net.c @@ -0,0 +1,255 @@ +/* $OpenBSD: dev_net.c,v 1.1 1996/10/30 22:40:53 niklas Exp $ */ +/* $NetBSD: dev_net.c,v 1.1 1996/09/18 20:03:07 cgd Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gordon W. Ross + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This module implements a "raw device" interface suitable for + * use by the stand-alone I/O library NFS code. This interface + * does not support any "block" access, and exists only for the + * purpose of initializing the network interface, getting boot + * parameters, and performing the NFS mount. + * + * At open time, this does: + * + * find interface - netif_open() + * RARP for IP address - rarp_getipaddress() + * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...) + * RPC/mountd - nfs_mount(sock, ip, path) + * + * the root file handle from mountd is saved in a global + * for use by the NFS open code (NFS/lookup). + */ + +#include <stdarg.h> +#include <sys/param.h> +#include <sys/socket.h> +#include <net/if.h> +#include <netinet/in.h> +#include <netinet/if_ether.h> +#include <netinet/in_systm.h> + +#include "stand.h" +#include "net.h" +#include "netif.h" +#include "bootparam.h" +#include "dev_net.h" + +extern int debug; +extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ + +/* + * Various globals needed by the network code: + */ + +#if 0 +/* for arp.c, rarp.c */ +u_char bcea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +#endif + +struct in_addr myip; /* my ip address */ +struct in_addr rootip; /* root ip address */ +struct in_addr gateip; /* swap ip address */ +n_long netmask; /* subnet or net mask */ + +char rootpath[FNAME_SIZE]; + +int hostnamelen; +char hostname[FNAME_SIZE]; + +int domainnamelen; +char domainname[FNAME_SIZE]; + +/* + * Local things... + */ +static int netdev_sock = -1; +static int netdev_opens; + +/* + * Called by devopen after it sets f->f_dev to our devsw entry. + * This opens the low-level device and sets f->f_devdata. + * This is declared with variable arguments... + */ +int +net_open(struct open_file *f, ...) +{ + va_list ap; + char *devname; /* Device part of file name (or NULL). */ + int error = 0; + + va_start(ap, f); + devname = va_arg(ap, char*); + va_end(ap); + +#ifdef NETIF_DEBUG + if (debug) + printf("net_open: %s\n", devname); +#endif + + /* On first open, do netif open, mount, etc. */ + if (netdev_opens == 0) { + /* Find network interface. */ + if (netdev_sock < 0) { + netdev_sock = netif_open(devname); + if (netdev_sock < 0) { + printf("net_open: netif_open() failed\n"); + return (ENXIO); + } + if (debug) + printf("net_open: netif_open() succeeded\n"); + } + if (rootip.s_addr == 0) { + /* Get root IP address, and path, etc. */ + error = net_getparams(netdev_sock); + if (error) { + /* getparams makes its own noise */ + goto fail; + } + /* Get the NFS file handle (mountd). */ + error = nfs_mount(netdev_sock, rootip, rootpath); + if (error) { + printf("net_open: NFS mount error=%d\n", error); + rootip.s_addr = 0; + fail: + netif_close(netdev_sock); + netdev_sock = -1; + return (error); + } + if (debug) + printf("net_open: NFS mount succeeded\n"); + } + } + netdev_opens++; + f->f_devdata = nfs_root_node; + return (error); +} + +int +net_close(f) + struct open_file *f; +{ + +#ifdef NETIF_DEBUG + if (debug) + printf("net_close: opens=%d\n", netdev_opens); +#endif + + /* On last close, do netif close, etc. */ + f->f_devdata = NULL; + /* Extra close call? */ + if (netdev_opens <= 0) + return (0); + netdev_opens--; + /* Not last close? */ + if (netdev_opens > 0) + return(0); + rootip.s_addr = 0; + if (netdev_sock >= 0) { + if (debug) + printf("net_close: calling netif_close()\n"); + netif_close(netdev_sock); + netdev_sock = -1; + } + return (0); +} + +int +net_ioctl() +{ + return EIO; +} + +int +net_strategy() +{ + return EIO; +} + +int +net_getparams(sock) + int sock; +{ + /* + * Get info for NFS boot: our IP address, our hostname, + * server IP address, and our root path on the server. + * There are two ways to do this: The old, Sun way, + * and the more modern, BOOTP way. (RFC951, RFC1048) + */ + +#ifdef SUN_BOOTPARAMS + /* Get our IP address. (rarp.c) */ + if (rarp_getipaddress(sock)) { + printf("net_open: RARP failed\n"); + return (EIO); + } +#else /* BOOTPARAMS */ + /* + * Get boot info using BOOTP. (RFC951, RFC1048) + * This also gets the server IP address, gateway, + * root path, etc. + */ + bootp(sock); + if (myip.s_addr == 0) { + printf("net_open: BOOTP failed\n"); + return (EIO); + } +#endif /* BOOTPARAMS */ + + printf("boot: client addr: %s\n", inet_ntoa(myip)); + +#ifdef SUN_BOOTPARAMS + /* Get our hostname, server IP address, gateway. */ + if (bp_whoami(sock)) { + printf("net_open: bootparam/whoami RPC failed\n"); + return (EIO); + } +#endif /* BOOTPARAMS */ + + printf("boot: client name: %s\n", hostname); + if (gateip.s_addr) { + printf("boot: subnet mask: %s\n", intoa(netmask)); + printf("boot: net gateway: %s\n", inet_ntoa(gateip)); + } + +#ifdef SUN_BOOTPARAMS + /* Get the root pathname. */ + if (bp_getfile(sock, "root", &rootip, rootpath)) { + printf("net_open: bootparam/getfile RPC failed\n"); + return (EIO); + } +#endif /* BOOTPARAMS */ + + printf("boot: server addr: %s\n", inet_ntoa(rootip)); + printf("boot: server path: %s\n", rootpath); + + return (0); +} diff --git a/sys/arch/alpha/stand/netboot/dev_net.h b/sys/arch/alpha/stand/netboot/dev_net.h new file mode 100644 index 00000000000..3e3d4b091d6 --- /dev/null +++ b/sys/arch/alpha/stand/netboot/dev_net.h @@ -0,0 +1,8 @@ +/* $OpenBSD: dev_net.h,v 1.1 1996/10/30 22:40:53 niklas Exp $ */ + + +int net_open __P((struct open_file *, ...)); +int net_close __P((struct open_file *)); +int net_ioctl(); +int net_strategy(); + diff --git a/sys/arch/alpha/stand/netboot/devopen.c b/sys/arch/alpha/stand/netboot/devopen.c new file mode 100644 index 00000000000..601960fcef4 --- /dev/null +++ b/sys/arch/alpha/stand/netboot/devopen.c @@ -0,0 +1,162 @@ +/* $OpenBSD: devopen.c,v 1.1 1996/10/30 22:40:54 niklas Exp $ */ +/* $NetBSD: devopen.c,v 1.1 1996/09/18 20:03:09 cgd Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)devopen.c 8.1 (Berkeley) 6/10/93 + */ + +#include <stand.h> + +/* + * Decode the string 'fname', open the device and return the remaining + * file name if any. + */ +devopen(f, fname, file) + struct open_file *f; + const char *fname; + char **file; /* out */ +{ + register char *cp; + register char *ncp; + register struct devsw *dp; + register int c, i; + int ctlr = 0, unit = 0, part = 0; + char namebuf[20]; + int rc; + + cp = (char *)fname; + ncp = namebuf; + +#if 0 + /* look for a string like '5/rz0/vmunix' or '5/rz3f/vmunix */ + if ((c = *cp) >= '0' && c <= '9') { + ctlr = c - '0'; + /* skip the '/' */ + if (*++cp != '/') + return (ENXIO); + cp++; + while ((c = *cp) != '\0') { + if (c == '/') + break; + if (c >= '0' && c <= '9') { + /* read unit number */ + unit = c - '0'; + + /* look for a partition */ + if ((c = *++cp) >= 'a' && c <= 'h') { + part = c - 'a'; + c = *++cp; + } + if (c != '/') + return (ENXIO); + break; + } + if (ncp < namebuf + sizeof(namebuf) - 1) + *ncp++ = c; + cp++; + } + *ncp = '\0'; + /* + * XXX + * pulling strchr from the C library, should pull from libkern. + */ + } else if (strchr(cp, '(')) { + /* expect a string like 'rz(0,0,0)vmunix' */ + while ((c = *cp) != '\0') { + if (c == '(') { + cp++; + break; + } + if (ncp < namebuf + sizeof(namebuf) - 1) + *ncp++ = c; + cp++; + } + + /* get controller number */ + if ((c = *cp) >= '0' && c <= '9') { + ctlr = c - '0'; + c = *++cp; + } + + if (c == ',') { + /* get SCSI device number */ + if ((c = *++cp) >= '0' && c <= '9') { + unit = c - '0'; + c = *++cp; + } + + if (c == ',') { + /* get partition number */ + if ((c = *++cp) >= '0' && c <= '9') { + part = c - '0'; + c = *++cp; + } + } + } + if (c != ')') + return (ENXIO); + cp++; + *ncp = '\0'; + } else { +#endif + dp = devsw; + ctlr = unit = part = 0; + goto fnd; +#if 0 + } + + for (dp = devsw, i = 0; i < ndevs; dp++, i++) + if (dp->dv_name && strcmp(namebuf, dp->dv_name) == 0) + goto fnd; + printf("Unknown device '%s'\nKnown devices are:", namebuf); + for (dp = devsw, i = 0; i < ndevs; dp++, i++) + if (dp->dv_name) + printf(" %s", dp->dv_name); + printf("\n"); + return (ENXIO); +#endif + +fnd: + rc = (dp->dv_open)(f, ctlr, unit, part); + if (rc) + return (rc); + + f->f_dev = dp; + if (file && *cp != '\0') + *file = cp; + return (0); +} diff --git a/sys/arch/alpha/stand/netboot/getsecs.c b/sys/arch/alpha/stand/netboot/getsecs.c new file mode 100644 index 00000000000..07ca9e539d1 --- /dev/null +++ b/sys/arch/alpha/stand/netboot/getsecs.c @@ -0,0 +1,34 @@ +/* $OpenBSD: getsecs.c,v 1.1 1996/10/30 22:40:55 niklas Exp $ */ + +#include <sys/param.h> +#include "include/prom.h" +#include "include/rpb.h" + +int +getsecs() +{ + static long tnsec; + static long lastpcc, wrapsecs; + long curpcc, pccdiff; + + if (tnsec == 0) { + tnsec = 1; + lastpcc = alpha_rpcc() & 0xffffffff; + wrapsecs = (0xffffffff / + ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq) + 1; + +#if 0 + printf("getsecs: cc freq = %d, time to wrap = %d\n", + ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq, wrapsecs); +#endif + } + + curpcc = alpha_rpcc() & 0xffffffff; + if (curpcc < lastpcc) + curpcc += 0x100000000; + + tnsec += ((curpcc - lastpcc) * 1000000000) / ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq; + lastpcc = curpcc; + + return (tnsec / 1000000000); +} diff --git a/sys/arch/alpha/stand/netboot/if_prom.c b/sys/arch/alpha/stand/netboot/if_prom.c new file mode 100644 index 00000000000..97664bb66ff --- /dev/null +++ b/sys/arch/alpha/stand/netboot/if_prom.c @@ -0,0 +1,201 @@ +/* $OpenBSD: if_prom.c,v 1.1 1996/10/30 22:40:56 niklas Exp $ */ +/* $NetBSD: if_prom.c,v 1.4 1996/10/02 21:18:49 cgd Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/types.h> + +#include <netinet/in.h> +#include <netinet/in_systm.h> + +#include "netif.h" +#include "include/prom.h" +#include "lib/libkern/libkern.h" + +int prom_probe(); +int prom_match(); +void prom_init(); +int prom_get(); +int prom_put(); +void prom_end(); + +extern struct netif_stats prom_stats[]; + +struct netif_dif prom_ifs[] = { +/* dif_unit dif_nsel dif_stats dif_private */ +{ 0, 1, &prom_stats[0], 0, }, +}; + +struct netif_stats prom_stats[NENTS(prom_ifs)]; + +struct netif_driver prom_netif_driver = { + "prom", /* netif_bname */ + prom_match, /* netif_match */ + prom_probe, /* netif_probe */ + prom_init, /* netif_init */ + prom_get, /* netif_get */ + prom_put, /* netif_put */ + prom_end, /* netif_end */ + prom_ifs, /* netif_ifs */ + NENTS(prom_ifs) /* netif_nifs */ +}; + +int netfd; + +int +prom_match(nif, machdep_hint) + struct netif *nif; + void *machdep_hint; +{ + + return (1); +} + +int +prom_probe(nif, machdep_hint) + struct netif *nif; + void *machdep_hint; +{ + + return 0; +} + +int +prom_put(desc, pkt, len) + struct iodesc *desc; + void *pkt; + int len; +{ + + prom_write(netfd, len, pkt, 0); + + return len; +} + + +int +prom_get(desc, pkt, len, timeout) + struct iodesc *desc; + void *pkt; + int len; + time_t timeout; +{ + prom_return_t ret; + time_t t; + int cc; + char hate[2000]; + + t = getsecs(); + cc = 0; + while (((getsecs() - t) < timeout) && !cc) { + ret.bits = prom_read(netfd, sizeof hate, hate, 0); + if (ret.u.status == 0) + cc += ret.u.retval; + } + cc = len; + bcopy(hate, pkt, cc); + + return cc; +} + +extern char *strchr(); + +void +prom_init(desc, machdep_hint) + struct iodesc *desc; + void *machdep_hint; +{ + prom_return_t ret; + char devname[64]; + int devlen, i; + char *enet_addr; + + ret.bits = prom_getenv(PROM_E_BOOTED_DEV, devname, sizeof(devname)); + devlen = ret.u.retval; + + /* Ethernet address is the 9th component of the booted_dev string. */ + enet_addr = devname; + for (i = 0; i < 8; i++) { + enet_addr = strchr(enet_addr, ' '); + if (enet_addr == NULL) { + printf("Boot device name does not contain ethernet address.\n"); + goto punt; + } + enet_addr++; + } + if (enet_addr != NULL) { + int hv, lv; + +#define dval(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : \ + (((c) >= 'A' && (c) <= 'F') ? (10 + (c) - 'A') : \ + (((c) >= 'a' && (c) <= 'f') ? (10 + (c) - 'a') : -1))) + + for (i = 0; i < 6; i++) { + hv = dval(*enet_addr); enet_addr++; + lv = dval(*enet_addr); enet_addr++; + enet_addr++; + + if (hv == -1 || lv == -1) { + printf("Bogus ethernet address.\n"); + goto punt; + } + + desc->myea[i] = (hv << 4) | lv; + } +#undef dval + } + + printf("boot: ethernet address: %s\n", ether_sprintf(desc->myea)); + + ret.bits = prom_open(devname, devlen + 1); + if (ret.u.status) { + printf("prom_init: open failed: %d\n", ret.u.status); + goto punt; + } + netfd = ret.u.retval; + return; + +punt: + printf("Boot device name was: \"%s\"\n", devname); + printf("\n"); + printf("Your firmware may be too old to network-boot OpenBSD/Alpha.\n"); + halt(); +} + +void +prom_end(nif) + struct netif *nif; +{ + + prom_close(netfd); +} diff --git a/sys/arch/alpha/stand/netboot/netboot.c b/sys/arch/alpha/stand/netboot/netboot.c new file mode 100644 index 00000000000..ce23e0918b1 --- /dev/null +++ b/sys/arch/alpha/stand/netboot/netboot.c @@ -0,0 +1,99 @@ +/* $OpenBSD: netboot.c,v 1.1 1996/10/30 22:40:57 niklas Exp $ */ +/* $NetBSD: netboot.c,v 1.1 1996/09/18 20:03:12 cgd Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)boot.c 8.1 (Berkeley) 6/10/93 + */ + +#include <lib/libsa/stand.h> +#include <lib/libkern/libkern.h> + +#include <sys/param.h> +#include <sys/exec.h> +#include <sys/exec_ecoff.h> + +#include <machine/prom.h> + +#define _KERNEL +#include "include/pte.h" + +int loadfile __P((char *, u_int64_t *)); + +char boot_file[128]; +char boot_flags[128]; + +extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; + +vm_offset_t ffp_save, ptbr_save; + +int debug; + +void +main() +{ + u_int64_t entry; + + /* Init prom callback vector. */ + init_prom_calls(); + + /* print a banner */ + printf("\n"); + printf("%s, Revision %s\n", bootprog_name, bootprog_rev); + printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n"); + + /* switch to OSF pal code. */ + OSFpal(); + + printf("\n"); + + prom_getenv(PROM_E_BOOTED_FILE, boot_file, sizeof(boot_file)); + prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags)); + + if (boot_file[0] == '\0') + bcopy("bsd", boot_file, sizeof "bsd"); + + (void)printf("Boot: %s %s\n", boot_file, boot_flags); + + if (!loadfile(boot_file, &entry)) { + (void)printf("Entering kernel at 0x%lx...\n", entry); + (*(void (*)())entry)(ffp_save, ptbr_save, 0); + } + + (void)printf("Boot failed! Halting...\n"); + halt(); +} diff --git a/sys/arch/alpha/stand/netboot/newvers.sh b/sys/arch/alpha/stand/netboot/newvers.sh new file mode 100644 index 00000000000..9699e4f9ee7 --- /dev/null +++ b/sys/arch/alpha/stand/netboot/newvers.sh @@ -0,0 +1,45 @@ +#!/bin/sh - +# +# $OpenBSD: newvers.sh,v 1.1 1996/10/30 22:40:58 niklas Exp $ +# $NetBSD: newvers.sh,v 1.1 1996/09/18 20:03:13 cgd Exp $ +# +# Copyright (c) 1984, 1986, 1990, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)newvers.sh 8.1 (Berkeley) 4/20/94 + +u=${USER-root} h=`hostname` t=`date` +r=`head -1 $1 | awk ' { print $3 } '` + +echo "char bootprog_name[] = \"OpenBSD/Alpha Network Boot\";" > vers.c +echo "char bootprog_rev[] = \"${r}\";" >> vers.c +echo "char bootprog_date[] = \"${t}\";" >> vers.c +echo "char bootprog_maker[] = \"${u}@${h}\";" >> vers.c diff --git a/sys/arch/alpha/stand/netboot/rpcc.S b/sys/arch/alpha/stand/netboot/rpcc.S new file mode 100644 index 00000000000..598534d50bd --- /dev/null +++ b/sys/arch/alpha/stand/netboot/rpcc.S @@ -0,0 +1,10 @@ +/* $OpenBSD: rpcc.S,v 1.1 1996/10/30 22:40:59 niklas Exp $ */ +/* $NetBSD: rpcc.S,v 1.2 1996/10/02 21:18:50 cgd Exp $ */ + +#include <machine/asm.h> + + .text +LEAF(alpha_rpcc,1) + rpcc v0 + RET + END(alpha_rpcc) diff --git a/sys/arch/alpha/stand/netboot/version b/sys/arch/alpha/stand/netboot/version new file mode 100644 index 00000000000..16253a53f4d --- /dev/null +++ b/sys/arch/alpha/stand/netboot/version @@ -0,0 +1,5 @@ +$OpenBSD: version,v 1.1 1996/10/30 22:41:00 niklas Exp $ +$NetBSD: version,v 1.2 1996/10/02 21:26:17 cgd Exp $ + +1.1 Initial version +1.2 Cleaned and polished a bit diff --git a/sys/arch/alpha/stand/prom.c b/sys/arch/alpha/stand/prom.c index 79cee77d833..b8e524ee874 100644 --- a/sys/arch/alpha/stand/prom.c +++ b/sys/arch/alpha/stand/prom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.c,v 1.2 1996/07/29 23:01:24 niklas Exp $ */ +/* $OpenBSD: prom.c,v 1.3 1996/10/30 22:40:33 niklas Exp $ */ /* $NetBSD: prom.c,v 1.1 1995/11/23 02:39:07 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/prom_disp.S b/sys/arch/alpha/stand/prom_disp.S index c6346865366..8b56160dc19 100644 --- a/sys/arch/alpha/stand/prom_disp.S +++ b/sys/arch/alpha/stand/prom_disp.S @@ -1,5 +1,5 @@ -/* $OpenBSD: prom_disp.S,v 1.3 1996/07/29 23:01:25 niklas Exp $ */ -/* $NetBSD: prom_disp.S,v 1.3 1996/04/12 06:09:38 cgd Exp $ */ +/* $OpenBSD: prom_disp.S,v 1.4 1996/10/30 22:40:34 niklas Exp $ */ +/* $NetBSD: prom_disp.S,v 1.5 1996/10/17 02:50:39 cgd Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -35,7 +35,7 @@ #endif .globl prom_dispatch_v - .comm prom_dispatch_v 16 + .comm prom_dispatch_v,16 .text .align 4 @@ -56,7 +56,7 @@ #define DISPATCH_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5|IM_S6 NESTED(prom_dispatch, 5, DISPATCH_FRAME_SIZE, ra, DISPATCH_REGS, 0) - SETGP(pv) + LDGP(pv) lda sp, -DISPATCH_FRAME_SIZE(sp) stq ra, D_RA(sp) diff --git a/sys/arch/alpha/stand/puts.c b/sys/arch/alpha/stand/puts.c index 47ee3340751..06c0b066e38 100644 --- a/sys/arch/alpha/stand/puts.c +++ b/sys/arch/alpha/stand/puts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puts.c,v 1.2 1996/07/29 23:01:27 niklas Exp $ */ +/* $OpenBSD: puts.c,v 1.3 1996/10/30 22:40:35 niklas Exp $ */ void diff --git a/sys/arch/alpha/stand/start.S b/sys/arch/alpha/stand/start.S index 6990832353b..a3eb03974e4 100644 --- a/sys/arch/alpha/stand/start.S +++ b/sys/arch/alpha/stand/start.S @@ -1,5 +1,5 @@ -/* $OpenBSD: start.S,v 1.2 1996/07/29 23:01:28 niklas Exp $ */ -/* $NetBSD: start.S,v 1.1 1995/11/23 02:39:15 cgd Exp $ */ +/* $OpenBSD: start.S,v 1.3 1996/10/30 22:40:36 niklas Exp $ */ +/* $NetBSD: start.S,v 1.4 1996/10/17 02:50:40 cgd Exp $ */ /* * Mach Operating System @@ -45,21 +45,27 @@ #define ENTRY_FRAME 32 NESTED(start, 1, ENTRY_FRAME, ra, 0, 0) - br pv,1f -1: SETGP(pv) + br pv,Lstartgp +Lstartgp: + LDGP(pv) #ifndef PRIMARY_BOOTBLOCK lda sp,start /* start stack below text */ lda sp,-ENTRY_FRAME(sp) #endif +#ifdef ECOFF_COMPAT lda a0,_EDATA +#else + lda a0,_edata +#endif lda a1,_end subq a1,a0,a1 CALL(bzero) CALL(main) /* transfer to C */ +XLEAF(_rtt, 0) XLEAF(halt, 0) call_pal PAL_halt /* halt if we ever return */ END(start) |