summaryrefslogtreecommitdiff
path: root/sys/arch/hppa64/stand/boot
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/hppa64/stand/boot')
-rw-r--r--sys/arch/hppa64/stand/boot/Makefile60
-rw-r--r--sys/arch/hppa64/stand/boot/boot.8342
-rw-r--r--sys/arch/hppa64/stand/boot/conf.c51
-rw-r--r--sys/arch/hppa64/stand/boot/exec.c42
-rw-r--r--sys/arch/hppa64/stand/boot/ld.script61
-rw-r--r--sys/arch/hppa64/stand/boot/srt0.S181
6 files changed, 737 insertions, 0 deletions
diff --git a/sys/arch/hppa64/stand/boot/Makefile b/sys/arch/hppa64/stand/boot/Makefile
new file mode 100644
index 00000000000..dd9bc44c62f
--- /dev/null
+++ b/sys/arch/hppa64/stand/boot/Makefile
@@ -0,0 +1,60 @@
+# $OpenBSD: Makefile,v 1.1 2005/04/01 10:40:48 mickey Exp $
+
+MAN= boot.8
+MANSUBDIR=hppa64
+MLINKS= boot.8 boot.conf.8
+S =${.CURDIR}/../../../..
+CLEANFILES+= boot.gdb boot.map boot.lif
+
+.if ${MACHINE} == "hppa64"
+PROG= boot
+SRCS= srt0.S exec.c boot.c cmd.c vars.c bootarg.c conf.c
+LD?= ld
+LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR)
+LDFLAGS+=-T ${.CURDIR}/ld.script -Map boot.map
+LDFLAGS+=--warn-constructors --warn-common
+SIZE?= size
+STRIP?= strip
+STANDIR=${.CURDIR}/..
+CRTBEGIN=
+CRTEND=
+LINKS= ${BINDIR}/boot.lif ${BINDIR}/sdboot \
+ ${BINDIR}/boot.lif ${BINDIR}/stboot \
+ ${BINDIR}/boot.lif ${BINDIR}/xxboot
+
+LDADD= ${LIBSA} ${LIBZ} ${LIBKERN}
+DPADD= ${LIBSA} ${LIBZ} ${LIBKERN}
+
+.PATH: ${S}/stand/boot
+
+all: boot.lif
+
+realinstall:
+ ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ boot ${DESTDIR}${BINDIR}
+ ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ boot.lif ${DESTDIR}${BINDIR}
+
+.if exists(${.CURDIR}/../../compile/GENERIC/bsd)
+bsd: ${.CURDIR}/../../compile/GENERIC/bsd
+ gzip -9 -c ${.CURDIR}/../../compile/GENERIC/bsd > bsd
+ADDBOOT+=bsd
+.endif
+
+# probably we should check for 256k limit for ISL
+boot.lif: ${PROG} ${ADDBOOT}
+ -@cp ${PROG} ${PROG}.gdb
+ ${STRIP} ${PROG}
+ ${MKBOOT} -v ${PROG} ${ADDBOOT} boot.lif
+
+${PROG}: $(OBJS) $(DPADD)
+ $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD)
+ @${SIZE} $(PROG)
+.else
+NOPROG=
+.endif
+
+.include <bsd.prog.mk>
+
+CPPFLAGS+=${DEBUGFLAGS} -DRELOC=${LOADADDR} -DHEAP_LIMIT=${HEAP_LIMIT}
+CFLAGS+=$(SACFLAGS)
diff --git a/sys/arch/hppa64/stand/boot/boot.8 b/sys/arch/hppa64/stand/boot/boot.8
new file mode 100644
index 00000000000..4b52dabbe02
--- /dev/null
+++ b/sys/arch/hppa64/stand/boot/boot.8
@@ -0,0 +1,342 @@
+.\" $OpenBSD: boot.8,v 1.1 2005/04/01 10:40:48 mickey Exp $
+.\"
+.\" Copyright (c) 2002 Miodrag Vallat
+.\" Copyright (c) 1997-2005 Michael Shalayeff
+.\" 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 OR HIS RELATIVES 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 MIND, 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.
+.\"
+.\"
+.Dd March 16, 2005
+.Dt BOOT 8 hppa
+.Os
+.Sh NAME
+.Nm boot ,
+.Nm boot.conf
+.Nd
+hppa-specific bootstrap
+.Sh DESCRIPTION
+The main purpose of this program is to load the system kernel while dealing
+with the various features of the PA-RISC hardware.
+.Pp
+As described in
+.Xr boot_hppa 8 ,
+this program is loaded by the PDC firmware
+and provides a convenient way to load the kernel.
+.Pp
+Basic operations include:
+.Pp
+.Bl -bullet -compact
+.It
+Loading kernels from any device supported by your system.
+.It
+Loading kernels compressed by
+.Xr gzip 1 .
+.It
+Providing an interactive command line.
+.It
+Detecting and switching between multiple consoles.
+.El
+.Pp
+The sequence of its operation is as follows: initialization,
+parsing the configuration file, then an interactive command line.
+While at the command line you have 5 seconds to type any commands, if needed.
+If time expires, the kernel will be loaded according to
+the current variable settings (see the
+.Nm set
+command).
+Each time a kernel load fails, the timeout is increased by one second.
+The sequence of
+.Nm
+operations is as follows:
+.Bl -enum
+.It
+If the file
+.Pa /etc/boot.conf
+exists on the filesystem or LIF image
+.Nm
+was loaded from, open and parse it.
+This file may contain any commands
+.Nm
+accepts at the interactive prompt.
+Though default settings usually suffice, they can be changed here.
+.It
+The header line
+.Pp
+.Dl >> OpenBSD/hppa BOOT [x.xx]
+.Pp
+is displayed to the active console, where
+.Ar x.xx
+is the version number of the
+.Nm
+program, followed by the
+.Pp
+.Dl boot>
+.Pp
+prompt, which means you are in interactive mode and may enter commands.
+If you do not,
+.Nm
+will proceed to load the kernel with the current parameters after the
+timeout period has expired.
+.El
+.Pp
+By default,
+.Nm
+attempts to load the kernel executable
+.Pa /bsd .
+If that fails, it will attempt to load
+.Pa /obsd
+and then
+.Pa /bsd.old .
+If it fails to find any of these files,
+and no alternative kernel image has been specified,
+the system will be unable to boot.
+.Sh COMMANDS
+The following commands are accepted at the
+.Nm
+prompt:
+.Bl -tag -width shorten
+.It boot Op Ar image Op Fl acds
+Boots the kernel image specified by
+.Ar image
+with any options given.
+Image specification consists of a pair
+.Ar device : Ns Ar filename ;
+either or both can be omitted (`:' is not needed if both are omitted),
+in which case values from
+.Nm
+variables will be used.
+.Bl -tag -width _a_
+.It Fl a
+Causes the kernel to ask for the
+.Nm root
+device to use.
+.It Fl c
+Causes the kernel to go into
+.Xr boot_config 8
+before performing
+.Xr autoconf 4
+procedures.
+.It Fl d
+Causes the kernel to drop into
+.Xr ddb 4
+at the earliest convenient point.
+.It Fl s
+Causes the kernel to boot single-user.
+.El
+.It echo Op Ar args
+Displays
+.Ar args
+on the console device.
+.It help
+Prints a list of available commands and machine dependent
+commands, if any.
+.It machine Op Ar command
+Issues machine-dependent commands.
+These are defined for hppa architecture:
+.Bl -tag -width keyboard
+.It Nm console
+Displays or sets the console path.
+.Pp
+When invoked with no argument, this command will display the configured
+console path found in the stable storage area.
+.Pp
+Otherwise, the argument will be interpreted as a console path
+definition string, and
+.Nm
+will attempt to switch the console configuration to the desired device.
+The console definition attempts to follow the PDC syntax,
+and would have a form of:
+.Pp
+.Bd -filled -compact
+graphics
+.Op _head
+.Op .mode
+.Ed
+for graphics console, and
+.Pp
+.Bd -filled -compact
+rs232
+.Op _2
+.Op .speed Op .bits Op .parity
+.Ed
+for serial console.
+.Pp
+The default head and mode for graphics console are 0, that is the default
+videomode of the first graphics device.
+The default serial settings are 9600 bps, 8 data bits, and no parity.
+.It Nm keyboard
+Displays or sets the keyboard path.
+.Pp
+When invoked with no argument, this command will display the configured
+keyboard path found in the stable storage area.
+.Pp
+Otherwise, the argument will be interpreted as a keyboard path definition
+string, and
+.Nm
+will attempt to switch the keyboard configuration to the desired port.
+The keyboard definition attempts to follow the PDC syntax,
+and would have a form of:
+.Pp
+.Bd -filled -compact
+hil
+.Ed
+for hil keyboard, and
+.Pp
+.Bd -filled -compact
+ps2
+.Ed
+for PS/2 keyboard.
+.El
+.Pp
+After changing any path settings, the machine usually has to be restarted for
+the changes to have effect.
+.It ls Op Ar directory
+Prints contents of the specified
+.Ar directory
+in long format including: attributes and file type, owner, group,
+size, filename.
+.It reboot
+Reboots the machine by initiating a warm boot procedure.
+.It set Op Ar varname Op Ar value
+If invoked without arguments, prints a list of variables and their values.
+If only
+.Ar varname
+is specified, displays contents of that variable.
+If
+.Ar varname
+and
+.Ar value
+are both specified, sets that variable to the given value.
+Variables include:
+.Pp
+.Bl -tag -compact -width boothow
+.It Nm addr
+Address at which to load the kernel.
+.It Nm debug
+Debug flag if
+.Nm
+was compiled with DEBUG defined.
+.It Nm device
+Boot device name (i.e.,
+.Li lf0a ,
+.Li sd0a ) .
+.It Nm howto
+Options to pass to the loaded kernel.
+.It Nm image
+File name containing the kernel image.
+.It Nm timeout
+Number of seconds boot will wait for human intervention before
+booting the default kernel image.
+.\" .It Nm tty
+.\" Active console device name (i.e.,
+.\" .Li ttya ,
+.\" .Li ttyb ,
+.\" .Li ite0) .
+.El
+.\" .It stty Op Ar device Op Ar speed
+.\" Displays or sets the
+.\" .Ar speed
+.\" for a console
+.\" .Ar device .
+.\" If changing the baudrate for the currently active console,
+.\" .Nm
+.\" offers you five seconds of grace time before committing the change
+.\" to allow you to change your terminal's speed to match.
+.\" If changing speed
+.\" .Em not
+.\" for the active console, the baudrate is set for the
+.\" .Em next
+.\" time you switch to a serial console.
+.\" The baudrate value is not used for the
+.\" .Li ite0
+.\" console.
+.\" .Pp
+.\" The default baudrate is 9600bps.
+.It time
+Displays system time and date.
+.El
+.Sh FILES
+.Bl -tag -width /etc/boot.conf -compact
+.It Pa /boot
+system bootstrap
+.It Pa /etc/boot.conf
+system bootstrap's startup file
+.It Pa /bsd
+kernel image
+.El
+.Sh EXAMPLES
+Boot the default kernel:
+.Pp
+.Dl boot> boot
+.Pp
+Remove the 5 second pause at boot-time permanently, causing
+.Nm
+to load the kernel immediately without prompting:
+.Pp
+.Dl # echo \&"boot\&" > /etc/boot.conf
+.Pp
+Use serial console on the first serial port, with the usual 9600 8N1 settings.
+A null modem cable should connect the specified serial port to a terminal.
+Useful for debugging.
+.Pp
+.Dl boot> machine console rs232.9600.8.none
+.Pp
+Boot the kernel named
+.Pa /bsd
+from the second SCSI disk in
+.Dq User Kernel Configuration
+mode (see
+.Xr boot_config 8 ) .
+This mechanism allows for the explicit enabling and disabling of devices
+during the current boot sequence, as well as the modification
+of device parameters.
+Once booted, such changes can be made permanent by using
+.Xr config 8 Ns 's
+.Fl e
+option.
+.Pp
+.Dl boot> boot sd1a:/bsd -c
+.Sh SEE ALSO
+.Xr gzip 1 ,
+.Xr autoconf 4 ,
+.Xr ddb 4 ,
+.Xr boot_config 8 ,
+.Xr boot_hppa 8 ,
+.\" .Xr installboot 8 ,
+.Xr reboot 8
+.Pp
+RFC 1950 describes the zlib library interface.
+.Pp
+The official home page for the version of zlib used in this
+operating system see http://quest.jpl.nasa.gov/zlib/.
+.Sh HISTORY
+This program was written by Michael Shalayeff for
+.Ox 2.1 .
+The hppa specific parts were written by Michael Shalayeff and Miodrag Vallat
+for
+.Ox 3.1 .
+.Sh CAVEATS
+Making mistakes in console paths may cost you a toupee.
+.Sh BUGS
+Changing the display resolution (mode) on a graphics console does not work
+correctly.
diff --git a/sys/arch/hppa64/stand/boot/conf.c b/sys/arch/hppa64/stand/boot/conf.c
new file mode 100644
index 00000000000..91ecd77b2b1
--- /dev/null
+++ b/sys/arch/hppa64/stand/boot/conf.c
@@ -0,0 +1,51 @@
+/* $OpenBSD: conf.c,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2005 Michael Shalayeff
+ * All rights reserved.
+ *
+ * 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 MIND, 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.
+ */
+
+#include <sys/types.h>
+#include <libsa.h>
+#include <lib/libsa/ufs.h>
+#include <lib/libsa/cd9660.h>
+#include <dev/cons.h>
+
+const char version[] = "0.8";
+int debug = 0;
+
+struct fs_ops file_system[] = {
+ { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek,
+ ufs_stat, ufs_readdir },
+ { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
+ cd9660_stat, cd9660_readdir },
+ { lif_open, lif_close, lif_read, lif_write, lif_seek,
+ lif_stat, lif_readdir },
+};
+int nfsys = NENTS(file_system);
+
+struct devsw devsw[] = {
+ { "dk", iodcstrategy, dkopen, dkclose, noioctl },
+ { "ct", iodcstrategy, ctopen, ctclose, noioctl },
+ { "lf", iodcstrategy, lfopen, lfclose, noioctl }
+};
+int ndevs = NENTS(devsw);
+
+struct consdev constab[] = {
+ { ite_probe, ite_init, ite_getc, ite_putc },
+ { NULL }
+};
+struct consdev *cn_tab;
+
diff --git a/sys/arch/hppa64/stand/boot/exec.c b/sys/arch/hppa64/stand/boot/exec.c
new file mode 100644
index 00000000000..adc206b3a19
--- /dev/null
+++ b/sys/arch/hppa64/stand/boot/exec.c
@@ -0,0 +1,42 @@
+/* $OpenBSD: exec.c,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2005 Michael Shalayeff
+ * All rights reserved.
+ *
+ * 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 MIND, 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.
+ */
+
+#include <sys/param.h>
+#include <machine/pdc.h>
+#include "libsa.h"
+#include <lib/libsa/loadfile.h>
+#include <stand/boot/bootarg.h>
+#include "dev_hppa64.h"
+
+typedef void (*startfuncp)(int, int, int, int, int, int, caddr_t)
+ __attribute__ ((noreturn));
+
+void
+run_loadfile(u_long *marks, int howto)
+{
+ fcacheall();
+
+ __asm("mtctl %r0, %cr17");
+ __asm("mtctl %r0, %cr17");
+ /* stack and the gung is ok at this point, so, no need for asm setup */
+ (*(startfuncp)(marks[MARK_ENTRY]))((int)(long)(long)pdc, howto, bootdev,
+ marks[MARK_END], BOOTARG_APIVER, BOOTARG_LEN, (caddr_t)BOOTARG_OFF);
+
+ /* not reached */
+}
diff --git a/sys/arch/hppa64/stand/boot/ld.script b/sys/arch/hppa64/stand/boot/ld.script
new file mode 100644
index 00000000000..51aed14df19
--- /dev/null
+++ b/sys/arch/hppa64/stand/boot/ld.script
@@ -0,0 +1,61 @@
+/* $OpenBSD: ld.script,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
+
+OUTPUT_FORMAT("elf64-hppa")
+OUTPUT_ARCH(hppa2.0w)
+ENTRY(begin)
+
+SECTIONS {
+
+ /* Read-only sections, merged into text segment: */
+ . = + SIZEOF_HEADERS;
+ .text : {
+ *(.text)
+ *(.text.*)
+ *(.rodata)
+ *(.rodata1)
+ *($CODE$)
+ etext = .;
+ } = 0x08000240
+
+ /* Read-write sections, merged into data segment: */
+ .data : {
+ $global$ = .;
+ *(.data)
+ *(.data1)
+ *(.sdata)
+ *(.sdata2)
+ *(.dynamic)
+ CONSTRUCTORS
+ edata = ABSOLUTE(.);
+ } = 0
+
+ .opd : { *(.opd) }
+ PROVIDE(__gp = .);
+ .plt : { *(.plt) }
+ .dlt : { *(.dlt) }
+
+ .bss : {
+ __bss_start = .;
+ *(.dynbss)
+ *(.bss)
+ *(.sbss)
+ *(.scommon)
+ *(COMMON)
+ end = ABSOLUTE(.);
+ __bss_end = .;
+ }
+
+ /* don't need an unwind in the boot, unless we'll have a boot-ddb (; */
+ /DISCARD/ :
+ {
+ *(.PARISC.unwind)
+ *(.exitcall.exit)
+ *(.interp)
+ *(.dynsym)
+ *(.dynstr)
+ *(.dynamic)
+ *(.hash)
+ *(.stub)
+ }
+}
+
diff --git a/sys/arch/hppa64/stand/boot/srt0.S b/sys/arch/hppa64/stand/boot/srt0.S
new file mode 100644
index 00000000000..99498dbf970
--- /dev/null
+++ b/sys/arch/hppa64/stand/boot/srt0.S
@@ -0,0 +1,181 @@
+/* $OpenBSD: srt0.S,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2005 Michael Shalayeff
+ * All rights reserved.
+ *
+ * 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 MIND, 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.
+ */
+/*
+ * Copyright 1996 1995 by Open Software Foundation, Inc.
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both the copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+;
+; Copyright (c) 1990 mt Xinu, Inc. All rights reserved.
+; Copyright (c) 1990 University of Utah. All rights reserved.
+;
+; This file may be freely distributed in any form as long as
+; this copyright notice is included.
+; THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+; IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+; WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+;
+; Utah $Hdr: srt0.c 1.3 94/12/13$
+;
+
+#define _LOCORE
+#include <machine/iomod.h>
+#include <machine/asm.h>
+#include <machine/frame.h>
+
+/*
+ * This is the ending of the begin
+ */
+ENTRY(begin,0)
+
+ blr %r0,%r5 ; Get address of 'boff' into 'r5',
+ ldo begin-boff(%r5),%r5 ; and subtract to get 'begin'.
+boff
+ ldil L%RELOC,%r4
+ ldo R%RELOC(%r4),%r4
+ ldo start-begin(%r4),%rp
+ ldil L%edata,%r3
+ ldo R%edata(%r3),%r3 ; Get address of edata.
+ ldil L%begin,%r1
+ ldo R%begin(%r1),%r1 ; Get address of begin
+ sub %r3,%r1,%r3 ; Subtract to get # of bytes to copy
+copyloop ; do
+ ldwm 4(%r5),%r1 ; *r4++ = *r5++;
+ addib,>= -4,%r3,copyloop ; while (--r3 >= 0);
+ stwm %r1,4(%r4)
+
+ ; here we zero the .bss
+ ldil L%__bss_start, %r4
+ ldo R%__bss_start(%r4), %r4
+ ldil L%__bss_end, %r3
+ ldo R%__bss_end(%r3), %r3
+zeroloop
+ combf,<,n %r3,%r4, zeroloop ; while (r4 < r3);
+ stwm %r0,4(%r4) ; *r4++ = 0;
+
+ ldil L%$global$,%dp
+ ldo R%$global$(%dp),%dp
+ ldil L%start,%r1
+ ldo R%start(%r1),%r1
+ sub %dp,%r1,%dp ; Subtract to get difference
+ add %rp,%dp,%dp ; and relocate it.
+
+;
+; We have relocated ourself to RELOC. If we are running on a machine
+; with separate instruction and data caches, we must flush our data
+; cache before trying to execute the code starting at rp.
+;
+ ldil L%RELOC,%r22 ; Set %t1 to start of relocated code.
+ ldo R%RELOC(%r22),%r22
+ ldil L%edata,%r21 ; Set r21 to address of edata
+ ldo R%edata(%r21),%r21
+ ldil L%begin,%r1 ; set %r1 to address of begin
+ ldo R%begin(%r1),%r1
+ sub %r21,%r1,%r21 ; Subtract to get length
+ mtsp %r0,%sr0 ; Set sr0 to kernel space.
+ ldo -1(%r21),%r21
+ fdc %r21(0,%r22)
+loop addib,>,n -16,%r21,loop ; Decrement by cache line size (16).
+ fdc %r21(%sr0,%r22)
+ fdc 0(%sr0,%r22) ; Flush first word at addr to handle
+ sync ; arbitrary cache line boundary.
+ nop ; Prevent prefetching.
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ bv 0(%rp)
+ nop
+EXIT(begin) /* jump to relocated code */
+
+start
+ ldil L%HEAP_LIMIT, %sp
+ ldo R%HEAP_LIMIT(%sp), %sp
+
+ .import bootprompt, data
+ ldil L%bootprompt, %r1
+ stw %arg0, R%bootprompt(%r1)
+ b boot ; Call boot(),
+ copy %r0, %arg0 ; use default boot device
+ nop
+
+/*
+ * rtt - restart the box
+ */
+LEAF_ENTRY(_rtt)
+ ldil L%LBCAST_ADDR, %arg1
+ ldi CMD_RESET, %arg0
+ stw %arg0, R%iomod_command(%arg1)
+forever ; Loop until bus reset takes effect.
+ b,n forever
+
+ bv 0(%rp)
+ ldo -48(%sp),%sp
+EXIT(_rtt)
+
+ENTRY(pdc_call,96)
+ copy %r3, %r1
+ std %rp, HPPA_FRAME_RP(%sp)
+ copy %sp, %r3
+ std,ma %r1, HPPA_FRAME_SIZE+8*4(%sp)
+
+ copy %arg0, %r1
+ copy %arg1, %arg0
+ copy %arg2, %arg1
+ copy %arg3, %arg2
+ copy arg4, %arg3
+ stw arg5, -(32 + 4*(4 + 1))(%sp)
+ stw arg6, -(32 + 4*(5 + 1))(%sp)
+ stw arg7, -(32 + 4*(6 + 1))(%sp)
+ ldw 0(ap), arg5
+ ldw 8(ap), arg6
+ ldw 16(ap), arg7
+ stw arg5, -(32 + 4*(7 + 1))(%sp)
+ stw arg6, -(32 + 4*(8 + 1))(%sp)
+ stw arg7, -(32 + 4*(9 + 1))(%sp)
+
+ .call
+ blr %r0, %rp
+ bv,n %r0(%r1)
+ nop
+
+ ldd HPPA_FRAME_RP(%r3), %rp
+ bv %r0(%rp)
+ ldd,mb -(HPPA_FRAME_SIZE+8*4)(%sp), %r3
+EXIT(pdc_call)
+
+ .end