make boot blocks work on AlphaStation systems

This commit is contained in:
cgd 1995-06-28 00:58:44 +00:00
parent beabc1186a
commit f9e02471d0
7 changed files with 38 additions and 59 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.3 1995/02/27 16:36:46 cgd Exp $
# $NetBSD: Makefile,v 1.4 1995/06/28 00:58:44 cgd Exp $
#
# BSD Boot blocks for the Alpha
#
@ -15,7 +15,7 @@ RELOC2= fffffc0000230000
# Compiler and assembler flags used to generate boot blocks.
#
DEFS= -DSMALL -DSTANDALONE
DEFS= -DSTANDALONE
AFLAGS+=-DASSEMBLER ${INCPATH}
CFLAGS= -mno-fp-regs ${INCPATH} ${DEFS}

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.2 1995/02/16 02:32:53 cgd Exp $ */
/* $NetBSD: boot.c,v 1.3 1995/06/28 00:58:48 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@ -46,7 +46,7 @@
#include <machine/prom.h>
#include "../../include/coff.h"
#define KERNEL
#define _KERNEL
#include "../../include/pte.h"
static int aout_exec __P((int, struct exec *, u_int64_t *));
@ -135,9 +135,7 @@ main(argc, argv, envp)
} else
(void)printf("Boot: %s %s\n", boot_file, boot_flags);
reset_twiddle();
if (!loadfile(boot_file, &entry)) {
reset_twiddle();
printf("calling %lx with %lx, %lx, %lx, %lx, %lx\n", entry,
ffp_save, ptbr_save, KERNEL_ARGC, kernel_argv, NULL);
@ -169,14 +167,12 @@ loadfile(fname, entryp)
/* Open the file. */
rval = 1;
if ((fd = open(fname, 0)) < 0) {
reset_twiddle();
(void)printf("open error: %d\n", errno);
goto err;
}
/* Read the exec header. */
if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) {
reset_twiddle();
(void)printf("read error: %d\n", errno);
goto err;
}
@ -187,8 +183,6 @@ loadfile(fname, entryp)
coff_exec(fd, &hdr.coff, entryp);
err:
reset_twiddle();
#ifndef SMALL
if (fd >= 0)
(void)close(fd);
@ -208,7 +202,6 @@ aout_exec(fd, aout, entryp)
/* Check the magic number. */
if (N_GETMAGIC(*aout) != OMAGIC) {
reset_twiddle();
(void)printf("bad magic: %o\n", N_GETMAGIC(*aout));
return (1);
}
@ -216,19 +209,15 @@ aout_exec(fd, aout, entryp)
/* Read in text, data. */
(void)printf("%lu+%lu", aout->a_text, aout->a_data);
if (lseek(fd, (off_t)N_TXTOFF(*aout), SEEK_SET) < 0) {
reset_twiddle();
(void)printf("lseek: %d\n", errno);
return (1);
}
sz = aout->a_text + aout->a_data;
if (read(fd, aout->a_entry, sz) != sz) {
reset_twiddle();
if (read(fd, (void *)aout->a_entry, sz) != sz) {
(void)printf("read text/data: %d\n", errno);
return (1);
}
reset_twiddle();
/* Zero out bss. */
if (aout->a_bss != 0) {
(void)printf("+%lu", aout->a_bss);
@ -252,28 +241,24 @@ coff_exec(fd, coff, entryp)
{
/* Read in text. */
reset_twiddle();
(void)printf("%lu", coff->a.tsize);
(void)lseek(fd, N_COFFTXTOFF(coff->f, coff->a), 0);
if (read(fd, coff->a.text_start, coff->a.tsize) != coff->a.tsize) {
reset_twiddle();
if (read(fd, (void *)coff->a.text_start, coff->a.tsize) !=
coff->a.tsize) {
(void)printf("read text: %d\n", errno);
return (1);
}
/* Read in data. */
if (coff->a.dsize != 0) {
reset_twiddle();
(void)printf("+%lu", coff->a.dsize);
if (read(fd,
coff->a.data_start, coff->a.dsize) != coff->a.dsize) {
reset_twiddle();
if (read(fd, (void *)coff->a.data_start, coff->a.dsize) !=
coff->a.dsize) {
(void)printf("read data: %d\n", errno);
return (1);
}
}
reset_twiddle();
/* Zero out bss. */
if (coff->a.bsize != 0) {
@ -293,25 +278,3 @@ coff_exec(fd, coff, entryp)
*entryp = coff->a.entry;
return (0);
}
static int tw_on;
static int tw_pos;
static char tw_chars[] = "|/-\\";
reset_twiddle()
{
if (tw_on)
putchar('\b');
tw_on = 0;
tw_pos = 0;
}
twiddle()
{
if (tw_on)
putchar('\b');
else
tw_on = 1;
putchar(tw_chars[tw_pos++]);
tw_pos %= (sizeof(tw_chars) - 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: prom.c,v 1.2 1995/02/16 02:32:56 cgd Exp $ */
/* $NetBSD: prom.c,v 1.3 1995/06/28 00:58:49 cgd Exp $ */
/*
* Mach Operating System
@ -88,15 +88,21 @@ void
putchar(c)
int c;
{
prom_return_t ret;
char cbuf;
if (c == '\r' || c == '\n') {
cbuf = '\r';
prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
do {
ret.bits = prom_dispatch(PROM_R_PUTS, console,
&cbuf, 1);
} while ((ret.u.retval & 1) == 0);
cbuf = '\n';
} else
cbuf = c;
prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
do {
ret.bits = prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
} while ((ret.u.retval & 1) == 0);
}
int

View File

@ -1,4 +1,5 @@
$NetBSD: version,v 1.2 1995/02/16 02:33:01 cgd Exp $
$NetBSD: version,v 1.3 1995/06/28 00:58:52 cgd Exp $
1.1: Initial version
1.2: don't forget the Id string!
1.3: make it work on AlphaStations

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.2 1995/02/16 02:33:08 cgd Exp $ */
/* $NetBSD: boot.c,v 1.3 1995/06/28 00:58:58 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@ -126,6 +126,10 @@ coff_exec(fd, coff)
ffp_save += 2; /* XXX OSF/1 does this, no idea why. */
#endif
{
extern int diskdev;
prom_close(diskdev);
}
(*(void (*)())coff->a.entry)();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disk.c,v 1.2 1995/02/16 02:33:09 cgd Exp $ */
/* $NetBSD: disk.c,v 1.3 1995/06/28 00:59:02 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@ -86,6 +86,8 @@ diskstrategy(devdata, rw, bn, reqcnt, addr, cnt)
return (0);
}
int diskdev;
static inline int
diskopen(f, ctlr, unit, part)
struct open_file *f;
@ -111,15 +113,13 @@ diskopen(f, ctlr, unit, part)
devlen = ret.u.retval;
ret.bits = prom_open(devname, devlen);
if (ret.u.status == 2)
return (ENXIO);
if (ret.u.status == 3)
if (ret.u.status)
return (EIO);
sc = alloc(sizeof(struct disk_softc));
f->f_devdata = (void *)sc;
sc->sc_fd = ret.u.retval;
diskdev = sc->sc_fd = ret.u.retval;
#if 0
sc->sc_ctlr = ctlr;
sc->sc_unit = unit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: prom.c,v 1.2 1995/02/16 02:33:11 cgd Exp $ */
/* $NetBSD: prom.c,v 1.3 1995/06/28 00:59:04 cgd Exp $ */
/*
* Mach Operating System
@ -67,11 +67,16 @@ putchar(c)
if (c == '\r' || c == '\n') {
cbuf = '\r';
prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
do {
ret.bits = prom_dispatch(PROM_R_PUTS, console,
&cbuf, 1);
} while ((ret.u.retval & 1) == 0);
cbuf = '\n';
} else
cbuf = c;
prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
do {
ret.bits = prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
} while ((ret.u.retval & 1) == 0);
}
void