summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Murphree <smurph@cvs.openbsd.org>1998-08-22 09:16:48 +0000
committerSteve Murphree <smurph@cvs.openbsd.org>1998-08-22 09:16:48 +0000
commit2322741e58a481c8a6be6953f99ee13129bb0d2f (patch)
tree00a55f14a55b5419b1ac397b285899e36823b7e8
parentd377787f21e067a057e0f09aecf2663a56c873ae (diff)
fixed bugargs and lots of stuff regaurding netboot.
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile16
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile.inc4
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/bugcrt.c86
3 files changed, 97 insertions, 9 deletions
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile b/sys/arch/mvme88k/stand/bugcrt/Makefile
index 19d6add99b3..3bb46db9c62 100644
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile
+++ b/sys/arch/mvme88k/stand/bugcrt/Makefile
@@ -1,10 +1,10 @@
-# $Id: Makefile,v 1.3 1997/03/03 20:22:14 rahnds Exp $
-
-CFLAGS+=-I${.CURDIR}/../../include
-
-.include "${MACHINE_ARCH}/Makefile.inc"
-
-.PATH: ${.CURDIR}/${MACHINE_ARCH}
+# $OpenBSD: Makefile,v 1.4 1998/08/22 09:16:45 smurph Exp $
+#
+# DO NOT OPTMIZE bugcrt (i.e. no "-O2")
+#
+S=${.CURDIR}/../../../..
+CFLAGS=-I${.CURDIR}/../../include -I${.CURDIR}/../libbug -I${S}/lib/libsa \
+ -fomit-frame-pointer
OBJS=bugcrt.o
@@ -13,7 +13,7 @@ CLEANFILES+=a.out
all: ${OBJS}
bugcrt.o: bugcrt.c
- ${CC} ${CFLAGS} -c ${.ALLSRC}
+ ${COMPILE.c} -c $<
${LD} -x -r ${.TARGET}
mv a.out ${.TARGET}
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
index f2bae6c888c..13a2b3fdadf 100644
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
+++ b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
@@ -1,4 +1,6 @@
-BUG_CRT_DIR=${S}/arch/${MACHINE}/stand/bugcrt
+# $OpenBSD: Makefile.inc,v 1.2 1998/08/22 09:16:46 smurph Exp $
+
+BUG_CRT_DIR=${S}/arch/mvme88k/stand/bugcrt
BUGCRT_DIR!= cd ${BUG_CRT_DIR}; \
printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
diff --git a/sys/arch/mvme88k/stand/bugcrt/bugcrt.c b/sys/arch/mvme88k/stand/bugcrt/bugcrt.c
new file mode 100644
index 00000000000..24ab2812579
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugcrt/bugcrt.c
@@ -0,0 +1,86 @@
+/* $OpenBSD: bugcrt.c,v 1.3 1998/08/22 09:16:47 smurph Exp $ */
+#include <sys/types.h>
+#include <machine/prom.h>
+
+struct mvmeprom_args bugargs = { 1 }; /* not BSS */
+
+ asm (".text");
+ asm (".long 0x003ffff8");
+ asm (".long _start");
+start()
+{
+ register int dev_lun asm (MVMEPROM_REG_DEVLUN);
+ register int ctrl_lun asm (MVMEPROM_REG_CTRLLUN);
+ register int flags asm (MVMEPROM_REG_FLAGS);
+ register int ctrl_addr asm (MVMEPROM_REG_CTRLADDR);
+ register int entry asm (MVMEPROM_REG_ENTRY);
+ register int conf_blk asm (MVMEPROM_REG_CONFBLK);
+ register char *arg_start asm (MVMEPROM_REG_ARGSTART);
+ register char *arg_end asm (MVMEPROM_REG_ARGEND);
+ register char *nbarg_start asm (MVMEPROM_REG_NBARGSTART);
+ register char *nbarg_end asm (MVMEPROM_REG_NBARGEND);
+ extern int edata, end;
+ struct mvmeprom_brdid *id, *mvmeprom_brdid();
+
+ /* Do not use r10 to enable the SFU1. This wipes out
+ the netboot args. Not cool at all... r25 seems free. */
+asm ("# enable SFU1");
+asm (" ldcr r25,cr1");
+asm (" xor r25,r25,0x8");
+asm (" stcr r25,cr1");
+
+ bugargs.dev_lun = dev_lun;
+ bugargs.ctrl_lun = ctrl_lun;
+ bugargs.flags = flags;
+ bugargs.ctrl_addr = ctrl_addr;
+ bugargs.entry = entry;
+ bugargs.conf_blk = conf_blk;
+ bugargs.arg_start = arg_start;
+ bugargs.arg_end = arg_end;
+ bugargs.nbarg_start = nbarg_start;
+ bugargs.nbarg_end = nbarg_end;
+ *bugargs.arg_end = 0;
+
+ bzero(&edata, (&end - &edata));
+ id = mvmeprom_brdid();
+ bugargs.cputyp = id->model;
+
+ main();
+ mvmeprom_return();
+ /* NOTREACHED */
+}
+
+__main()
+{
+}
+
+void
+bugexec(addr)
+
+void (*addr)();
+
+{
+ register int dev_lun asm (MVMEPROM_REG_DEVLUN);
+ register int ctrl_lun asm (MVMEPROM_REG_CTRLLUN);
+ register int flags asm (MVMEPROM_REG_FLAGS);
+ register int ctrl_addr asm (MVMEPROM_REG_CTRLADDR);
+ register int entry asm (MVMEPROM_REG_ENTRY);
+ register int conf_blk asm (MVMEPROM_REG_CONFBLK);
+ register char *arg_start asm (MVMEPROM_REG_ARGSTART);
+ register char *arg_end asm (MVMEPROM_REG_ARGEND);
+
+ dev_lun = bugargs.dev_lun;
+ ctrl_lun = bugargs.ctrl_lun;
+ flags = bugargs.flags;
+ ctrl_addr = bugargs.ctrl_addr;
+ entry = bugargs.entry;
+ conf_blk = bugargs.conf_blk;
+ arg_start = bugargs.arg_start;
+ arg_end = bugargs.arg_end;
+
+ (*addr)();
+ printf("bugexec: 0x%x returned!\n", addr);
+
+ _rtt();
+}
+