diff options
Diffstat (limited to 'sys/boot/ia64/skiload')
-rw-r--r-- | sys/boot/ia64/skiload/Makefile | 85 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/conf.c | 86 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/ldscript.ia64 | 61 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/main.c | 128 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/skiload.cmd | 16 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/start.S | 64 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/version | 8 |
7 files changed, 448 insertions, 0 deletions
diff --git a/sys/boot/ia64/skiload/Makefile b/sys/boot/ia64/skiload/Makefile new file mode 100644 index 0000000..5d89340 --- /dev/null +++ b/sys/boot/ia64/skiload/Makefile @@ -0,0 +1,85 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../common + +PROG= skiload +NOMAN= +NEWVERSWHAT= "ia64 SKI boot" ${MACHINE_ARCH} +BINDIR?= /boot +STRIP= # We must not strip skiload at install time. + +SRCS+= conf.c main.c start.S + +CFLAGS+= -ffreestanding + +.if !defined(NOFORTH) +# Enable BootForth +BOOT_FORTH= yes +CFLAGS+= -DBOOT_FORTH +CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE_ARCH} +.if exists(${.OBJDIR}/../../ficl/libficl.a) +LIBFICL= ${.OBJDIR}/../../ficl/libficl.a +.else +LIBFICL= ${.CURDIR}/../../ficl/libficl.a +.endif +.endif + +# where to get libstand from +.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a) +LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a +.else +LIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a +.endif + +.if exists(${.OBJDIR}/../libski/libski.a) +LIBSKI= ${.OBJDIR}/../libski/libski.a +.else +LIBSKI= ${.CURDIR}/../libski/libski.a +.endif + +# Always add MI sources +.PATH: ${.CURDIR}/../../common +.include <${.CURDIR}/../../common/Makefile.inc> + +CFLAGS+= -I- +CFLAGS+= -I${.CURDIR}/../include +CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH} +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/../../.. -I. +CFLAGS+= -I${.CURDIR}/../libski +CFLAGS+= -DLOADER + +LDFLAGS= -nostdlib -T ${.CURDIR}/ldscript.ia64 + +CLEANFILES+= vers.c vers.o ${PROG}.list +CLEANFILES+= loader.help +CLEANFILES+= machine + +all: ${PROG} + +vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version + sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} + ${CC} -c vers.c + +${PROG}.help: help.common help.efi + cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk \ + > ${.TARGET} + +beforeinstall: +.if exists(${.OBJDIR}/${PROG}.help) + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${.OBJDIR}/${PROG}.help ${DESTDIR}/boot +.endif + +machine: + ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine + +${PROG}: ${OBJS} ${LIBFICL} ${LIBSKI} ${LIBSTAND} vers.o + ${LD} ${LDFLAGS} -o ${PROG} -M \ + ${OBJS} vers.o \ + ${LIBFICL} ${LIBSTAND} ${LIBSKI} ${LIBSTAND} \ + > ${.OBJDIR}/${PROG}.list + +.include <bsd.prog.mk> + +beforedepend ${OBJS}: machine diff --git a/sys/boot/ia64/skiload/conf.c b/sys/boot/ia64/skiload/conf.c new file mode 100644 index 0000000..5066a77 --- /dev/null +++ b/sys/boot/ia64/skiload/conf.c @@ -0,0 +1,86 @@ +/* + * 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. + * + * $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $ + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <stand.h> + +#include "libski.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[] = { + &skifs_dev, + NULL +}; + +struct fs_ops *file_system[] = { + &ski_fsops, + &ufs_fsops, + &gzipfs_fsops, + NULL +}; + +/* Exported for ia64 only */ +/* + * Sort formats so that those that can detect based on arguments + * rather than reading the file go first. + */ +extern struct file_format ia64_elf; + +struct file_format *file_formats[] = { + &ia64_elf, + NULL +}; + +/* + * Consoles + * + * We don't prototype these in libalpha.h because they require + * data structures from bootstrap.h as well. + */ +extern struct console ski_console; + +struct console *consoles[] = { + &ski_console, + NULL +}; diff --git a/sys/boot/ia64/skiload/ldscript.ia64 b/sys/boot/ia64/skiload/ldscript.ia64 new file mode 100644 index 0000000..e4e1dad --- /dev/null +++ b/sys/boot/ia64/skiload/ldscript.ia64 @@ -0,0 +1,61 @@ +/* $FreeBSD$ */ +OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little", "elf64-ia64-little") +OUTPUT_ARCH(ia64) +ENTRY(_start) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x100000; + .text : { + *(.text .stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.plt) + } =0x00300000010070000002000001000400 + .data : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + *(.opd) + *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) + *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) + __start_set_Xcommand_set = .; + *(set_Xcommand_set) + __stop_set_Xcommand_set = .; + *(.data .data.* .gnu.linkonce.d.*) + *(.data1) + *(.plabel) + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + } + __gp = .; + .sdata : { + *(.got.plt .got) + *(.IA_64.pltoff) + *(.sdata .sdata.* .gnu.linkonce.s.*) + *(dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .dynamic : { *(.dynamic) } + .rela : { + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + *(.rela.plt) + *(.rela.IA_64.pltoff) + *(.relaset_*) + *(.rela.dyn .rela.dyn.*) + } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } +} diff --git a/sys/boot/ia64/skiload/main.c b/sys/boot/ia64/skiload/main.c new file mode 100644 index 0000000..f336d17 --- /dev/null +++ b/sys/boot/ia64/skiload/main.c @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> + * Copyright (c) 1998,2000 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. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <stand.h> +#include <string.h> +#include <setjmp.h> +#include <machine/fpu.h> + +#include "bootstrap.h" +#include "libski.h" + +extern char bootprog_name[]; +extern char bootprog_rev[]; +extern char bootprog_date[]; +extern char bootprog_maker[]; + +struct ski_devdesc currdev; /* our current device */ +struct arch_switch archsw; /* MI/MD interface boundary */ + +void +ski_main(void) +{ + static char malloc[512*1024]; + int i; + + /* + * 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 *)malloc, (void *)(malloc + 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(); + + /* + * 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); +#if 0 + printf("Memory: %ld k\n", memsize() / 1024); +#endif + + /* XXX presumes that biosdisk is first in devsw */ + currdev.d_dev = devsw[0]; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_kind.skidisk.unit = 0; + /* XXX should be able to detect this, default to autoprobe */ + currdev.d_kind.skidisk.slice = -1; + /* default to 'a' */ + currdev.d_kind.skidisk.partition = 0; + +#if 0 + /* Create arc-specific variables */ + bootfile = GetEnvironmentVariable(ARCENV_BOOTFILE); + if (bootfile) + setenv("bootfile", bootfile, 1); +#endif + + env_setenv("currdev", EV_VOLATILE, ski_fmtdev(&currdev), + ski_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, ski_fmtdev(&currdev), env_noset, + env_nounset); + + setenv("LINES", "24", 1); /* optional */ + + archsw.arch_autoload = ski_autoload; + archsw.arch_getdev = ski_getdev; + archsw.arch_copyin = ski_copyin; + archsw.arch_copyout = ski_copyout; + archsw.arch_readin = ski_readin; + + interact(); /* doesn't return */ + + exit(0); +} + +COMMAND_SET(quit, "quit", "exit the loader", command_quit); + +static int +command_quit(int argc, char *argv[]) +{ + exit(0); + return (CMD_OK); +} diff --git a/sys/boot/ia64/skiload/skiload.cmd b/sys/boot/ia64/skiload/skiload.cmd new file mode 100644 index 0000000..48b77e1 --- /dev/null +++ b/sys/boot/ia64/skiload/skiload.cmd @@ -0,0 +1,16 @@ +# $FreeBSD$ +iar +fr +pa +b enter_kernel +c +b printf +c +b rp +c +b ssc +c +b rp +c +bD +s 11 diff --git a/sys/boot/ia64/skiload/start.S b/sys/boot/ia64/skiload/start.S new file mode 100644 index 0000000..bb0266f --- /dev/null +++ b/sys/boot/ia64/skiload/start.S @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Marcel Moolenaar + * 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 ``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. + * + * $FreeBSD$ + */ + +#include <machine/fpu.h> + +#define STACKSIZE 16384 +#define FPSR_DEFAULT 0x0009804c0270033f + + .text + .global _start + .proc _start +_start: +{ .mlx + mov ar.rsc=0 + movl gp=__gp + ;; +} +{ .mlx + add r2=@gprel(stack),gp + movl r14=FPSR_DEFAULT + ;; +} +{ .mib + mov ar.bspstore=r2 + add r12=STACKSIZE-16,r2 + bsw.1 + ;; +} +{ .mmb + mov ar.rsc=3 + mov ar.fpsr=r14 + br.sptk ski_main + ;; +} + .endp _start + + .data + .align 16 +stack: .skip STACKSIZE diff --git a/sys/boot/ia64/skiload/version b/sys/boot/ia64/skiload/version new file mode 100644 index 0000000..6f4fc3c --- /dev/null +++ b/sys/boot/ia64/skiload/version @@ -0,0 +1,8 @@ +$FreeBSD$ + +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.2: Pass the address of the bootinfo block to the kernel in register + r8. Keep it at the hardwired address for now. +0.1: Initial SKI version. |