summaryrefslogtreecommitdiffstats
path: root/sys/boot/arc/loader
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/arc/loader')
-rw-r--r--sys/boot/arc/loader/Makefile90
-rw-r--r--sys/boot/arc/loader/conf.c85
-rw-r--r--sys/boot/arc/loader/help.alpha0
-rw-r--r--sys/boot/arc/loader/main.c405
-rw-r--r--sys/boot/arc/loader/setdef0.c49
-rw-r--r--sys/boot/arc/loader/setdef1.c41
-rw-r--r--sys/boot/arc/loader/version7
7 files changed, 677 insertions, 0 deletions
diff --git a/sys/boot/arc/loader/Makefile b/sys/boot/arc/loader/Makefile
new file mode 100644
index 0000000..8463b88
--- /dev/null
+++ b/sys/boot/arc/loader/Makefile
@@ -0,0 +1,90 @@
+# $NetBSD: Makefile,v 1.12 1998/02/19 14:18:36 drochner Exp $
+
+BASE= loader
+PROG= ${BASE}
+NOMAN=
+NEWVERSWHAT= "ARC disk boot" ${MACHINE_ARCH}
+
+.PATH: ${.CURDIR}/../common
+
+# i386-specific bootstrap sources
+SRCS+= main.c conf.c
+
+# Always add MI sources
+.PATH: ${.CURDIR}/../../common
+.include <${.CURDIR}/../../common/Makefile.inc>
+CFLAGS+= -mno-fp-regs
+CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
+CFLAGS+= -I${.CURDIR}/../../.. -I.
+CFLAGS+= -DLOADER
+
+CLEANFILES+= vers.c vers.o gensetdefs.o gensetdefs setdef0.o setdef1.o \
+ setdefs.h start.o
+CLEANFILES+= ${BASE} ${BASE}.sym ${BASE}.list
+
+CFLAGS+= -Wall
+
+CFLAGS+= -I${LIBSTANDDIR}
+CFLAGS+= -I${.CURDIR}/../include
+CRT= start.o
+STRIP=
+BINDIR?= /boot
+LOAD_ADDRESS?= 0xffffffff80900000
+
+all: ${BASE}.exe
+
+vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
+ sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
+ ${CC} -c vers.c
+
+${BASE}.exe: ${BASE} ${BASE}.help
+ elf2exe ${BASE}.sym ${BASE}.exe
+
+#${BASE}: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o setdef0.o setdef1.o
+# ${LD} -o ${BASE}.sym -M -e __start -N -Ttext ${LOAD_ADDRESS} \
+# ${CRT} setdef0.o ${OBJS} setdef1.o \
+# vers.o ${LIBSTAND} ${LIBARC} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
+
+${BASE}: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o setdef0.o setdef1.o
+ ${LD} -o ${BASE}.sym -M -N -Ttext ${LOAD_ADDRESS} \
+ ${CRT} setdef0.o ${OBJS} setdef1.o \
+ vers.o ${LIBSTAND} ${LIBARC} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
+
+${BASE}.help: help.common help.alpha
+ cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
+
+beforeinstall:
+.if exists(${.OBJDIR}/loader.help)
+ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
+ ${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
+.else
+ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
+ ${.CURDIR}/${BASE}.help ${DESTDIR}/boot
+.endif
+
+# Other fragments still to be brought in from ../Makfile.booters?
+start.o: ${.CURDIR}/../lib/arch/${MACHINE}/start.S
+ ${CC} -c ${CFLAGS} $<
+
+setdef0.o: setdefs.h
+
+setdef1.o: setdefs.h
+
+machine:
+ ln -sf ${.CURDIR}/../../../alpha/include machine
+
+CLEANFILES+= machine setdefs.h gensetdefs ${BASE} ${BASE}.exe loader.help
+
+.include <bsd.prog.mk>
+
+setdefs.h: gensetdefs ${OBJS}
+ @echo Generating linker sets
+ @./gensetdefs ${OBJS} >setdefs.h
+
+gensetdefs: gensetdefs.o
+ ${CC} -static gensetdefs.o -o $@
+
+gensetdefs.o: gensetdefs.c
+ ${CC} -c $<
+
+beforedepend ${OBJS}: machine
diff --git a/sys/boot/arc/loader/conf.c b/sys/boot/arc/loader/conf.c
new file mode 100644
index 0000000..1b5384c
--- /dev/null
+++ b/sys/boot/arc/loader/conf.c
@@ -0,0 +1,85 @@
+/*
+ * $Id: conf.c,v 1.2 1998/08/31 21:10:36 msmith Exp $
+ * From $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
+ */
+
+/*
+ * Copyright (c) 1997
+ * Matthias Drochner. 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 for the NetBSD Project
+ * by Matthias Drochner.
+ * 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 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.
+ */
+
+
+#include <stand.h>
+#include "libarc.h"
+
+/*
+ * We could use linker sets for some or all of these, but
+ * then we would have to control what ended up linked into
+ * the bootstrap. So it's easier to conditionalise things
+ * here.
+ *
+ * XXX rename these arrays to be consistent and less namespace-hostile
+ */
+
+/* Exported for libstand */
+struct devsw *devsw[] = {
+ &arcdisk,
+ NULL
+};
+
+struct fs_ops *file_system[] = {
+ &ufs_fsops,
+ &zipfs_fsops,
+ NULL
+};
+
+/* Exported for alpha only */
+/*
+ * Sort formats so that those that can detect based on arguments
+ * rather than reading the file go first.
+ */
+extern struct module_format alpha_elf;
+
+struct module_format *module_formats[] = {
+ &alpha_elf,
+ NULL
+};
+
+/*
+ * Consoles
+ *
+ * We don't prototype these in libalpha.h because they require
+ * data structures from bootstrap.h as well.
+ */
+extern struct console arcconsole;
+
+struct console *consoles[] = {
+ &arcconsole,
+ NULL
+};
diff --git a/sys/boot/arc/loader/help.alpha b/sys/boot/arc/loader/help.alpha
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/sys/boot/arc/loader/help.alpha
diff --git a/sys/boot/arc/loader/main.c b/sys/boot/arc/loader/main.c
new file mode 100644
index 0000000..ea0165b
--- /dev/null
+++ b/sys/boot/arc/loader/main.c
@@ -0,0 +1,405 @@
+/*-
+ * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
+ * Copyright (c) 1998 Doug Rabson <dfr@freebsd.org>
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $Id$
+ */
+
+
+#include <stand.h>
+#include <string.h>
+#include <setjmp.h>
+
+#include <sys/param.h>
+#include "bootstrap.h"
+#include "libarc.h"
+#include "arctypes.h"
+#include "arcfuncs.h"
+
+extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
+
+struct arc_devdesc currdev; /* our current device */
+struct arch_switch archsw; /* MI/MD interface boundary */
+
+extern char end[];
+extern void halt(void);
+
+#define ARCENV_BOOTFILE "OSLoadFilename"
+
+static char *MemoryTypes[] = {
+ "MemoryExceptionBlock",
+ "MemorySystemBlock",
+ "MemoryFree",
+ "MemoryBad",
+ "MemoryLoadedProgram",
+ "MemoryFirmwareTemporary",
+ "MemoryFirmwarePermanent",
+ "MemoryFreeContiguous",
+ "MemorySpecialMemory",
+ "MemoryMaximum",
+};
+
+#ifdef __alpha__
+#define ptob(p) ((p) << 13)
+#endif
+
+unsigned long
+memsize()
+{
+ unsigned long amount = 0;
+ MEMORY_DESCRIPTOR *desc;
+
+ for (desc = GetMemoryDescriptor(NULL); desc;
+ desc = GetMemoryDescriptor(desc)) {
+ printf("%s at %x-%x\n", MemoryTypes[desc->Type],
+ ptob(desc->BasePage),
+ ptob(desc->BasePage + desc->PageCount));
+ if (desc->Type == MemoryFree
+ || desc->Type == MemoryFirmwareTemporary)
+ amount += (desc->PageCount << 13); /* XXX pagesize */
+ }
+
+ return amount;
+}
+
+static char *ConfigurationClasses[] = {
+ "SystemClass",
+ "ProcessorClass",
+ "CacheClass",
+ "AdapterClass",
+ "ControllerClass",
+ "PeripheralClass",
+ "MemoryClass",
+ "MaximumClass",
+};
+
+
+static char *ConfigurationTypes[] = {
+ "ArcSystem",
+ "CentralProcessor",
+ "FloatingPointProcessor",
+ "PrimaryIcache",
+ "PrimaryDcache",
+ "SecondaryIcache",
+ "SecondaryDcache",
+ "SecondaryCache",
+ "EisaAdapter",
+ "TcAdapter",
+ "ScsiAdapter",
+ "DtiAdapter",
+ "MultiFunctionAdapter",
+ "DiskController",
+ "TapeController",
+ "CdromController",
+ "WormController",
+ "SerialController",
+ "NetworkController",
+ "DisplayController",
+ "ParallelController",
+ "PointerController",
+ "KeyboardController",
+ "AudioController",
+ "OtherController",
+ "DiskPeripheral",
+ "FloppyDiskPeripheral",
+ "TapePeripheral",
+ "ModemPeripheral",
+ "MonitorPeripheral",
+ "PrinterPeripheral",
+ "PointerPeripheral",
+ "KeyboardPeripheral",
+ "TerminalPeripheral",
+ "OtherPeripheral",
+ "LinePeripheral",
+ "NetworkPeripheral",
+ "SystemMemory",
+ "MaximumType",
+};
+
+static char *ConfigurationTypeCodes[] = {
+ "ARC",
+ "CPU",
+ "FPC",
+ "PrimaryIcache",
+ "PrimaryDcache",
+ "SecondaryIcache",
+ "SecondaryDcache",
+ "SecondaryCache",
+ "eisa",
+ "TcAdapter", /* XXX ? */
+ "scsi",
+ "DtiAdapter", /* XXX ? */
+ "multi",
+ "disk",
+ "TapeController", /* XXX ? */
+ "CdromController", /* XXX ? */
+ "WormController", /* XXX ? */
+ "serial",
+ "NetworkController", /* XXX ? */
+ "video",
+ "par",
+ "PointerController", /* XXX ? */
+ "key",
+ "AudioController", /* XXX ? */
+ "OtherController", /* XXX ? */
+ "rdisk",
+ "fdisk",
+ "TapePeripheral", /* XXX ? */
+ "ModemPeripheral", /* XXX ? */
+ "MonitorPeripheral", /* XXX ? */
+ "PrinterPeripheral", /* XXX ? */
+ "PointerPeripheral", /* XXX ? */
+ "keyboard",
+ "TerminalPeripheral", /* XXX ? */
+ "OtherPeripheral", /* XXX ? */
+ "LinePeripheral", /* XXX ? */
+ "NetworkPeripheral", /* XXX ? */
+ "Memory",
+ "MaximumType"
+};
+
+static void
+indent(int level)
+{
+ while (level--)
+ putchar(' ');
+}
+
+void
+printconfig(unsigned int level, CONFIGURATION_COMPONENT *component)
+{
+ CONFIGURATION_COMPONENT *child;
+
+ indent(level);
+ printf("%s(%s,%d)",
+ ConfigurationClasses[component->Class],
+ ConfigurationTypes[component->Type],
+ component->Key);
+#if 1
+ if (component->IdentifierLength)
+ printf("=%d,%s\n", component->IdentifierLength,
+ ptr(component->Identifier));
+ else
+ putchar('\n');
+#endif
+ getchar();
+
+ for (child = GetChild(component); child; child = GetPeer(child)) {
+ printconfig(level + 2, child);
+ }
+}
+
+void
+dumpdisk(const char *name)
+{
+ u_int32_t fd, count;
+ unsigned char buf[512];
+ int i, j;
+
+ printf("dump first sector of %s\n", name);
+ if (Open(name, OpenReadOnly, &fd) != ESUCCESS) {
+ printf("can't open disk\n");
+ return;
+ }
+ if (Read(fd, buf, 512, &count) != ESUCCESS) {
+ printf("can't read from disk\n");
+ Close(fd);
+ return;
+ }
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 32; j++)
+ printf("%02x", buf[i*32 + j]);
+ putchar('\n');
+ }
+ Close(fd);
+}
+
+void
+listdisks(char *path, CONFIGURATION_COMPONENT *component)
+{
+ CONFIGURATION_COMPONENT *child;
+ char newpath[80];
+ char keybuf[20];
+
+ if (path == NULL) {
+ printf("\nARC disk devices:\n");
+ newpath[0] = '\0';
+ } else {
+ strcpy(newpath, path);
+ strcat(newpath, ConfigurationTypeCodes[component->Type]);
+ sprintf(keybuf, "(%d)", component->Key);
+ strcat(newpath, keybuf);
+ }
+ if (!strcmp(ConfigurationTypeCodes[component->Type], "rdisk") ||
+ !strcmp(ConfigurationTypeCodes[component->Type], "fdisk")) {
+ printf("%s\n", newpath);
+ }
+ for (child = GetChild(component); child; child = GetPeer(child)) {
+ listdisks(newpath, child);
+ }
+}
+
+static int exit_code = 0;
+jmp_buf exit_env;
+
+void
+exit(int code)
+{
+ exit_code = 0;
+ longjmp(exit_env, 1);
+}
+
+int
+main(int argc, int argv[], int envp[])
+{
+ int i;
+ char *bootfile;
+
+ if (setjmp(exit_env))
+ return exit_code;
+
+ /*
+ * Initialise the heap as early as possible. Once this is done,
+ * alloc() is usable. The stack is buried inside us, so this is
+ * safe.
+ */
+ setheap((void *)end, (void *)(end + 512*1024));
+
+ /*
+ * XXX Chicken-and-egg problem; we want to have console output
+ * early, but some console attributes may depend on reading from
+ * eg. the boot device, which we can't do yet. We can use
+ * printf() etc. once this is done.
+ */
+ cons_probe();
+
+#if 0
+ printconfig(0, GetChild(NULL));
+ dumpdisk("scsi(0)disk(0)rdisk(0)partition(0)");
+#endif
+ listdisks(NULL, GetChild(NULL));
+ printf("\n");
+
+ make_rpb();
+
+ /*
+ * Initialise the block cache
+ */
+ bcache_init(32, 512); /* 16k XXX tune this */
+
+ /*
+ * March through the device switch probing for things.
+ */
+ for (i = 0; devsw[i] != NULL; i++)
+ if (devsw[i]->dv_init != NULL)
+ (devsw[i]->dv_init)();
+
+ printf("\n");
+ printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
+ printf("(%s, %s)\n", bootprog_maker, bootprog_date);
+ printf("Memory: %ld k\n", memsize() / 1024);
+
+ /* We're booting from an SRM disk, try to spiff this */
+ /* XXX presumes that biosdisk is first in devsw */
+ currdev.d_dev = devsw[0];
+ currdev.d_type = currdev.d_dev->dv_type;
+ currdev.d_kind.arcdisk.unit = 0;
+ /* XXX should be able to detect this, default to autoprobe */
+ currdev.d_kind.arcdisk.slice = -1;
+ /* default to 'a' */
+ currdev.d_kind.arcdisk.partition = 0;
+
+ /* Create arc-specific variables */
+ bootfile = GetEnvironmentVariable(ARCENV_BOOTFILE);
+ if (bootfile)
+ setenv("bootfile", bootfile, 1);
+
+ env_setenv("currdev", EV_VOLATILE,
+ arc_fmtdev(&currdev), arc_setcurrdev, env_nounset);
+ env_setenv("loaddev", EV_VOLATILE,
+ arc_fmtdev(&currdev), env_noset, env_nounset);
+ setenv("LINES", "24", 1); /* optional */
+
+ archsw.arch_autoload = arc_autoload;
+ archsw.arch_getdev = arc_getdev;
+ archsw.arch_copyin = arc_copyin;
+ archsw.arch_copyout = arc_copyout;
+ archsw.arch_readin = arc_readin;
+
+ interact(); /* doesn't return */
+
+ return 0; /* keep compiler happy */
+}
+
+COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
+
+static int
+command_reboot(int argc, char *argv[])
+{
+
+ printf("Rebooting...\n");
+ delay(1000000);
+ FwReboot();
+ /* Note: we shouldn't get to this point! */
+ panic("Reboot failed!");
+ exit(0);
+}
+
+COMMAND_SET(quit, "quit", "exit the loader", command_quit);
+
+static int
+command_quit(int argc, char *argv[])
+{
+ exit(0);
+ return(CMD_OK);
+}
+
+#if 0
+
+COMMAND_SET(stack, "stack", "show stack usage", command_stack);
+
+static int
+command_stack(int argc, char *argv[])
+{
+ char *cp;
+
+ for (cp = &stackbase; cp < &stacktop; cp++)
+ if (*cp != 0)
+ break;
+
+ printf("%d bytes of stack used\n", &stacktop - cp);
+ return(CMD_OK);
+}
+
+#endif
+
+COMMAND_SET(heap, "heap", "show heap usage", command_heap);
+
+static int
+command_heap(int argc, char *argv[])
+{
+ printf("heap base at %p, top at %p, used %ld\n", end, sbrk(0), sbrk(0) - end);
+ return(CMD_OK);
+}
diff --git a/sys/boot/arc/loader/setdef0.c b/sys/boot/arc/loader/setdef0.c
new file mode 100644
index 0000000..79874ea
--- /dev/null
+++ b/sys/boot/arc/loader/setdef0.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 1997 John D. Polstra
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $Id: setdef0.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
+ */
+
+#ifdef __ELF__
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+
+/*
+ * DEFINE_SET creates the section and label for a set, and emits the
+ * count word at the front of it.
+ */
+#define DEFINE_SET(set, count) \
+ __asm__(".section .set." #set ",\"aw\""); \
+ __asm__(".globl " #set); \
+ __asm__(".type " #set ",@object"); \
+ __asm__(".p2align 3"); \
+ __asm__(#set ":"); \
+ __asm__(".quad " #count); \
+ __asm__(".previous")
+
+#include "setdefs.h" /* Contains a `DEFINE_SET' for each set */
+
+#endif /* __ELF__ */
diff --git a/sys/boot/arc/loader/setdef1.c b/sys/boot/arc/loader/setdef1.c
new file mode 100644
index 0000000..9fffaf7
--- /dev/null
+++ b/sys/boot/arc/loader/setdef1.c
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 1997 John D. Polstra
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $Id: setdef1.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
+ */
+
+#ifdef __ELF__
+
+/*
+ * DEFINE_SET emits the NULL terminator for a set.
+ */
+#define DEFINE_SET(set, count) \
+ __asm__(".section .set." #set ",\"aw\""); \
+ __asm__(".quad 0"); \
+ __asm__(".previous")
+
+#include "setdefs.h" /* Contains a `DEFINE_SET' for each set */
+
+#endif /* __ELF__ */
diff --git a/sys/boot/arc/loader/version b/sys/boot/arc/loader/version
new file mode 100644
index 0000000..23262b9
--- /dev/null
+++ b/sys/boot/arc/loader/version
@@ -0,0 +1,7 @@
+$Id: version,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
+
+NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
+file is important. Make sure the current version number is on line 6.
+
+0.1: Initial i386 version, germinated from the NetBSD i386
+ standalone, but enormously modified.
OpenPOWER on IntegriCloud