Update amiga booter to two-stage booter.
First stage is bootxx_ffs (for ffs boot partitions) or bootxx_fd (for bootable floppy disk). These locate, load, and execute the second stage loader boot.amiga. The console screen is created and passed to the second stage loader. The second stage loader uses loadfile() to load the kernel image, which can be either a.out or ELF format, and can also be compressed. It will load a kernel file from ffs file systems or the ustarfs used on floppy disks.
This commit is contained in:
parent
c7af981281
commit
e1d8eca622
|
@ -1,43 +1,61 @@
|
||||||
# $NetBSD: Makefile,v 1.23 2001/12/10 05:31:39 mhitch Exp $
|
# $NetBSD: Makefile,v 1.24 2001/12/17 05:41:12 mhitch Exp $
|
||||||
|
|
||||||
### what we need:
|
### what we need:
|
||||||
|
|
||||||
DIR_TOP= ${.CURDIR}/../../../../..
|
DIR_TOP= ${.CURDIR}/../../../../..
|
||||||
DIR_SA = ${DIR_TOP}/lib/libsa
|
DIR_SA = ${DIR_TOP}/lib/libsa
|
||||||
|
DIR_LIBZ = ${DIR_TOP}/lib/libz
|
||||||
DIR_KERN= ${DIR_TOP}/lib/libkern
|
DIR_KERN= ${DIR_TOP}/lib/libkern
|
||||||
DIR_KERN_MD= ${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH)
|
DIR_KERN_MD= ${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH)
|
||||||
|
|
||||||
.PATH: $(DIR_SA) $(DIR_KERN) $(DIR_KERN_MD)
|
.PATH: $(DIR_SA) ${DIR_LIBZ} $(DIR_KERN) $(DIR_KERN_MD)
|
||||||
|
|
||||||
# prefer our assembler versions over assembler, and assembler over C:
|
# prefer our assembler versions over assembler, and assembler over C:
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .out .o .po .so .s .S .c .cc .C .f .y .l .ln .m4 .sh
|
.SUFFIXES: .out .o .po .so .s .S .c .cc .C .f .y .l .ln .m4 .sh
|
||||||
|
|
||||||
FILES= xxboot fdboot
|
FILES= boot.amiga
|
||||||
BINDIR=/usr/mdec
|
BINDIR=/usr/mdec
|
||||||
|
|
||||||
COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
|
COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
|
||||||
COBJS+= lseek.o open.o read.o close.o dev.o errno.o
|
COBJS+= lseek.o open.o read.o close.o dev.o errno.o
|
||||||
COBJS+= ufs.o
|
COBJS+= ufs.o ustarfs.o panic.o vers.o
|
||||||
|
|
||||||
SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o
|
SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o
|
||||||
SOBJS += strlen.o strcmp.o
|
SOBJS += strlen.o strcmp.o memcmp.o strerror.o sprintf.o subr_prf.o
|
||||||
SOBJS += libstubs.o
|
SOBJS += libstubs.o memset.o strncmp.o
|
||||||
|
|
||||||
OBJS= $(SOBJS) $(COBJS)
|
OBJS= $(SOBJS) $(COBJS)
|
||||||
|
|
||||||
DEFS = -D_STANDALONE -DINSECURE
|
DEFS = -D_STANDALONE -DINSECURE
|
||||||
|
DEFS += -D__INTERNAL_LIBSA_CREAD
|
||||||
|
SOBJS += cread.o
|
||||||
|
SOBJS += crc32.o inflate.o adler32.o infblock.o infcodes.o inftrees.o # XXX need libz!!!
|
||||||
|
SOBJS += inffast.o infutil.o
|
||||||
|
#DEFS += -DBOOT_ELF -DBOOT_AOUT
|
||||||
|
SOBJS += loadfile.o loadfile_aout.o loadfile_elf32.o
|
||||||
|
|
||||||
|
NETBSD_VERS!= sh ${.CURDIR}/../../../../../conf/osrelease.sh
|
||||||
|
DEFS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
|
||||||
|
|
||||||
### main target: ###
|
### main target: ###
|
||||||
|
|
||||||
realall: ${FILES}
|
realall: machine m68k ${FILES}
|
||||||
|
|
||||||
|
# Copy boot.amiga to / as well.
|
||||||
|
afterinstall:
|
||||||
|
cp -p ${DESTDIR}${BINDIR}/boot.amiga ${DESTDIR}/
|
||||||
|
|
||||||
|
CLEANFILES += boot.amiga x.out xxstart.o libboot.a vers.c machine m68k
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
||||||
### special rules for bootblocks ###
|
### special rules for bootblocks ###
|
||||||
|
|
||||||
INCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../aout2bb -I${DESTDIR}/usr/include
|
INCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa -I${.CURDIR}
|
||||||
|
INCPATH += -I${.CURDIR}/../../.. -I${.OBJDIR}
|
||||||
|
INCPATH += -I${.CURDIR}/../aout2bb -I${DESTDIR}/usr/include
|
||||||
|
|
||||||
AFLAGS += -m68030 -l
|
AFLAGS += -m68030 -l
|
||||||
CAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH}
|
CAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH}
|
||||||
|
@ -54,36 +72,34 @@ CFLAGS= ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes
|
||||||
|
|
||||||
.S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
|
.S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
|
||||||
|
|
||||||
CLEANFILES += xxboot fdboot x.out f.out xxstart.o fdstart.o libboot.a
|
boot.amiga: x.out
|
||||||
|
${RELOC2BB} -S 32768 x.out $@ || ${NM} -u x.out
|
||||||
xxboot: x.out
|
|
||||||
${AOUT2BB} x.out $@ || ${NM} -u x.out
|
|
||||||
|
|
||||||
fdboot: f.out
|
|
||||||
${AOUT2BB} f.out $@ || ${NM} -u f.out
|
|
||||||
|
|
||||||
x.out: xxstart.o libboot.a
|
x.out: xxstart.o libboot.a
|
||||||
${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
|
${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
|
||||||
${SIZE} $@
|
${SIZE} $@
|
||||||
${NM} -u $@
|
${NM} -u $@
|
||||||
|
|
||||||
f.out: fdstart.o libboot.a
|
|
||||||
${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
|
|
||||||
${SIZE} $@
|
|
||||||
${NM} -u $@
|
|
||||||
|
|
||||||
xxstart.o: ${.CURDIR}/bbstart.s
|
xxstart.o: ${.CURDIR}/bbstart.s
|
||||||
${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
|
${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
|
||||||
-o $@ -c $>
|
-o $@ -c $>
|
||||||
|
|
||||||
fdstart.o: ${.CURDIR}/bbstart.s
|
|
||||||
${CC} -DAUTOLOAD=8192 ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
|
|
||||||
-o $@ -c $>
|
|
||||||
|
|
||||||
libboot.a: ${OBJS}
|
libboot.a: ${OBJS}
|
||||||
${AR} r $@ $> && ${RANLIB} $@
|
${AR} r $@ $> && ${RANLIB} $@
|
||||||
|
|
||||||
|
.PHONY: vers.c
|
||||||
|
vers.c: ${.CURDIR}/version
|
||||||
|
sh ${DIR_TOP}/conf/newvers_stand.sh -N ${.CURDIR}/version "amiga"
|
||||||
|
|
||||||
|
machine:
|
||||||
|
-rm -f $@
|
||||||
|
ln -s ${DIR_TOP}/arch/amiga/include $@
|
||||||
|
|
||||||
|
m68k:
|
||||||
|
-rm -f $@
|
||||||
|
ln -s ${DIR_TOP}/arch/m68k/include $@
|
||||||
|
|
||||||
# make sure these are built:
|
# make sure these are built:
|
||||||
|
|
||||||
${COBJS}: ${TXLT}
|
${COBJS}: ${TXLT}
|
||||||
${FILES}: ${AOUT2BB}
|
${FILES}: ${RELOC2BB}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: bbstart.s,v 1.9 2001/09/24 20:27:08 is Exp $ */
|
/* $NetBSD: bbstart.s,v 1.10 2001/12/17 05:41:12 mhitch Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
@ -52,7 +52,11 @@
|
||||||
#define Cmd_Rd 2
|
#define Cmd_Rd 2
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
#if defined(_PRIMARY_BOOT) || defined(AUTOLOAD)
|
||||||
Lzero: .asciz "DOS" | "DOS type"
|
Lzero: .asciz "DOS" | "DOS type"
|
||||||
|
#else
|
||||||
|
Lzero: .ascii "BOOT" | Secondary Boot
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* We put the relocator version here, for aout2bb, which replaces
|
* We put the relocator version here, for aout2bb, which replaces
|
||||||
* it with the bootblock checksum.
|
* it with the bootblock checksum.
|
||||||
|
@ -175,8 +179,16 @@ Lendtab:
|
||||||
|
|
||||||
movl %a6,_C_LABEL(SysBase)
|
movl %a6,_C_LABEL(SysBase)
|
||||||
|
|
||||||
|
#ifndef _PRIMARY_BOOT
|
||||||
|
movl %a5,%sp@- | Console info
|
||||||
|
#endif
|
||||||
movl %a1,%sp@-
|
movl %a1,%sp@-
|
||||||
bsr _C_LABEL(pain)
|
bsr _C_LABEL(pain)
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
addql #4,%sp
|
||||||
|
#else
|
||||||
|
addql #8,%sp
|
||||||
|
#endif
|
||||||
|
|
||||||
Lerr:
|
Lerr:
|
||||||
movq #1,%d0
|
movq #1,%d0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: console.c,v 1.3 1999/02/16 23:34:11 is Exp $ */
|
/* $NetBSD: console.c,v 1.4 2001/12/17 05:41:12 mhitch Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
@ -66,68 +66,81 @@ u_int32_t windowtags[] = {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AmigaIO *cnior;
|
struct Console {
|
||||||
struct TimerIO *tmior;
|
int magic;
|
||||||
struct MsgPort *cnmp;
|
struct AmigaIO *cnior;
|
||||||
|
struct TimerIO *tmior;
|
||||||
|
struct MsgPort *cnmp;
|
||||||
|
struct Screen *s;
|
||||||
|
struct Window *w;
|
||||||
|
} *ConsoleBase;
|
||||||
|
static struct Console myConsole;
|
||||||
|
|
||||||
u_int16_t timelimit;
|
u_int16_t timelimit;
|
||||||
|
|
||||||
int
|
int
|
||||||
consinit() {
|
consinit(void *consptr) {
|
||||||
struct Screen *s = 0;
|
struct Console *mc;
|
||||||
struct Window *w = 0;
|
|
||||||
|
|
||||||
|
if (consptr != NULL) {
|
||||||
|
/* Check magic? */
|
||||||
|
ConsoleBase = consptr; /* Use existing console */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
mc = &myConsole;
|
||||||
IntuitionBase = OpenLibrary("intuition.library", 36L);
|
IntuitionBase = OpenLibrary("intuition.library", 36L);
|
||||||
if (IntuitionBase == 0)
|
if (IntuitionBase == 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
s = OpenScreenTagList(0, screentags);
|
mc->s = OpenScreenTagList(0, screentags);
|
||||||
if (!s)
|
if (!mc->s)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
windowtags[1] = (u_int32_t)s;
|
windowtags[1] = (u_int32_t)mc->s;
|
||||||
w = OpenWindowTagList(0, windowtags);
|
mc->w = OpenWindowTagList(0, windowtags);
|
||||||
if (!w)
|
if (!mc->w)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
cnmp = CreateMsgPort();
|
mc->cnmp = CreateMsgPort();
|
||||||
|
|
||||||
if (!cnmp)
|
if (!mc->cnmp)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
cnior = (struct AmigaIO *)CreateIORequest(cnmp, sizeof(struct AmigaIO));
|
mc->cnior = (struct AmigaIO *)CreateIORequest(mc->cnmp, sizeof(struct AmigaIO));
|
||||||
if (!cnior)
|
if (!mc->cnior)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
cnior->buf = (void *)w;
|
mc->cnior->buf = (void *)mc->w;
|
||||||
if (OpenDevice("console.device", 0, cnior, 0))
|
if (OpenDevice("console.device", 0, mc->cnior, 0))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
tmior = (struct TimerIO *)CreateIORequest(cnmp, sizeof(struct TimerIO));
|
mc->tmior = (struct TimerIO *)CreateIORequest(mc->cnmp, sizeof(struct TimerIO));
|
||||||
if (!tmior)
|
if (!mc->tmior)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (OpenDevice("timer.device", 0, (struct AmigaIO*)tmior, 0))
|
if (OpenDevice("timer.device", 0, (struct AmigaIO*)mc->tmior, 0))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
ConsoleBase = mc;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
if (tmior)
|
if (mc->tmior)
|
||||||
DeleteIORequest(tmior);
|
DeleteIORequest(mc->tmior);
|
||||||
|
|
||||||
if (cnior)
|
if (mc->cnior)
|
||||||
DeleteIORequest(cnior);
|
DeleteIORequest(mc->cnior);
|
||||||
|
|
||||||
if (cnmp)
|
if (mc->cnmp)
|
||||||
DeleteMsgPort(cnmp);
|
DeleteMsgPort(mc->cnmp);
|
||||||
|
|
||||||
if (w)
|
if (mc->w)
|
||||||
CloseWindow(w);
|
CloseWindow(mc->w);
|
||||||
|
|
||||||
if (s)
|
if (mc->s)
|
||||||
CloseScreen(s);
|
CloseScreen(mc->s);
|
||||||
if (IntuitionBase)
|
if (IntuitionBase)
|
||||||
CloseLibrary(IntuitionBase);
|
CloseLibrary(IntuitionBase);
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,24 +148,61 @@ err:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
int
|
||||||
|
consclose()
|
||||||
|
{
|
||||||
|
struct Console *mc = ConsoleBase;
|
||||||
|
|
||||||
|
if (mc == NULL)
|
||||||
|
return 0;
|
||||||
|
if (mc->tmior) {
|
||||||
|
CloseDevice((struct AmigaIO *)mc->tmior);
|
||||||
|
DeleteIORequest(mc->tmior);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mc->cnior) {
|
||||||
|
CloseDevice(mc->cnior);
|
||||||
|
DeleteIORequest(mc->cnior);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mc->cnmp)
|
||||||
|
DeleteMsgPort(mc->cnmp);
|
||||||
|
|
||||||
|
if (mc->w)
|
||||||
|
CloseWindow(mc->w);
|
||||||
|
|
||||||
|
if (mc->s)
|
||||||
|
CloseScreen(mc->s);
|
||||||
|
if (IntuitionBase)
|
||||||
|
CloseLibrary(IntuitionBase);
|
||||||
|
ConsoleBase = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
putchar(c)
|
putchar(c)
|
||||||
char c;
|
char c;
|
||||||
{
|
{
|
||||||
cnior->length = 1;
|
struct Console *mc = ConsoleBase;
|
||||||
cnior->buf = &c;
|
|
||||||
cnior->cmd = Cmd_Wr;
|
mc->cnior->length = 1;
|
||||||
(void)DoIO(cnior);
|
mc->cnior->buf = &c;
|
||||||
|
mc->cnior->cmd = Cmd_Wr;
|
||||||
|
(void)DoIO(mc->cnior);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
puts(s)
|
puts(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
cnior->length = -1;
|
struct Console *mc = ConsoleBase;
|
||||||
cnior->buf = s;
|
|
||||||
cnior->cmd = Cmd_Wr;
|
mc->cnior->length = -1;
|
||||||
(void)DoIO(cnior);
|
mc->cnior->buf = s;
|
||||||
|
mc->cnior->cmd = Cmd_Wr;
|
||||||
|
(void)DoIO(mc->cnior);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -160,29 +210,30 @@ getchar()
|
||||||
{
|
{
|
||||||
struct AmigaIO *ior;
|
struct AmigaIO *ior;
|
||||||
char c = -1;
|
char c = -1;
|
||||||
|
struct Console *mc = ConsoleBase;
|
||||||
|
|
||||||
cnior->length = 1;
|
mc->cnior->length = 1;
|
||||||
cnior->buf = &c;
|
mc->cnior->buf = &c;
|
||||||
cnior->cmd = Cmd_Rd;
|
mc->cnior->cmd = Cmd_Rd;
|
||||||
|
|
||||||
SendIO(cnior);
|
SendIO(mc->cnior);
|
||||||
|
|
||||||
if (timelimit) {
|
if (timelimit) {
|
||||||
tmior->cmd = Cmd_Addtimereq;
|
mc->tmior->cmd = Cmd_Addtimereq;
|
||||||
tmior->secs = timelimit;
|
mc->tmior->secs = timelimit;
|
||||||
tmior->usec = 2; /* Paranoid */
|
mc->tmior->usec = 2; /* Paranoid */
|
||||||
SendIO((struct AmigaIO *)tmior);
|
SendIO((struct AmigaIO *)mc->tmior);
|
||||||
|
|
||||||
ior = WaitPort(cnmp);
|
ior = WaitPort(mc->cnmp);
|
||||||
if (ior == cnior)
|
if (ior == mc->cnior)
|
||||||
AbortIO((struct AmigaIO *)tmior);
|
AbortIO((struct AmigaIO *)mc->tmior);
|
||||||
else /* if (ior == tmior) */ {
|
else /* if (ior == mc->tmior) */ {
|
||||||
AbortIO(cnior);
|
AbortIO(mc->cnior);
|
||||||
c = '\n';
|
c = '\n';
|
||||||
}
|
}
|
||||||
WaitIO((struct AmigaIO *)tmior);
|
WaitIO((struct AmigaIO *)mc->tmior);
|
||||||
timelimit = 0;
|
timelimit = 0;
|
||||||
}
|
}
|
||||||
(void)WaitIO(cnior);
|
(void)WaitIO(mc->cnior);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: libstubs.h,v 1.3 1999/02/16 23:34:11 is Exp $ */
|
/* $NetBSD: libstubs.h,v 1.4 2001/12/17 05:41:12 mhitch Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
@ -63,6 +63,9 @@ void AbortIO(struct AmigaIO *);
|
||||||
u_int8_t WaitIO(struct AmigaIO *);
|
u_int8_t WaitIO(struct AmigaIO *);
|
||||||
|
|
||||||
int OpenDevice(const char *, u_int32_t, struct AmigaIO *, u_int32_t);
|
int OpenDevice(const char *, u_int32_t, struct AmigaIO *, u_int32_t);
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
void CloseDevice(struct AmigaIO *);
|
||||||
|
#endif
|
||||||
|
|
||||||
void *FindResident(const char *);
|
void *FindResident(const char *);
|
||||||
void *OpenResource(const char *);
|
void *OpenResource(const char *);
|
||||||
|
@ -79,6 +82,10 @@ struct Screen *OpenScreenTagList(struct NewScreen *, const u_int32_t *);
|
||||||
struct Screen *OpenScreenTag(struct NewScreen *, ...);
|
struct Screen *OpenScreenTag(struct NewScreen *, ...);
|
||||||
struct Window *OpenWindowTagList(struct Window *, const u_int32_t *);
|
struct Window *OpenWindowTagList(struct Window *, const u_int32_t *);
|
||||||
struct Window *OpenWindowTag(struct Window *, ...);
|
struct Window *OpenWindowTag(struct Window *, ...);
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
void CloseScreen(struct Screen *);
|
||||||
|
void CloseWindow(struct Window *);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef nomore
|
#ifdef nomore
|
||||||
u_int32_t mytime(void);
|
u_int32_t mytime(void);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: libstubs.s,v 1.7 2001/03/11 20:15:02 mhitch Exp $ */
|
/* $NetBSD: libstubs.s,v 1.8 2001/12/17 05:41:13 mhitch Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
@ -51,7 +51,8 @@ ENTRY_NOPROFILE(OpenLibrary)
|
||||||
movl %sp@+,%a6
|
movl %sp@+,%a6
|
||||||
movl %d0,%a0 | Comply with ELF ABI
|
movl %d0,%a0 | Comply with ELF ABI
|
||||||
rts
|
rts
|
||||||
#ifdef notyet
|
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
ENTRY_NOPROFILE(CloseLibrary)
|
ENTRY_NOPROFILE(CloseLibrary)
|
||||||
movl %a6,%sp@-
|
movl %a6,%sp@-
|
||||||
movl %pc@(_C_LABEL(SysBase):w),%a6
|
movl %pc@(_C_LABEL(SysBase):w),%a6
|
||||||
|
@ -78,7 +79,7 @@ ENTRY_NOPROFILE(CreateMsgPort)
|
||||||
movl %d0,%a0 | Comply with ELF ABI
|
movl %d0,%a0 | Comply with ELF ABI
|
||||||
rts
|
rts
|
||||||
|
|
||||||
#ifdef notyet
|
#ifdef _PRIMARY_BOOT
|
||||||
ENTRY_NOPROFILE(DeleteMsgPort)
|
ENTRY_NOPROFILE(DeleteMsgPort)
|
||||||
movl %a6,%sp@-
|
movl %a6,%sp@-
|
||||||
movl %pc@(_C_LABEL(SysBase):w),%a6
|
movl %pc@(_C_LABEL(SysBase):w),%a6
|
||||||
|
@ -107,6 +108,16 @@ ENTRY_NOPROFILE(OpenDevice)
|
||||||
movl %sp@+,%a6
|
movl %sp@+,%a6
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
ENTRY_NOPROFILE(CloseDevice)
|
||||||
|
movl %a6,%sp@-
|
||||||
|
movl %pc@(_C_LABEL(SysBase):w),%a6
|
||||||
|
movl %sp@(8),%a1
|
||||||
|
jsr %a6@(-0x1c2)
|
||||||
|
movl %sp@+,%a6
|
||||||
|
rts
|
||||||
|
#endif
|
||||||
|
|
||||||
ENTRY_NOPROFILE(DoIO)
|
ENTRY_NOPROFILE(DoIO)
|
||||||
movl %a6,%sp@-
|
movl %a6,%sp@-
|
||||||
movl %pc@(_C_LABEL(SysBase):w),%a6
|
movl %pc@(_C_LABEL(SysBase):w),%a6
|
||||||
|
@ -224,6 +235,16 @@ ENTRY_NOPROFILE(OpenScreenTagList)
|
||||||
movl %d0,%a0 | Comply with ELF ABI
|
movl %d0,%a0 | Comply with ELF ABI
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
ENTRY_NOPROFILE(CloseScreen)
|
||||||
|
movl %a6,%sp@-
|
||||||
|
movl %pc@(_C_LABEL(IntuitionBase):w),%a6
|
||||||
|
movl %sp@(8),%a0
|
||||||
|
jsr %a6@(-0x42)
|
||||||
|
movl %sp@+,%a6
|
||||||
|
rts
|
||||||
|
#endif
|
||||||
|
|
||||||
ENTRY_NOPROFILE(OpenWindowTagList)
|
ENTRY_NOPROFILE(OpenWindowTagList)
|
||||||
movl %a6,%sp@-
|
movl %a6,%sp@-
|
||||||
movl %pc@(_C_LABEL(IntuitionBase):w),%a6
|
movl %pc@(_C_LABEL(IntuitionBase):w),%a6
|
||||||
|
@ -233,6 +254,16 @@ ENTRY_NOPROFILE(OpenWindowTagList)
|
||||||
movl %sp@+,%a6
|
movl %sp@+,%a6
|
||||||
movl %d0,%a0 | Comply with ELF ABI
|
movl %d0,%a0 | Comply with ELF ABI
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
ENTRY_NOPROFILE(CloseWindow)
|
||||||
|
movl %a6,%sp@-
|
||||||
|
movl %pc@(_C_LABEL(IntuitionBase):w),%a6
|
||||||
|
movl %sp@(8),%a0
|
||||||
|
jsr %a6@(-0x48)
|
||||||
|
movl %sp@+,%a6
|
||||||
|
rts
|
||||||
|
#endif
|
||||||
#ifdef nomore
|
#ifdef nomore
|
||||||
ENTRY_NOPROFILE(mytime)
|
ENTRY_NOPROFILE(mytime)
|
||||||
movl %a6,%sp@-
|
movl %a6,%sp@-
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $NetBSD: main.c,v 1.13 2001/09/24 20:27:08 is Exp $
|
* $NetBSD: main.c,v 1.14 2001/12/17 05:41:13 mhitch Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Copyright (c) 1996,1999 Ignatios Souvatzis
|
* Copyright (c) 1996,1999 Ignatios Souvatzis
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
#include "libstubs.h"
|
#include "libstubs.h"
|
||||||
#include "samachdep.h"
|
#include "samachdep.h"
|
||||||
|
#include "loadfile.h"
|
||||||
|
|
||||||
#undef __LDPGSZ
|
#undef __LDPGSZ
|
||||||
#define __LDPGSZ 8192
|
#define __LDPGSZ 8192
|
||||||
|
@ -60,6 +61,13 @@
|
||||||
|
|
||||||
#define EXECMIN 36
|
#define EXECMIN 36
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vers.c (generated by newvers.sh)
|
||||||
|
*/
|
||||||
|
extern const char bootprog_rev[];
|
||||||
|
extern const char bootprog_date[];
|
||||||
|
extern const char bootprog_maker[];
|
||||||
|
|
||||||
void startit __P((void *, u_long, u_long, void *, u_long, u_long, int, void *,
|
void startit __P((void *, u_long, u_long, void *, u_long, u_long, int, void *,
|
||||||
int, int, u_long, u_long, u_long, int));
|
int, int, u_long, u_long, u_long, int));
|
||||||
int get_cpuid __P((u_int32_t *));
|
int get_cpuid __P((u_int32_t *));
|
||||||
|
@ -83,15 +91,13 @@ void startit_end __P((void));
|
||||||
|
|
||||||
static long get_number(char **);
|
static long get_number(char **);
|
||||||
|
|
||||||
#define VERSION "2.4"
|
|
||||||
|
|
||||||
extern char default_command[];
|
extern char default_command[];
|
||||||
|
|
||||||
int
|
int
|
||||||
pain(aio)
|
pain(aio, cons)
|
||||||
void *aio;
|
void *aio;
|
||||||
|
void *cons;
|
||||||
{
|
{
|
||||||
long int io = 0;
|
|
||||||
char linebuf[128];
|
char linebuf[128];
|
||||||
char *kernel_name = default_command;
|
char *kernel_name = default_command;
|
||||||
char *path = default_command;
|
char *path = default_command;
|
||||||
|
@ -104,7 +110,6 @@ pain(aio)
|
||||||
int m_value = 0;
|
int m_value = 0;
|
||||||
int S_flag = 0;
|
int S_flag = 0;
|
||||||
int t_flag = 0;
|
int t_flag = 0;
|
||||||
long stringsz;
|
|
||||||
|
|
||||||
u_int32_t fmem = 0x0;
|
u_int32_t fmem = 0x0;
|
||||||
int fmemsz = 0x0;
|
int fmemsz = 0x0;
|
||||||
|
@ -117,8 +122,7 @@ pain(aio)
|
||||||
|
|
||||||
caddr_t kp;
|
caddr_t kp;
|
||||||
u_int16_t *kvers;
|
u_int16_t *kvers;
|
||||||
struct exec ehs;
|
int ksize;
|
||||||
int textsz, ksize;
|
|
||||||
void *esym = 0;
|
void *esym = 0;
|
||||||
int32_t *nkcd;
|
int32_t *nkcd;
|
||||||
struct cfdev *cd, *kcd;
|
struct cfdev *cd, *kcd;
|
||||||
|
@ -131,13 +135,15 @@ pain(aio)
|
||||||
int ncd, nseg;
|
int ncd, nseg;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
|
u_long marks[MARK_MAX];
|
||||||
|
|
||||||
extern u_int16_t timelimit;
|
extern u_int16_t timelimit;
|
||||||
|
|
||||||
extern u_int32_t aio_base;
|
extern u_int32_t aio_base;
|
||||||
|
|
||||||
xdinit(aio);
|
xdinit(aio);
|
||||||
|
|
||||||
if (consinit())
|
if (consinit(cons))
|
||||||
return(1);
|
return(1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -150,15 +156,23 @@ pain(aio)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PPCBOOTER
|
/*
|
||||||
printf("\2337mNetBSD/AmigaPPC bootblock " VERSION "\2330m\n%s :- ",
|
* XXX Do this differently; default boot will attempt to load a list of
|
||||||
kernel_name);
|
* XXX kernels until one of them succeeds.
|
||||||
#else
|
*/
|
||||||
printf("\2337mNetBSD/Amiga bootblock " VERSION "\2330m\n%s :- ",
|
|
||||||
kernel_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
timelimit = 3;
|
timelimit = 3;
|
||||||
|
again:
|
||||||
|
#ifdef PPCBOOTER
|
||||||
|
printf("\nNetBSD/AmigaPPC " NETBSD_VERS " Bootstrap, Revision %s\n",
|
||||||
|
bootprog_rev);
|
||||||
|
#else
|
||||||
|
printf("\nNetBSD/Amiga " NETBSD_VERS " Bootstrap, Revision %s\n",
|
||||||
|
bootprog_rev);
|
||||||
|
#endif
|
||||||
|
printf("(%s, %s)\n", bootprog_maker, bootprog_date);
|
||||||
|
printf("\n");
|
||||||
|
printf("Boot: [%s] ", kernel_name);
|
||||||
|
|
||||||
gets(linebuf);
|
gets(linebuf);
|
||||||
|
|
||||||
if (*linebuf == 'q')
|
if (*linebuf == 'q')
|
||||||
|
@ -227,6 +241,7 @@ pain(aio)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* XXX Handle kernel_name differently */
|
||||||
kernel_name = path;
|
kernel_name = path;
|
||||||
while ((c = *++path) && c != ' ')
|
while ((c = *++path) && c != ' ')
|
||||||
;
|
;
|
||||||
|
@ -234,6 +249,7 @@ pain(aio)
|
||||||
*path++ = 0;
|
*path++ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* XXX Handle kernel_name differently */
|
||||||
while ((c = *kernel_name) && c == ' ')
|
while ((c = *kernel_name) && c == ' ')
|
||||||
++kernel_name;
|
++kernel_name;
|
||||||
path = kernel_name;
|
path = kernel_name;
|
||||||
|
@ -338,40 +354,23 @@ pain(aio)
|
||||||
if (m_value && m_value < fmemsz)
|
if (m_value && m_value < fmemsz)
|
||||||
fmemsz = m_value;
|
fmemsz = m_value;
|
||||||
|
|
||||||
|
/* XXX Loop through list of kernels */
|
||||||
printf("Loading %s: ", kernel_name);
|
printf("Loading %s: ", kernel_name);
|
||||||
io = open(kernel_name, 0);
|
/*
|
||||||
if (io < 0)
|
* XXX Call loadfile with COUNT* options to get size
|
||||||
goto err;
|
* XXX Allocate memory for kernel + additional data
|
||||||
|
* XXX Call loadfile with LOAD* options to load text/data/symbols
|
||||||
if (read(io, &ehs, sizeof(ehs)) != sizeof(ehs)) {
|
*/
|
||||||
errno = ENOEXEC;
|
marks[MARK_START] = 0;
|
||||||
|
if (loadfile(kernel_name, marks,
|
||||||
|
COUNT_TEXT|COUNT_TEXTA|COUNT_DATA|COUNT_BSS |
|
||||||
|
(S_flag ? (COUNT_SYM|COUNT_HDR) : 0)) == -1) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
ksize = ((marks[MARK_END] + 3) & ~3)
|
||||||
#ifdef PPCBOOTER
|
|
||||||
/* XXX to be done */
|
|
||||||
#else
|
|
||||||
if ((N_GETMAGIC(ehs) != NMAGIC) || (N_GETMID(ehs) != MID_M68K)) {
|
|
||||||
errno = ENOEXEC;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
textsz = (ehs.a_text + __LDPGSZ - 1) & (-__LDPGSZ);
|
|
||||||
esym = 0;
|
|
||||||
|
|
||||||
ksize = textsz + ehs.a_data + ehs.a_bss
|
|
||||||
+ sizeof(*nkcd) + ncd*sizeof(*cd)
|
+ sizeof(*nkcd) + ncd*sizeof(*cd)
|
||||||
+ sizeof(*nkcd) + nseg * sizeof(struct boot_memseg);
|
+ sizeof(*nkcd) + nseg * sizeof(struct boot_memseg);
|
||||||
|
|
||||||
if (S_flag && ehs.a_syms) {
|
|
||||||
if (lseek(io, ehs.a_text+ ehs.a_data+ ehs.a_syms, SEEK_CUR)
|
|
||||||
<= 0
|
|
||||||
|| read(io, &stringsz, 4) != 4
|
|
||||||
|| lseek(io, sizeof(ehs), SEEK_SET) < 0)
|
|
||||||
goto err;
|
|
||||||
ksize += ehs.a_syms + 4 + ((stringsz + 3) & ~3);
|
|
||||||
}
|
|
||||||
#ifdef PPCBOOTER
|
#ifdef PPCBOOTER
|
||||||
kp = alloc(ksize);
|
kp = alloc(ksize);
|
||||||
#else
|
#else
|
||||||
|
@ -382,19 +381,19 @@ pain(aio)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%ld", ehs.a_text);
|
marks[MARK_START] = (u_long)kp;
|
||||||
if (ehs.a_text && (read(io, kp, ehs.a_text) != ehs.a_text))
|
if (loadfile(kernel_name, marks,
|
||||||
|
LOAD_TEXT|LOAD_TEXTA|LOAD_DATA|LOAD_BSS|
|
||||||
|
(S_flag ? (LOAD_SYM|LOAD_HDR) : 0)) == -1) {
|
||||||
|
printf("Kernel load failed\n");
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
printf("+%ld", ehs.a_data);
|
marks[MARK_END] = (marks[MARK_END] + 3) & ~3;
|
||||||
if (ehs.a_data && (read(io, kp + textsz, ehs.a_data) != ehs.a_data))
|
nkcd = (int *)marks[MARK_END];
|
||||||
goto err;
|
if (S_flag)
|
||||||
|
esym = (void*)(marks[MARK_END] - marks[MARK_START]);
|
||||||
printf("+%ld", ehs.a_bss);
|
/* #ifndef PPCBOOTER*/
|
||||||
|
kvers = (u_short *)(marks[MARK_ENTRY] - 2);
|
||||||
nkcd = (int *)(kp + textsz + ehs.a_data + ehs.a_bss);
|
|
||||||
#ifndef PPCBOOTER
|
|
||||||
kvers = (u_short *)(kp + ehs.a_entry - 2);
|
|
||||||
|
|
||||||
if (*kvers > KERNEL_STARTUP_VERSION_MAX && *kvers != 0x4e73) {
|
if (*kvers > KERNEL_STARTUP_VERSION_MAX && *kvers != 0x4e73) {
|
||||||
printf("\nnewer bootblock required: %ld\n", (long)*kvers);
|
printf("\nnewer bootblock required: %ld\n", (long)*kvers);
|
||||||
|
@ -409,20 +408,14 @@ pain(aio)
|
||||||
printf("\nKernel V%ld newer than bootblock V%ld\n",
|
printf("\nKernel V%ld newer than bootblock V%ld\n",
|
||||||
(long)*kvers, (long)KERNEL_STARTUP_VERSION);
|
(long)*kvers, (long)KERNEL_STARTUP_VERSION);
|
||||||
#endif
|
#endif
|
||||||
if (*kvers != 0x4e73 && *kvers > 1 && S_flag && ehs.a_syms) {
|
if (marks[MARK_NSYM] && (*kvers == 0x4e73 || *kvers <= 1)) {
|
||||||
*nkcd++ = ehs.a_syms;
|
nkcd = (int *)marks[MARK_SYM];
|
||||||
printf("+[%ld", ehs.a_syms);
|
esym = 0;
|
||||||
if (read(io, (char *)nkcd, ehs.a_syms) != ehs.a_syms)
|
printf("Supressing %ld kernel symbols\n", marks[MARK_NSYM]);
|
||||||
goto err;
|
timelimit = 60;
|
||||||
nkcd = (int *)((char *)nkcd + ehs.a_syms);
|
(void)getchar();
|
||||||
printf("+%ld]", stringsz);
|
}
|
||||||
if (read(io, (char *)nkcd, stringsz) != stringsz)
|
/* version checks */
|
||||||
goto err;
|
|
||||||
nkcd = (int*)((char *)nkcd + ((stringsz + 3) & ~3));
|
|
||||||
esym = (char *)(textsz + ehs.a_data + ehs.a_bss
|
|
||||||
+ ehs.a_syms + 4 + ((stringsz + 3) & ~3));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
*nkcd = ncd;
|
*nkcd = ncd;
|
||||||
|
@ -470,10 +463,12 @@ pain(aio)
|
||||||
"fmem=0x%lx, fmemsz=%ld, cmemsz=%ld\n"
|
"fmem=0x%lx, fmemsz=%ld, cmemsz=%ld\n"
|
||||||
"boothow=0x%lx, esym=0x%lx, cpuid=0x%lx, eclock=%ld\n"
|
"boothow=0x%lx, esym=0x%lx, cpuid=0x%lx, eclock=%ld\n"
|
||||||
"amigaflags=0x%lx, I_flags=0x%lx, ok?\n",
|
"amigaflags=0x%lx, I_flags=0x%lx, ok?\n",
|
||||||
(u_long)kp, (u_long)ksize, ehs.a_entry,
|
(u_long)kp, (u_long)ksize, marks[MARK_ENTRY] - marks[MARK_START],
|
||||||
(u_long)fmem, (u_long)fmemsz, (u_long)cmemsz,
|
(u_long)fmem, (u_long)fmemsz, (u_long)cmemsz,
|
||||||
(u_long)boothowto, (u_long)esym, (u_long)cpuid, (u_long)eclock,
|
(u_long)boothowto, (u_long)esym, (u_long)cpuid, (u_long)eclock,
|
||||||
(u_long)amiga_flags, (u_long)I_flag);
|
(u_long)amiga_flags, (u_long)I_flag);
|
||||||
|
timelimit = 60;
|
||||||
|
(void)getchar();
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG_MEMORY_LIST
|
#ifdef DEBUG_MEMORY_LIST
|
||||||
timelimit = 0;
|
timelimit = 0;
|
||||||
|
@ -487,7 +482,7 @@ pain(aio)
|
||||||
#else
|
#else
|
||||||
start_it
|
start_it
|
||||||
#endif
|
#endif
|
||||||
(kp, ksize, ehs.a_entry, (void *)fmem, fmemsz, cmemsz,
|
(kp, ksize, marks[MARK_ENTRY] - marks[MARK_START], (void *)fmem, fmemsz, cmemsz,
|
||||||
boothowto, esym, cpuid, eclock, amiga_flags, I_flag,
|
boothowto, esym, cpuid, eclock, amiga_flags, I_flag,
|
||||||
aio_base >> 9, 1);
|
aio_base >> 9, 1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
@ -496,7 +491,7 @@ freeall:
|
||||||
free(kp, ksize);
|
free(kp, ksize);
|
||||||
err:
|
err:
|
||||||
printf("\nError %ld\n", (long)errno);
|
printf("\nError %ld\n", (long)errno);
|
||||||
close(io);
|
goto again;
|
||||||
out:
|
out:
|
||||||
timelimit = 10;
|
timelimit = 10;
|
||||||
(void)getchar();
|
(void)getchar();
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/* $NetBSD: panic.c,v 1.1 2001/12/17 05:41:13 mhitch Exp $ */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to The NetBSD Foundation
|
||||||
|
* by Michael Hitch.
|
||||||
|
*
|
||||||
|
* 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 by the NetBSD
|
||||||
|
* Foundation, Inc. and its contributors.
|
||||||
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A dummy panic() to reduce size of bootblock.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
panic(char *p)
|
||||||
|
{
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: samachdep.h,v 1.4 1999/02/16 23:34:11 is Exp $ */
|
/* $NetBSD: samachdep.h,v 1.5 2001/12/17 05:41:13 mhitch Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
@ -42,11 +42,15 @@
|
||||||
/* "hardware" init: */
|
/* "hardware" init: */
|
||||||
|
|
||||||
int configure(void *);
|
int configure(void *);
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
int pain(void *);
|
int pain(void *);
|
||||||
|
#else
|
||||||
|
int pain(void *, void *);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* console functions not declared MI: */
|
/* console functions not declared MI: */
|
||||||
|
|
||||||
int consinit(void);
|
int consinit(void *);
|
||||||
void puts(char *);
|
void puts(char *);
|
||||||
|
|
||||||
void xdinit(void *);
|
void xdinit(void *);
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
$NetBSD: version,v 1.1 2001/12/17 05:41:13 mhitch Exp $
|
||||||
|
|
||||||
|
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
|
||||||
|
file is important - make sure the entries are appended on end, last item
|
||||||
|
is taken as the current.
|
||||||
|
|
||||||
|
1.0: ???
|
||||||
|
2.0: Initial amiga bootblocks
|
||||||
|
2.1: Simplify program structure to save space
|
||||||
|
2.2: Initial PPC kernel booting support
|
||||||
|
2.3: ???
|
||||||
|
2.4: Moved default command into fixed location for easy patching
|
||||||
|
3.0: Initial 2 stage amiga bootblocks
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $NetBSD: xd.c,v 1.3 1997/02/01 01:46:28 mhitch Exp $
|
* $NetBSD: xd.c,v 1.4 2001/12/17 05:41:13 mhitch Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1996 Ignatios Souvatzis.
|
* Copyright (c) 1996 Ignatios Souvatzis.
|
||||||
* Copyright (c) 1995 Waldi Ravens.
|
* Copyright (c) 1995 Waldi Ravens.
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
#include <stand.h>
|
#include <stand.h>
|
||||||
#include <ufs.h>
|
#include <ufs.h>
|
||||||
|
#include <ustarfs.h>
|
||||||
|
|
||||||
#include "samachdep.h"
|
#include "samachdep.h"
|
||||||
#include "amigaio.h"
|
#include "amigaio.h"
|
||||||
|
@ -54,6 +54,8 @@ static struct devsw devsw[] = {
|
||||||
|
|
||||||
struct fs_ops file_system[] = {
|
struct fs_ops file_system[] = {
|
||||||
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
|
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
|
||||||
|
{ ustarfs_open, ustarfs_close, ustarfs_read, ustarfs_write, ustarfs_seek,
|
||||||
|
ustarfs_stat },
|
||||||
};
|
};
|
||||||
|
|
||||||
int nfsys = sizeof(file_system)/sizeof(struct fs_ops);
|
int nfsys = sizeof(file_system)/sizeof(struct fs_ops);
|
||||||
|
@ -116,7 +118,7 @@ xdstrategy (devd, flag, dblk, size, buf, rsize)
|
||||||
DoIO(aio);
|
DoIO(aio);
|
||||||
|
|
||||||
#ifdef XDDEBUG
|
#ifdef XDDEBUG
|
||||||
printf("strategy got err %ld, rsize %ld\n", aio->err, aio->actual);
|
printf("strategy got err %ld, rsize %ld\n", (long)aio->err, (long)aio->actual);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (aio->err) {
|
if (aio->err) {
|
||||||
|
@ -135,6 +137,7 @@ static int
|
||||||
xdopenclose(f)
|
xdopenclose(f)
|
||||||
struct open_file *f;
|
struct open_file *f;
|
||||||
{
|
{
|
||||||
|
aio_save->offset = aio_base; /* Restore original offset */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,3 +149,11 @@ xdioctl (f, cmd, data)
|
||||||
{
|
{
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _PRIMARY_BOOT
|
||||||
|
void
|
||||||
|
xdreset()
|
||||||
|
{
|
||||||
|
aio_save->offset = aio_base; /* Restore original offset */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
# $NetBSD: Makefile,v 1.1 2001/12/17 05:40:40 mhitch Exp $
|
||||||
|
|
||||||
|
### what we need:
|
||||||
|
|
||||||
|
DIR_TOP= ${.CURDIR}/../../../../..
|
||||||
|
DIR_SA = ${DIR_TOP}/lib/libsa
|
||||||
|
DIR_KERN= ${DIR_TOP}/lib/libkern
|
||||||
|
DIR_KERN_MD= ${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH)
|
||||||
|
|
||||||
|
.PATH: ${.CURDIR}/../boot $(DIR_SA) $(DIR_KERN) $(DIR_KERN_MD)
|
||||||
|
|
||||||
|
# prefer our assembler versions over assembler, and assembler over C:
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .out .o .po .so .s .S .c .cc .C .f .y .l .ln .m4 .sh
|
||||||
|
|
||||||
|
FILES= bootxx_ffs bootxx_fd
|
||||||
|
BINDIR=/usr/mdec
|
||||||
|
|
||||||
|
COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
|
||||||
|
COBJS+= lseek.o open.o read.o close.o dev.o errno.o
|
||||||
|
COBJS+= ufs.o ustarfs.o panic.o vers.o
|
||||||
|
|
||||||
|
SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o
|
||||||
|
SOBJS += strlen.o strcmp.o fstat.o
|
||||||
|
SOBJS += libstubs.o memset.o strncmp.o
|
||||||
|
|
||||||
|
OBJS= $(SOBJS) $(COBJS)
|
||||||
|
|
||||||
|
DEFS = -D_STANDALONE -DINSECURE -D_PRIMARY_BOOT
|
||||||
|
|
||||||
|
.NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o
|
||||||
|
|
||||||
|
### main target: ###
|
||||||
|
|
||||||
|
realall: machine m68k ${FILES}
|
||||||
|
|
||||||
|
CLEANFILES += bootxx_ffs bootxx_fd x.out f.out xxstart.o fdstart.o libboot.a vers.c machine m68k
|
||||||
|
|
||||||
|
.include <bsd.prog.mk>
|
||||||
|
|
||||||
|
### special rules for bootblocks ###
|
||||||
|
|
||||||
|
INCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa -I${.CURDIR}
|
||||||
|
INCPATH += -I${.CURDIR}/../boot -I${.CURDIR}/../../..
|
||||||
|
INCPATH += -I${.CURDIR}/../aout2bb -I$(.CURDIR) -I${DESTDIR}/usr/include
|
||||||
|
|
||||||
|
AFLAGS += -m68030 -l
|
||||||
|
CAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH} -D_PRIMARY_BOOT
|
||||||
|
|
||||||
|
COPTIM= -O -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks -Wa,-l -m68060 -Wa,-m68030
|
||||||
|
CFLAGS= ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes
|
||||||
|
|
||||||
|
NETBSD_VERS!= sh ${.CURDIR}/../../../../../conf/osrelease.sh
|
||||||
|
DEFS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
${CC} ${CFLAGS} -S $< -o $*.s
|
||||||
|
${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o
|
||||||
|
rm $*.s
|
||||||
|
|
||||||
|
.s.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
|
||||||
|
|
||||||
|
.S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
|
||||||
|
|
||||||
|
bootxx_ffs: x.out
|
||||||
|
${RELOC2BB} x.out $@ || ${NM} -u x.out
|
||||||
|
|
||||||
|
bootxx_fd: f.out
|
||||||
|
${RELOC2BB} -F f.out $@ || ${NM} -u f.out
|
||||||
|
|
||||||
|
x.out: xxstart.o libboot.a
|
||||||
|
${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
|
||||||
|
${SIZE} $@
|
||||||
|
${NM} -u $@
|
||||||
|
|
||||||
|
f.out: fdstart.o libboot.a
|
||||||
|
${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
|
||||||
|
${SIZE} $@
|
||||||
|
${NM} -u $@
|
||||||
|
|
||||||
|
xxstart.o: ${.CURDIR}/../boot/bbstart.s
|
||||||
|
${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
|
||||||
|
-o $@ -c $>
|
||||||
|
|
||||||
|
fdstart.o: ${.CURDIR}/../boot//bbstart.s
|
||||||
|
${CC} -DAUTOLOAD=8192 ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
|
||||||
|
-o $@ -c $>
|
||||||
|
|
||||||
|
libboot.a: ${OBJS}
|
||||||
|
${AR} r $@ $> && ${RANLIB} $@
|
||||||
|
|
||||||
|
.PHONY: vers.c
|
||||||
|
vers.c: ${.CURDIR}/../boot/version
|
||||||
|
sh ${DIR_TOP}/conf/newvers_stand.sh -NDM ${.CURDIR}/../boot/version "amiga"
|
||||||
|
|
||||||
|
machine:
|
||||||
|
-rm -f $@
|
||||||
|
ln -s ${DIR_TOP}/arch/amiga/include $@
|
||||||
|
|
||||||
|
m68k:
|
||||||
|
-rm -f $@
|
||||||
|
ln -s ${DIR_TOP}/arch/m68k/include $@
|
||||||
|
|
||||||
|
# make sure these are built:
|
||||||
|
|
||||||
|
${COBJS}: ${TXLT}
|
||||||
|
${FILES}: ${RELOC2BB}
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
* $NetBSD: main.c,v 1.1 2001/12/17 05:40:40 mhitch Exp $
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 1996,1999 Ignatios Souvatzis
|
||||||
|
* Copyright (c) 1994 Michael L. Hitch
|
||||||
|
* 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 by Michael L. Hitch.
|
||||||
|
* 4. The name of the authors 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 <sys/cdefs.h>
|
||||||
|
#include <sys/reboot.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/exec_aout.h>
|
||||||
|
|
||||||
|
#include <amiga/cfdev.h>
|
||||||
|
#include <amiga/memlist.h>
|
||||||
|
#include <include/cpu.h>
|
||||||
|
|
||||||
|
#include <saerrno.h>
|
||||||
|
#include <stand.h>
|
||||||
|
|
||||||
|
#include "libstubs.h"
|
||||||
|
#include "samachdep.h"
|
||||||
|
|
||||||
|
#undef __LDPGSZ
|
||||||
|
#define __LDPGSZ 8192
|
||||||
|
#define __PGSZ 8192
|
||||||
|
|
||||||
|
#define DRACOREVISION (*(u_int8_t *)0x02000009)
|
||||||
|
#define DRACOMMUMARGIN 0x200000
|
||||||
|
#define DRACOZ2OFFSET 0x3000000
|
||||||
|
#define DRACOZ2MAX 0x1000000
|
||||||
|
|
||||||
|
#define EXECMIN 36
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vers.c (generated by newvers.sh)
|
||||||
|
*/
|
||||||
|
extern const char bootprog_rev[];
|
||||||
|
|
||||||
|
void startit __P((void *, void *, void *));
|
||||||
|
|
||||||
|
int consclose(void);
|
||||||
|
|
||||||
|
extern void *ConsoleBase;
|
||||||
|
|
||||||
|
int
|
||||||
|
pain(aio)
|
||||||
|
void *aio;
|
||||||
|
{
|
||||||
|
long int io = 0;
|
||||||
|
caddr_t kp;
|
||||||
|
int ksize;
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
extern u_int16_t timelimit;
|
||||||
|
|
||||||
|
xdinit(aio);
|
||||||
|
|
||||||
|
if (consinit(NULL)) /* Initialize fresh console */
|
||||||
|
return(1);
|
||||||
|
|
||||||
|
#ifdef PPCBOOTER
|
||||||
|
printf("NetBSD/AmigaPPC " NETBSD_VERS " Primary Bootstrap %s\n", bootprog_rev);
|
||||||
|
#else
|
||||||
|
printf("NetBSD/Amiga " NETBSD_VERS " Primary Bootstrap %s\n", bootprog_rev);
|
||||||
|
#endif
|
||||||
|
io = open("/boot.amiga", 0); /* Try /boot.amiga first */
|
||||||
|
if (io < 0) {
|
||||||
|
io = open("/boot", 0); /* Fallback to /boot */
|
||||||
|
if (io < 0) {
|
||||||
|
io = open("/boot.ami", 0); /* 8.3 name? */
|
||||||
|
if (io < 0) {
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get size of file? */
|
||||||
|
if (fstat(io, &sb))
|
||||||
|
goto err;
|
||||||
|
/* allocate memory for file */
|
||||||
|
ksize = sb.st_size;
|
||||||
|
if (ksize == 0) {
|
||||||
|
printf("Bad size, using 32K\n"); /* XXX debug? */
|
||||||
|
ksize = 32 * 1024;
|
||||||
|
}
|
||||||
|
kp = alloc(ksize);
|
||||||
|
if (kp == 0) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
/* read file into memory */
|
||||||
|
if (read(io, kp, ksize) != ksize) {
|
||||||
|
errno = ENOEXEC;
|
||||||
|
goto freeall;
|
||||||
|
}
|
||||||
|
/* validate boot: DOS\0 and checksum? */
|
||||||
|
if (strcmp(kp, "DOS") != 0 &&
|
||||||
|
(*(u_int32_t *)kp) != 0x424f4f54) {
|
||||||
|
errno = ENOEXEC;
|
||||||
|
goto freeall;
|
||||||
|
}
|
||||||
|
/* call boot+12(aio, sysbase); */
|
||||||
|
close(io);
|
||||||
|
startit(kp, aio, ConsoleBase);
|
||||||
|
errno = -1;
|
||||||
|
|
||||||
|
freeall:
|
||||||
|
free(kp, ksize);
|
||||||
|
err:
|
||||||
|
printf("Error %ld\n", (long)errno);
|
||||||
|
close(io);
|
||||||
|
|
||||||
|
timelimit = 10;
|
||||||
|
(void)getchar();
|
||||||
|
consclose();
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/* $NetBSD: startit.s,v 1.1 2001/12/17 05:40:40 mhitch Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1996 Ignatios Souvatzis
|
||||||
|
* Copyright (c) 1994 Michael L. Hitch
|
||||||
|
* 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 by Michael L. Hitch.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* From: $NetBSD: startit.s,v 1.1 2001/12/17 05:40:40 mhitch Exp $
|
||||||
|
*/
|
||||||
|
#include "machine/asm.h"
|
||||||
|
|
||||||
|
.set ABSEXECBASE,4
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
ENTRY_NOPROFILE(startit)
|
||||||
|
movel 4:w,%a6 | SysBase
|
||||||
|
movel %sp@(4),%a0 | Boot loader address
|
||||||
|
movel %sp@(8),%a1 | IOR
|
||||||
|
movel %sp@(12),%a5 | Console data
|
||||||
|
jsr %a0@(12)
|
||||||
|
rts
|
Loading…
Reference in New Issue