summaryrefslogtreecommitdiffstats
path: root/sys/boot/alpha
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1998-09-26 10:51:38 +0000
committerdfr <dfr@FreeBSD.org>1998-09-26 10:51:38 +0000
commitad6ddb77671a5780eefdb973075656e601890d74 (patch)
tree7ee815e87abf339583a4b840f14159bc49a21714 /sys/boot/alpha
parent236ad5eb3ca90664e90a383de91faa975d35b8fc (diff)
downloadFreeBSD-src-ad6ddb77671a5780eefdb973075656e601890d74.zip
FreeBSD-src-ad6ddb77671a5780eefdb973075656e601890d74.tar.gz
* Add old UFS compatibility code to alpha/boot1.
* Fix a raft of warnings, printf and otherwise. * Allocate the correct amount in mod_searchmodule to prevent an overflow. * Fix the makefiles so they work outside my home directory (oops).
Diffstat (limited to 'sys/boot/alpha')
-rw-r--r--sys/boot/alpha/Makefile.inc5
-rw-r--r--sys/boot/alpha/boot1/Makefile3
-rw-r--r--sys/boot/alpha/boot1/boot1.c4
-rw-r--r--sys/boot/alpha/boot1/sys.c47
-rw-r--r--sys/boot/alpha/boot2/Makefile5
-rw-r--r--sys/boot/alpha/common/main.c4
-rw-r--r--sys/boot/alpha/libalpha/Makefile7
-rw-r--r--sys/boot/alpha/libalpha/devicename.c11
-rw-r--r--sys/boot/alpha/libalpha/libalpha.h4
-rw-r--r--sys/boot/alpha/netboot/Makefile5
10 files changed, 66 insertions, 29 deletions
diff --git a/sys/boot/alpha/Makefile.inc b/sys/boot/alpha/Makefile.inc
index 2d5f87d..bbbea75 100644
--- a/sys/boot/alpha/Makefile.inc
+++ b/sys/boot/alpha/Makefile.inc
@@ -2,6 +2,9 @@
PRIMARY_LOAD_ADDRESS= 20000000 # "Region 1 start"
SECONDARY_LOAD_ADDRESS= 2000c000 # "Region 1 start" + 48k
HEAP_LIMIT= 20040000 # "Region 1 start" + 256k
-DPADD+= ${DESTDIR}/${LIBDIR}/libstand.a
+DPADD+= ${DESTDIR}/${LIBDIR}/libstand.a
+LIBSTANDDIR= ${.CURDIR}/../../../../lib/libstand
+LIBSTAND= -lstand
+LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a
BINDIR= /usr/mdec
diff --git a/sys/boot/alpha/boot1/Makefile b/sys/boot/alpha/boot1/Makefile
index 9eb9186..24cca02 100644
--- a/sys/boot/alpha/boot1/Makefile
+++ b/sys/boot/alpha/boot1/Makefile
@@ -10,10 +10,7 @@ PROG = boot1
SRCS= start.S boot1.c sys.c
CFLAGS+= -mno-fp-regs
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
-LIBSTANDDIR= /home/dfr/FreeBSD/alpha/src/lib/libstand
-LIBSTAND= -lstand
CFLAGS+= -I${LIBSTANDDIR}
-LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a
CFLAGS+= -I${.CURDIR}/..
CFLAGS+= -DSECONDARY_LOAD_ADDRESS=0x${SECONDARY_LOAD_ADDRESS} -DMINIMAL
NOMAN=1
diff --git a/sys/boot/alpha/boot1/boot1.c b/sys/boot/alpha/boot1/boot1.c
index e52987a..a3fbfc2 100644
--- a/sys/boot/alpha/boot1/boot1.c
+++ b/sys/boot/alpha/boot1/boot1.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: boot1.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $
* From $NetBSD: bootxx.c,v 1.4 1997/09/06 14:08:29 drochner Exp $
*/
@@ -162,7 +162,7 @@ loadfile(char *name, char *addr)
}
do {
- n = read(addr, 1024);
+ n = readit(addr, 1024);
addr += n;
twiddle();
} while (n > 0);
diff --git a/sys/boot/alpha/boot1/sys.c b/sys/boot/alpha/boot1/sys.c
index 1c0d912..79f1702 100644
--- a/sys/boot/alpha/boot1/sys.c
+++ b/sys/boot/alpha/boot1/sys.c
@@ -25,7 +25,7 @@
*
* from: Mach, Revision 2.2 92/04/04 11:36:34 rpd
* fromL Id: sys.c,v 1.21 1997/06/09 05:10:56 bde Exp
- * $Id$
+ * $Id: sys.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $
*/
#include <sys/param.h>
@@ -37,6 +37,8 @@
#include <sys/dirent.h>
+#define COMPAT_UFS
+
struct fs *fs;
struct inode inode;
int boff = 0;
@@ -65,7 +67,7 @@ static int block_map(int file_block);
static int find(char *path);
int
-read(char *buffer, int count)
+readit(char *buffer, int count)
{
int logno, off, size;
int cnt2, bnum2;
@@ -160,11 +162,44 @@ block_map(int file_block)
return (((int *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]);
}
+#ifdef COMPAT_UFS
+
+#define max(a, b) ((a) > (b) ? (a) : (b))
+
+/*
+ * Sanity checks for old file systems.
+ *
+ * XXX - goes away some day.
+ */
+static void
+ffs_oldfscompat(fs)
+ struct fs *fs;
+{
+ int i;
+
+ fs->fs_npsect = max(fs->fs_npsect, fs->fs_nsect); /* XXX */
+ fs->fs_interleave = max(fs->fs_interleave, 1); /* XXX */
+ if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
+ fs->fs_nrpos = 8; /* XXX */
+ if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
+ quad_t sizepb = fs->fs_bsize; /* XXX */
+ /* XXX */
+ fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1; /* XXX */
+ for (i = 0; i < NIADDR; i++) { /* XXX */
+ sizepb *= NINDIR(fs); /* XXX */
+ fs->fs_maxfilesize += sizepb; /* XXX */
+ } /* XXX */
+ fs->fs_qbmask = ~fs->fs_bmask; /* XXX */
+ fs->fs_qfmask = ~fs->fs_fmask; /* XXX */
+ } /* XXX */
+}
+#endif
int
openrd(char *name)
{
int ret;
+ char namecopy[128];
if (devopen())
return 1;
@@ -174,10 +209,16 @@ openrd(char *name)
*/
devread((char *)(fs = (struct fs *)fsbuf), SBLOCK + boff, SBSIZE);
+#ifdef COMPAT_UFS
+ ffs_oldfscompat(fs);
+#endif
+
/*
* Find the actual FILE on the mounted device.
+ * Make a copy of the name since find() is destructive.
*/
- ret = find(name);
+ strcpy(namecopy, name);
+ ret = find(namecopy);
if (ret == 0)
return 1;
if (ret < 0)
diff --git a/sys/boot/alpha/boot2/Makefile b/sys/boot/alpha/boot2/Makefile
index a3790d3..f2e7ffe 100644
--- a/sys/boot/alpha/boot2/Makefile
+++ b/sys/boot/alpha/boot2/Makefile
@@ -15,6 +15,7 @@ SRCS+= main.c conf.c
.include <${.CURDIR}/../../common/Makefile.inc>
CFLAGS+= -mno-fp-regs
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
+CFLAGS+= -I${.OBJDIR}
# Verbose ls causes extra heap usage
CFLAGS+= -DVERBOSE_LS
@@ -24,11 +25,7 @@ CLEANFILES+= ${BASE} ${BASE}.sym ${BASE}.list
CFLAGS+= -Wall
-# XXX fix to use "standard" versions
-LIBSTANDDIR= /home/dfr/FreeBSD/alpha/src/lib/libstand
-LIBSTAND= -lstand
CFLAGS+= -I${LIBSTANDDIR}
-LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
diff --git a/sys/boot/alpha/common/main.c b/sys/boot/alpha/common/main.c
index af337d2..365e5c4 100644
--- a/sys/boot/alpha/common/main.c
+++ b/sys/boot/alpha/common/main.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: main.c,v 1.3 1998/08/31 21:10:40 msmith Exp $
+ * $Id: main.c,v 1.4 1998/09/03 02:10:02 msmith Exp $
*/
@@ -127,7 +127,7 @@ main(void)
* we must close it eventually since otherwise the firmware leaves
* the ncr hardware in a broken state (at least it does on my EB164).
*/
- open("/", O_RDONLY);
+ open("/boot", O_RDONLY);
interact(); /* doesn't return */
}
diff --git a/sys/boot/alpha/libalpha/Makefile b/sys/boot/alpha/libalpha/Makefile
index 92ccbdf..1478b74 100644
--- a/sys/boot/alpha/libalpha/Makefile
+++ b/sys/boot/alpha/libalpha/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.2 1998/08/22 10:31:01 dfr Exp $
+# $Id: Makefile,v 1.3 1998/08/31 21:10:40 msmith Exp $
LIB= alpha
NOPIC= true
@@ -6,8 +6,9 @@ NOPROFILE= true
INTERNALLIB= true
# XXX hack to pick up stand.h
-CFLAGS= -I/home/dfr/FreeBSD/alpha/src/lib/libstand
-CFLAGS+= -DDEBUG
+LIBSTANDDIR= ${.CURDIR}/../../../../lib/libstand
+CFLAGS= -I${LIBSTANDDIR}
+CFLAGS+= -DDEBUG
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common -mno-fp-regs
diff --git a/sys/boot/alpha/libalpha/devicename.c b/sys/boot/alpha/libalpha/devicename.c
index 5d1f604..dcd07ed 100644
--- a/sys/boot/alpha/libalpha/devicename.c
+++ b/sys/boot/alpha/libalpha/devicename.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: devicename.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
+ * $Id: devicename.c,v 1.2 1998/08/22 10:31:01 dfr Exp $
*/
#include <stand.h>
@@ -32,7 +32,7 @@
#include "bootstrap.h"
#include "libalpha.h"
-static int alpha_parsedev(struct alpha_devdesc **dev, char *devspec, char **path);
+static int alpha_parsedev(struct alpha_devdesc **dev, const char *devspec, const char **path);
/*
* Point (dev) at an allocated device specifier for the device matching the
@@ -40,7 +40,7 @@ static int alpha_parsedev(struct alpha_devdesc **dev, char *devspec, char **path
* use that. If not, use the default device.
*/
int
-alpha_getdev(void **vdev, char *devspec, char **path)
+alpha_getdev(void **vdev, const char *devspec, const char **path)
{
struct alpha_devdesc **dev = (struct alpha_devdesc **)vdev;
int rv;
@@ -80,12 +80,13 @@ alpha_getdev(void **vdev, char *devspec, char **path)
*
*/
static int
-alpha_parsedev(struct alpha_devdesc **dev, char *devspec, char **path)
+alpha_parsedev(struct alpha_devdesc **dev, const char *devspec, const char **path)
{
struct alpha_devdesc *idev;
struct devsw *dv;
int i, unit, slice, partition, err;
- char *cp, *np;
+ char *cp;
+ const char *np;
/* minimum length check */
if (strlen(devspec) < 2)
diff --git a/sys/boot/alpha/libalpha/libalpha.h b/sys/boot/alpha/libalpha/libalpha.h
index c5a2e17..79b231a 100644
--- a/sys/boot/alpha/libalpha/libalpha.h
+++ b/sys/boot/alpha/libalpha/libalpha.h
@@ -1,4 +1,4 @@
-/* $Id: libalpha.h,v 1.2 1998/08/31 21:10:40 msmith Exp $ */
+/* $Id: libalpha.h,v 1.3 1998/09/20 21:46:19 dfr Exp $ */
/*
* Copyright (c) 1996
@@ -58,7 +58,7 @@ struct alpha_devdesc
} d_kind;
};
-extern int alpha_getdev(void **vdev, char *devspec, char **path);
+extern int alpha_getdev(void **vdev, const char *devspec, const char **path);
extern char *alpha_fmtdev(void *vdev);
extern int alpha_setcurrdev(struct env_var *ev, int flags, void *value);
diff --git a/sys/boot/alpha/netboot/Makefile b/sys/boot/alpha/netboot/Makefile
index 43f1c4c..bb4a77e 100644
--- a/sys/boot/alpha/netboot/Makefile
+++ b/sys/boot/alpha/netboot/Makefile
@@ -15,6 +15,7 @@ SRCS+= main.c conf.c dev_net.c
.include <${.CURDIR}/../../common/Makefile.inc>
CFLAGS+= -mno-fp-regs
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
+CFLAGS+= -I${.OBJDIR}
# Verbose ls causes extra heap usage
CFLAGS+= -DVERBOSE_LS
@@ -24,11 +25,7 @@ CLEANFILES+= ${BASE} ${BASE}.sym ${BASE}.list
CFLAGS+= -Wall
-# XXX fix to use "standard" versions
-LIBSTANDDIR= /home/dfr/FreeBSD/alpha/src/lib/libstand
-LIBSTAND= -lstand
CFLAGS+= -I${LIBSTANDDIR}
-LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
OpenPOWER on IntegriCloud