summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-04-02 21:53:19 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-04-02 21:53:19 +0000
commitc5454a8e39cd55f680302bc7232f4aa9639caf51 (patch)
tree721762b0277d0876059531f99f1b9450262b825c /sys/arch/mvme88k
parentdd270d419b8bc1609691c7e2ceb6cd8a47bbc85d (diff)
Rewrite the startup code for the mvme88k bootblocks, once again. Some of
them (especially the netboot ones) will now self-relocate, which makes BUG configuration much simpler. WARNING: for disk-based systems, you need to update bootxx and bootsd at the same time. New bootsd will not run when loaded from an older bootxx. This doesn't matter much since you need both with installboot.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/stand/bootsd/Makefile6
-rw-r--r--sys/arch/mvme88k/stand/bootsd/version.c5
-rw-r--r--sys/arch/mvme88k/stand/bootst/Makefile6
-rw-r--r--sys/arch/mvme88k/stand/bootst/version.c5
-rw-r--r--sys/arch/mvme88k/stand/bootxx/Makefile6
-rw-r--r--sys/arch/mvme88k/stand/bootxx/bootxx.c15
-rw-r--r--sys/arch/mvme88k/stand/bootxx/version.c6
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile26
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile.inc18
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/crt.c78
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/crt0.S198
-rw-r--r--sys/arch/mvme88k/stand/libbug/libbug.h6
-rw-r--r--sys/arch/mvme88k/stand/libsa/Makefile4
-rw-r--r--sys/arch/mvme88k/stand/netboot/Makefile7
-rw-r--r--sys/arch/mvme88k/stand/netboot/boot.c7
-rw-r--r--sys/arch/mvme88k/stand/netboot/version.c5
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/Makefile8
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/boot.c7
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/version.c5
19 files changed, 271 insertions, 147 deletions
diff --git a/sys/arch/mvme88k/stand/bootsd/Makefile b/sys/arch/mvme88k/stand/bootsd/Makefile
index 6a698de726a..665a880f398 100644
--- a/sys/arch/mvme88k/stand/bootsd/Makefile
+++ b/sys/arch/mvme88k/stand/bootsd/Makefile
@@ -1,5 +1,5 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.13 2006/05/16 22:52:24 miod Exp $
+# $OpenBSD: Makefile,v 1.14 2008/04/02 21:53:17 miod Exp $
S= ${.CURDIR}/../../../..
DEFS=
@@ -25,9 +25,9 @@ ALL= ${BOOTS}
all: ${ALL}
-bootsd: ${OBJS} ${STAGE2} ${LIBS}
+bootsd: ${OBJS} ${STAGE2_CRT} ${LIBS}
${LD} ${LDFLAGS} -o $@ \
- ${STAGE2} ${OBJS} ${LIBS} `cc -print-libgcc-file-name`
+ ${STAGE2_CRT} ${OBJS} ${LIBS} `cc -print-libgcc-file-name`
install:
install ${INSTALL_STRIP} -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
diff --git a/sys/arch/mvme88k/stand/bootsd/version.c b/sys/arch/mvme88k/stand/bootsd/version.c
index 96a409cad51..0fc14743d10 100644
--- a/sys/arch/mvme88k/stand/bootsd/version.c
+++ b/sys/arch/mvme88k/stand/bootsd/version.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: version.c,v 1.4 2008/03/31 22:14:43 miod Exp $ */
+/* $OpenBSD: version.c,v 1.5 2008/04/02 21:53:17 miod Exp $ */
/*
+ * 1.5 rewritten crt code, self-relocatable
* 1.4 kernel loaded with loadfile, a.out and ELF formats
* 1.3 rewritten startup code and general cleanup
*/
-char *version = "1.4";
+char *version = "1.5";
diff --git a/sys/arch/mvme88k/stand/bootst/Makefile b/sys/arch/mvme88k/stand/bootst/Makefile
index bc167bb87b7..d7463654b2a 100644
--- a/sys/arch/mvme88k/stand/bootst/Makefile
+++ b/sys/arch/mvme88k/stand/bootst/Makefile
@@ -1,5 +1,5 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.12 2006/05/16 22:52:26 miod Exp $
+# $OpenBSD: Makefile,v 1.13 2008/04/02 21:53:17 miod Exp $
SIZE?= size
@@ -28,8 +28,8 @@ ALL= ${BOOTS}
all: ${ALL}
-bootst.bug: ${OBJS} ${SINGLE} ${LIBS}
- ${LD} ${LDFLAGS} ${SINGLE} -o $@ \
+bootst.bug: ${OBJS} ${STAGE1_CRT} ${LIBS}
+ ${LD} ${LDFLAGS} ${STAGE1_CRT} -o $@ \
${OBJS} ${LIBS} `cc -print-libgcc-file-name`
@${SIZE} bootst.bug
diff --git a/sys/arch/mvme88k/stand/bootst/version.c b/sys/arch/mvme88k/stand/bootst/version.c
index 96a409cad51..6d117df67e7 100644
--- a/sys/arch/mvme88k/stand/bootst/version.c
+++ b/sys/arch/mvme88k/stand/bootst/version.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: version.c,v 1.4 2008/03/31 22:14:43 miod Exp $ */
+/* $OpenBSD: version.c,v 1.5 2008/04/02 21:53:17 miod Exp $ */
/*
+ * 1.5 rewritten crt code
* 1.4 kernel loaded with loadfile, a.out and ELF formats
* 1.3 rewritten startup code and general cleanup
*/
-char *version = "1.4";
+char *version = "1.5";
diff --git a/sys/arch/mvme88k/stand/bootxx/Makefile b/sys/arch/mvme88k/stand/bootxx/Makefile
index ffad25ccd1d..b6b4f3e2be9 100644
--- a/sys/arch/mvme88k/stand/bootxx/Makefile
+++ b/sys/arch/mvme88k/stand/bootxx/Makefile
@@ -1,5 +1,5 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.11 2006/05/16 22:51:30 miod Exp $
+# $OpenBSD: Makefile,v 1.12 2008/04/02 21:53:17 miod Exp $
S= ${.CURDIR}/../../../..
DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC}
@@ -24,8 +24,8 @@ ALL= ${BOOTS}
all: ${ALL}
-bootxx: ${OBJS} ${STAGE1} ${LIBS}
- ${LD} -S -N -T ${STAGE1_RELOC} ${STAGE1} -o $@ \
+bootxx: ${OBJS} ${STAGE1_CRT} ${LIBS}
+ ${LD} -S -N -T ${STAGE1_RELOC} ${STAGE1_CRT} -o $@ \
${OBJS} ${LIBS} `cc -print-libgcc-file-name`
install:
diff --git a/sys/arch/mvme88k/stand/bootxx/bootxx.c b/sys/arch/mvme88k/stand/bootxx/bootxx.c
index 8d02e700a1f..1006efa0731 100644
--- a/sys/arch/mvme88k/stand/bootxx/bootxx.c
+++ b/sys/arch/mvme88k/stand/bootxx/bootxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootxx.c,v 1.6 2006/05/16 22:52:09 miod Exp $ */
+/* $OpenBSD: bootxx.c,v 1.7 2008/04/02 21:53:17 miod Exp $ */
/*
* Copyright (c) 1994 Paul Kranenburg
@@ -67,6 +67,7 @@ daddr_t block_table[MAXBLOCKNUM] = { 0 };
extern char *version;
+void bugexec(void (*)());
int copyboot(struct open_file *, char *);
int
@@ -141,3 +142,15 @@ copyboot(struct open_file *fp, char *addr)
return 0;
}
+
+void
+bugexec(void (*addr)())
+{
+ (*addr)(bugargs.dev_lun, bugargs.ctrl_lun, bugargs.flags,
+ bugargs.ctrl_addr, (u_int)addr, bugargs.conf_blk,
+ bugargs.arg_start, bugargs.arg_end);
+
+ printf("bugexec: %p returned!\n", addr);
+
+ _rtt();
+}
diff --git a/sys/arch/mvme88k/stand/bootxx/version.c b/sys/arch/mvme88k/stand/bootxx/version.c
index a88e18984ae..242d1e86a58 100644
--- a/sys/arch/mvme88k/stand/bootxx/version.c
+++ b/sys/arch/mvme88k/stand/bootxx/version.c
@@ -1,3 +1,7 @@
-/* $OpenBSD: version.c,v 1.2 2006/05/16 22:52:55 miod Exp $ */
+/* $OpenBSD: version.c,v 1.3 2008/04/02 21:53:17 miod Exp $ */
+/*
+ * 1.3 rewritten crt code, self-relocatable
+ * 1.2 rewritten startup code and general cleanup
+ */
char *version = "1.2";
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile b/sys/arch/mvme88k/stand/bugcrt/Makefile
index 37cd7edf486..65216c4afa1 100644
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile
+++ b/sys/arch/mvme88k/stand/bugcrt/Makefile
@@ -1,30 +1,30 @@
-# $OpenBSD: Makefile,v 1.11 2007/10/30 06:03:16 deraadt Exp $
+# $OpenBSD: Makefile,v 1.12 2008/04/02 21:53:17 miod Exp $
S=${.CURDIR}/../../../..
CFLAGS+=-I${.CURDIR}/../../include -I${.CURDIR}/../libbug -I${S}/lib/libsa
-STAGE1_CFLAGS=-DSTACK_ASM_OP="\".long ${STAGE1_RELOC}\"" -DSTAGE1
-STAGE2_CFLAGS=-DSTACK_ASM_OP="\".long ${STAGE2_RELOC}\""
-SINGLE_CFLAGS=-DSTACK_ASM_OP="\".long ${STAGE2_RELOC}\"" -DSTAGE1
-SRCS=crt.c
-OBJS=stage1crt.o stage2crt.o singlecrt.o
+STAGE1_CFLAGS=-DSTAGE1
+STAGE2_CFLAGS=-DSTAGE2
+NETBOOT_CFLAGS=-DNETBOOT
+SRCS=crt0.S
+OBJS=stage1crt.o stage2crt.o netcrt.o
-CLEANFILES+=stage1crt.out stage2crt.out singlecrt.out ${OBJS}
+CLEANFILES+=stage1crt.out stage2crt.out netcrt.out ${OBJS}
all: ${OBJS}
-stage1crt.o: crt.c
- ${CC} ${CFLAGS} ${STAGE1_CFLAGS} -c ${.CURDIR}/crt.c -o ${.TARGET}
+stage1crt.o: crt0.S
+ ${CC} ${CFLAGS} ${STAGE1_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
${LD} -x -r ${.TARGET} -o ${.TARGET}ut
mv ${.TARGET}ut ${.TARGET}
-stage2crt.o: crt.c
- ${CC} ${CFLAGS} ${STAGE2_CFLAGS} -c ${.CURDIR}/crt.c -o ${.TARGET}
+stage2crt.o: crt0.S
+ ${CC} ${CFLAGS} ${STAGE2_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
${LD} -x -r ${.TARGET} -o ${.TARGET}ut
mv ${.TARGET}ut ${.TARGET}
-singlecrt.o: crt.c
- ${CC} ${CFLAGS} ${SINGLE_CFLAGS} -c ${.CURDIR}/crt.c -o ${.TARGET}
+netcrt.o: crt0.S
+ ${CC} ${CFLAGS} ${NETBOOT_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
${LD} -x -r ${.TARGET} -o ${.TARGET}ut
mv ${.TARGET}ut ${.TARGET}
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
index 82bf2374757..34c7287512b 100644
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
+++ b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
@@ -1,24 +1,24 @@
-# $OpenBSD: Makefile.inc,v 1.5 2006/05/16 22:51:30 miod Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2008/04/02 21:53:17 miod 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
-STAGE1=${BUGCRT_DIR}/stage1crt.o
-STAGE2=${BUGCRT_DIR}/stage2crt.o
-SINGLE=${BUGCRT_DIR}/singlecrt.o
+STAGE1_CRT=${BUGCRT_DIR}/stage1crt.o
+STAGE2_CRT=${BUGCRT_DIR}/stage2crt.o
+NETBOOT_CRT=${BUGCRT_DIR}/netcrt.o
-$(STAGE1): .NOTMAIN __always_make_bugcrt
+$(STAGE1_CRT): .NOTMAIN __always_make_bugcrt
@echo making sure stage1crt.o is up to date...
@(cd ${BUG_CRT_DIR}; ${MAKE} stage1crt.o)
-$(STAGE2): .NOTMAIN __always_make_bugcrt
+$(STAGE2_CRT): .NOTMAIN __always_make_bugcrt
@echo making sure stage2crt.o is up to date...
@(cd ${BUG_CRT_DIR}; ${MAKE} stage2crt.o)
-$(SINGLE): .NOTMAIN __always_make_bugcrt
- @echo making sure singlecrt.o is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE} singlecrt.o)
+$(NETBOOT_CRT): .NOTMAIN __always_make_bugcrt
+ @echo making sure netcrt.o is up to date...
+ @(cd ${BUG_CRT_DIR}; ${MAKE} netcrt.o)
__always_make_bugcrt: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/bugcrt/crt.c b/sys/arch/mvme88k/stand/bugcrt/crt.c
deleted file mode 100644
index 150be1abed2..00000000000
--- a/sys/arch/mvme88k/stand/bugcrt/crt.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenBSD: crt.c,v 1.6 2006/05/16 22:51:30 miod Exp $ */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libbug.h"
-
-struct mvmeprom_args bugargs;
-
-__asm__ (".text");
-__asm__ (STACK_ASM_OP); /* initial sp value */
-__asm__ (".long _start"); /* initial ip value */
-
-extern void main(void);
-
-void
-start(u_int dev_lun, u_int ctrl_lun, u_int flags, u_int ctrl_addr, u_int entry,
- u_int conf_blk, char *arg_start, char *arg_end)
-{
- extern u_int edata, end;
- char *nbarg_start;
- char *nbarg_end;
- u_int dummy;
-
- /*
- * Save r10 and r11 first. We can't put declare them as arguments
- * since the normal calling convention would put them on the stack.
- */
- __asm__ __volatile__ ("or %0, r0, r10" : "=r" (nbarg_start) : :
- "r10", "r11");
- __asm__ __volatile__ ("or %0, r0, r11" : "=r" (nbarg_end) : :
- "r10", "r11");
-
- /*
- * This code enables the SFU1 and is used for single stage
- * bootstraps or the first stage of a two stage bootstrap.
- * Do not use lower registers to enable the SFU1. This wipes out
- * the args. Not cool at all... r25 seems free.
- */
- __asm__ __volatile__ ("ldcr %0, cr1" : "=r" (dummy));
- __asm__ __volatile__ ("clr %0, %0, 1<3>; stcr %0, cr1" : "+r" (dummy));
-
- memset(&edata, 0, ((int)&end - (int)&edata));
-
- 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';
-
- main();
- _rtt();
- /* NOTREACHED */
-}
-
-void
-__main()
-{
-}
-
-void
-bugexec(void (*addr)())
-{
- (*addr)(bugargs.dev_lun, bugargs.ctrl_lun, bugargs.flags,
- bugargs.ctrl_addr, bugargs.entry, bugargs.conf_blk,
- bugargs.arg_start, bugargs.arg_end);
-
- printf("bugexec: %p returned!\n", addr);
-
- _rtt();
-}
diff --git a/sys/arch/mvme88k/stand/bugcrt/crt0.S b/sys/arch/mvme88k/stand/bugcrt/crt0.S
new file mode 100644
index 00000000000..1062a331ee7
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugcrt/crt0.S
@@ -0,0 +1,198 @@
+/* $OpenBSD: crt0.S,v 1.1 2008/04/02 21:53:18 miod Exp $ */
+
+/*
+ * Copyright (c) 2008 Miodrag Vallat.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define _KERNEL
+#define _LOCORE
+#include <machine/asm.h>
+
+ text
+
+#ifdef STAGE1
+
+ASLOCAL(image)
+ /*
+ * Binaries loaded *from disk* by the BUG start with two special words.
+ *
+ * The first word contains the initial stack address, and the second
+ * word contains the initial instruction pointer.
+ *
+ * If the initial instruction pointer is below the address the file was
+ * loaded at (which is found in the VID block or in the NIOT settings),
+ * it is interpreted as an offset within the loaded image.
+ */
+ .long _ASM_LABEL(image) - 0x10
+ .long _ASM_LABEL(start) - _ASM_LABEL(image)
+
+#endif /* STAGE1 */
+
+#ifdef STAGE2
+ /*
+ * bootxx runs the second-stage binary at its entry + 8, in case
+ * it contains the special two words.
+ */
+ NOP
+ NOP
+#endif
+
+ASGLOBAL(start)
+ /*
+ * Registers on entry:
+ * r2 boot device lun
+ * r3 boot controller lun
+ * r4 cold/warm boot mode (`IPL\01')
+ * r5 boot controller address
+ * r6 entry point of loaded program (i.e. address of start)
+ * r7 disk boot: address of media configuration block, zero if none
+ * net boot: boot information packet address
+ * r8 start of command line (loaded file if netboot)
+ * r9 end of command line
+ * r10 net boot: start of optional argument
+ * r11 net boot: end of optional argument
+ * r12 net boot: bit 0 set if autoboot
+ * r31 stack, as setup above
+ */
+
+#if defined(STAGE2) || defined(NETBOOT)
+
+ /*
+ * We first relocate ourselves to our preferred address.
+ * This helps netbooting if the NIOT address (defaulting to
+ * 001f0000) does not match ours, or if we are loaded by an
+ * old stage1 at the wrong address.
+ */
+
+ or.u r20, r0, hi16(_ASM_LABEL(start))
+ or r20, r20, lo16(_ASM_LABEL(start))
+ cmp r21, r6, r20
+ bb1 eq, r21, reloc_done
+
+ or.u r22, r0, hi16(_C_LABEL(end))
+ or r22, r22, lo16(_C_LABEL(end))
+
+ bb1.n lt, r21, reloc_down
+ or r25, r0, r6
+
+ /*
+ * Relocate from r25 to r20, moving up
+ */
+reloc_up:
+ ld r24, r25, r0
+ st r24, r20, r0
+ add r20, r20, 4
+ cmp r21, r20, r22
+ bb1.n ne, r21, reloc_up
+ add r25, r25, 4
+ br reloc_done
+
+ /*
+ * Relocate from r25 to r20, moving down
+ */
+reloc_down:
+ subu r26, r22, r20 /* _end - start */
+ addu r25, r25, r26
+1:
+ subu r25, r25, 4
+ ld r24, r25, r0
+ subu r22, r22, 4
+ st r24, r22, r0
+ cmp r21, r20, r22
+ bb1 ne, r21, 1b
+
+reloc_done:
+ or.u r20, r0, hi16(_ASM_LABEL(start_relocated))
+ or r20, r20, lo16(_ASM_LABEL(start_relocated))
+ jmp.n r20
+ or r6, r20, r0 /* for stack initialization below */
+
+ASLOCAL(start_relocated)
+
+#endif /* STAGE2 || NETBOOT */
+
+ /*
+ * Clear BSS.
+ */
+ or.u r20, r0, hi16(_C_LABEL(edata))
+ or r20, r20, lo16(_C_LABEL(edata))
+ or.u r22, r0, hi16(_C_LABEL(end))
+ or r22, r22, lo16(_C_LABEL(end))
+1: st r0, r20, r0
+ add r20, r20, 4
+ cmp r21, r20, r22
+ bb1 ne, r21, 1b
+
+ /*
+ * Setup our stack - it might not have been set up correctly.
+ * We'll use the memory below text as stack, aligned to 0x10
+ * bytes.
+ */
+ clr r31, r6, 4<0>
+
+ /*
+ * Save our arguments so that all registers are available to
+ * C code.
+ */
+ or.u r20, r0, hi16(_C_LABEL(bugargs))
+ or r20, r20, lo16(_C_LABEL(bugargs))
+
+ st r2, r20, 0x00 /* dev_lun */
+ st r3, r20, 0x04 /* ctrl_lun */
+ st r4, r20, 0x08 /* flags */
+ st r5, r20, 0x0c /* ctrl_addr */
+ st r6, r20, 0x10 /* entry */
+ st r7, r20, 0x14 /* conf_blk */
+#ifdef NETBOOT
+ st r10, r20, 0x18 /* arg_start */
+ st r11, r20, 0x1c /* arg_end */
+#else
+ st r8, r20, 0x18 /* arg_start */
+ st r9, r20, 0x1c /* arg_end */
+#endif /* NETBOOT */
+
+ /*
+ * NUL-terminate arg_end, if it is not.
+ */
+#ifdef NETBOOT
+ st.b r0, r11, r0
+#else
+ st.b r0, r9, r0
+#endif
+
+ /*
+ * PSR when booted from the BUG has SFU1..SFU7 disabled.
+ * Enable SFU1 (the FPU) for the C code to be able to use it
+ * if necessary.
+ */
+ ldcr r20, PSR
+ clr r20, r20, 1<PSR_FPU_DISABLE_BIT>
+ stcr r20, PSR
+ NOP
+
+ bsr _C_LABEL(main)
+ bsr _C_LABEL(_rtt)
+1: br 1b
+
+ data
+GLOBAL(bugargs)
+ .space 4 /* dev_lun */
+ .space 4 /* ctrl_lun */
+ .space 4 /* flags */
+ .space 4 /* ctrl_addr */
+ .space 4 /* entry */
+ .space 4 /* conf_blk */
+ .space 4 /* arg_start */
+ .space 4 /* arg_end */
diff --git a/sys/arch/mvme88k/stand/libbug/libbug.h b/sys/arch/mvme88k/stand/libbug/libbug.h
index 5c9a98d4965..ff3e7fdd315 100644
--- a/sys/arch/mvme88k/stand/libbug/libbug.h
+++ b/sys/arch/mvme88k/stand/libbug/libbug.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libbug.h,v 1.5 2006/05/17 06:21:33 miod Exp $ */
+/* $OpenBSD: libbug.h,v 1.6 2008/04/02 21:53:18 miod Exp $ */
/*
* prototypes and such. note that get/put char are in stand.h
@@ -27,10 +27,6 @@ struct mvmeprom_args {
u_int conf_blk;
char *arg_start;
char *arg_end;
- char *nbarg_start;
- char *nbarg_end;
};
extern struct mvmeprom_args bugargs;
-
-void bugexec(void (*)());
diff --git a/sys/arch/mvme88k/stand/libsa/Makefile b/sys/arch/mvme88k/stand/libsa/Makefile
index 3e805c080ae..dca00c437a3 100644
--- a/sys/arch/mvme88k/stand/libsa/Makefile
+++ b/sys/arch/mvme88k/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.11 2008/03/31 22:14:43 miod Exp $
+# $OpenBSD: Makefile,v 1.12 2008/04/02 21:53:18 miod Exp $
LIB=sa
@@ -22,7 +22,7 @@ SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c nfs.c \
SRCS+= loadfile.c
.PATH: ${S}/lib/libkern/arch/m88k ${S}/lib/libkern
-SRCS+= ashrdi3.c bzero.c
+SRCS+= ashrdi3.c bzero.c __main.c
# DBG= -DDEBUG -DNETIF_DEBUG -DNFS_DEBUG -DRPC_DEBUG \
# -DNET_DEBUG -DRARP_DEBUG -DETHER_DEBUG
diff --git a/sys/arch/mvme88k/stand/netboot/Makefile b/sys/arch/mvme88k/stand/netboot/Makefile
index eb267a3757c..1ea61e75291 100644
--- a/sys/arch/mvme88k/stand/netboot/Makefile
+++ b/sys/arch/mvme88k/stand/netboot/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.14 2006/05/16 22:51:30 miod Exp $
+# $OpenBSD: Makefile,v 1.15 2008/04/02 21:53:18 miod Exp $
SIZE?= size
STRIP?= strip
@@ -25,15 +25,14 @@ LDFLAGS+= -s -N -T ${STAGE2_RELOC}
all: netboot.bin
-netboot: ${OBJS} ${SINGLE} ${LIBS}
+netboot: ${OBJS} ${NETBOOT_CRT} ${LIBS}
${LD} ${LDFLAGS} -o $@ \
- ${SINGLE} ${OBJS} ${LIBS} `cc -print-libgcc-file-name`
+ ${NETBOOT_CRT} ${OBJS} ${LIBS} `cc -print-libgcc-file-name`
# @${SIZE} $@
netboot.bin: netboot
${STRIP} netboot
dd ibs=32 skip=1 if=netboot of=$@
-# dd ibs=38 skip=1 if=netboot of=$@
install:
${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
diff --git a/sys/arch/mvme88k/stand/netboot/boot.c b/sys/arch/mvme88k/stand/netboot/boot.c
index f9a6067173f..a9ac1e883c1 100644
--- a/sys/arch/mvme88k/stand/netboot/boot.c
+++ b/sys/arch/mvme88k/stand/netboot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.7 2006/05/16 22:51:30 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.8 2008/04/02 21:53:18 miod Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -71,11 +71,6 @@ main()
char *cp, *file;
int ask = 0, howto, ret;
- /* cycle in the correct args */
- bugargs.arg_start = bugargs.nbarg_start;
- bugargs.arg_end = bugargs.nbarg_end;
- *bugargs.arg_end = 0; /* ensure */
-
printf("\n>> OpenBSD/mvme88k netboot [%s]\n", version);
ret = parse_args(&file, &howto);
diff --git a/sys/arch/mvme88k/stand/netboot/version.c b/sys/arch/mvme88k/stand/netboot/version.c
index 96a409cad51..80260dfc39b 100644
--- a/sys/arch/mvme88k/stand/netboot/version.c
+++ b/sys/arch/mvme88k/stand/netboot/version.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: version.c,v 1.4 2008/03/31 22:14:43 miod Exp $ */
+/* $OpenBSD: version.c,v 1.5 2008/04/02 21:53:18 miod Exp $ */
/*
+ * 1.5 rewritten crt code, self-relocatable
* 1.4 kernel loaded with loadfile, a.out and ELF formats
* 1.3 rewritten startup code and general cleanup
*/
-char *version = "1.4";
+char *version = "1.5";
diff --git a/sys/arch/mvme88k/stand/tftpboot/Makefile b/sys/arch/mvme88k/stand/tftpboot/Makefile
index a47ca7b9c14..7e245d09012 100644
--- a/sys/arch/mvme88k/stand/tftpboot/Makefile
+++ b/sys/arch/mvme88k/stand/tftpboot/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.3 2006/05/16 22:51:30 miod Exp $
+# $OpenBSD: Makefile,v 1.4 2008/04/02 21:53:18 miod Exp $
SIZE?= size
STRIP?= strip
@@ -23,15 +23,13 @@ LDFLAGS+= -s -N -T ${STAGE2_RELOC}
all: tftpboot.bin
-tftpboot: ${OBJS} ${SINGLE} ${LIBS}
+tftpboot: ${OBJS} ${NETBOOT_CRT} ${LIBS}
${LD} ${LDFLAGS} -o $@ \
- ${SINGLE} ${OBJS} ${LIBS} `cc -print-libgcc-file-name`
-# @${SIZE} $@
+ ${NETBOOT_CRT} ${OBJS} ${LIBS} `cc -print-libgcc-file-name`
tftpboot.bin: tftpboot
${STRIP} tftpboot
dd ibs=32 skip=1 if=tftpboot of=$@
-# dd ibs=38 skip=1 if=tftpboot of=$@
install:
${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
diff --git a/sys/arch/mvme88k/stand/tftpboot/boot.c b/sys/arch/mvme88k/stand/tftpboot/boot.c
index 8e91c6c62ce..7d39954221a 100644
--- a/sys/arch/mvme88k/stand/tftpboot/boot.c
+++ b/sys/arch/mvme88k/stand/tftpboot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.2 2004/01/28 08:45:13 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.3 2008/04/02 21:53:18 miod Exp $ */
/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */
/*-
@@ -50,11 +50,6 @@ main()
int flag, ret;
int ask = 0;
- /* skip first argument, it's our own name */
- bugargs.arg_start = bugargs.nbarg_start;
- bugargs.arg_end = bugargs.nbarg_end;
- *bugargs.arg_end = '\0'; /* just stay on the safe side */
-
printf("\n>> OpenBSD/mvme88k tftpboot [%s]\n", version);
ret = parse_args(&file, &flag);
diff --git a/sys/arch/mvme88k/stand/tftpboot/version.c b/sys/arch/mvme88k/stand/tftpboot/version.c
index 1189c587101..0bb6fffb0b5 100644
--- a/sys/arch/mvme88k/stand/tftpboot/version.c
+++ b/sys/arch/mvme88k/stand/tftpboot/version.c
@@ -1,8 +1,9 @@
-/* $OpenBSD: version.c,v 1.3 2008/03/31 22:14:43 miod Exp $ */
+/* $OpenBSD: version.c,v 1.4 2008/04/02 21:53:18 miod Exp $ */
/*
+ * 1.4 rewritten crt code, self-relocatable
* 1.3 kernel loaded with loadfile, a.out and ELF formats
* 1.2 rewritten startup code and general cleanup
* 1.1 initial revision
*/
-char *version = "1.3";
+char *version = "1.4";