summaryrefslogtreecommitdiff
path: root/sys/arch/loongson
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-04-03 19:13:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-04-03 19:13:28 +0000
commit94222fa637ece26f0cdaeaaa1794303a6fd5d07a (patch)
treee4ef0e75cae9ab2380e3ab837adfc7a4655bcc14 /sys/arch/loongson
parent535d5e0dba3ec190956fd50c876d8f0d37a44e60 (diff)
Minor reliability fixes:
- clear initrd signature before returning to PMON or to the loaded kernel - fail /etc/boot.conf access when loading from an initrd image, instead of letting it point to the beginning of the kernel image and have the code complain of lines being too long. Bump minor version.
Diffstat (limited to 'sys/arch/loongson')
-rw-r--r--sys/arch/loongson/stand/boot/conf.c4
-rw-r--r--sys/arch/loongson/stand/boot/exec.c3
-rw-r--r--sys/arch/loongson/stand/boot/libsa.h5
-rw-r--r--sys/arch/loongson/stand/boot/machdep.c4
-rw-r--r--sys/arch/loongson/stand/boot/rd.c21
5 files changed, 25 insertions, 12 deletions
diff --git a/sys/arch/loongson/stand/boot/conf.c b/sys/arch/loongson/stand/boot/conf.c
index 32d41b78545..0797d24b9f8 100644
--- a/sys/arch/loongson/stand/boot/conf.c
+++ b/sys/arch/loongson/stand/boot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.3 2010/02/17 21:25:49 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.4 2010/04/03 19:13:27 miod Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -39,7 +39,7 @@
#include <lib/libsa/ufs.h>
#include <lib/libsa/cd9660.h>
-const char version[] = "0.2";
+const char version[] = "0.3";
#if 0 /* network code not compiled in */
int debug = 0;
#endif
diff --git a/sys/arch/loongson/stand/boot/exec.c b/sys/arch/loongson/stand/boot/exec.c
index 37bd6488279..3a66a224119 100644
--- a/sys/arch/loongson/stand/boot/exec.c
+++ b/sys/arch/loongson/stand/boot/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.1 2010/02/14 22:39:33 miod Exp $ */
+/* $OpenBSD: exec.c,v 1.2 2010/04/03 19:13:27 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -71,5 +71,6 @@ run_loadfile(u_long *marks, int howto)
pmon_envp, pmon_callvec,
(uint64_t *)PHYS_TO_CKSEG0(marks[MARK_END]));
+ rd_invalidate();
_rtt();
}
diff --git a/sys/arch/loongson/stand/boot/libsa.h b/sys/arch/loongson/stand/boot/libsa.h
index c727d7985e4..8ba7fc90391 100644
--- a/sys/arch/loongson/stand/boot/libsa.h
+++ b/sys/arch/loongson/stand/boot/libsa.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libsa.h,v 1.3 2010/02/17 21:25:49 miod Exp $ */
+/* $OpenBSD: libsa.h,v 1.4 2010/04/03 19:13:27 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -52,6 +52,7 @@ int rd_iostrategy(void *, int, daddr_t, size_t, void *, size_t *);
int rd_ioopen(struct open_file *, ...);
int rd_ioclose(struct open_file *);
int rd_isvalid(void);
+void rd_invalidate(void);
/*
* INITRD ``filesystem''
@@ -70,3 +71,5 @@ extern int32_t *pmon_envp;
extern int32_t pmon_callvec;
extern char pmon_bootdev[];
+
+extern char *kernelfile;
diff --git a/sys/arch/loongson/stand/boot/machdep.c b/sys/arch/loongson/stand/boot/machdep.c
index 05c74f5c0c2..dfda371a583 100644
--- a/sys/arch/loongson/stand/boot/machdep.c
+++ b/sys/arch/loongson/stand/boot/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.3 2010/02/17 21:25:49 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.4 2010/04/03 19:13:27 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -53,7 +53,6 @@ int is_gdium;
int boot_rd;
extern int bootprompt;
-extern char *kernelfile;
/*
* Console
@@ -297,5 +296,6 @@ gdium_abort()
"will need to power cycle.\n"
"We would apologize for this incovenience, but we have "
"no control about the firmware of your machine.\n\n");
+ rd_invalidate();
_rtt();
}
diff --git a/sys/arch/loongson/stand/boot/rd.c b/sys/arch/loongson/stand/boot/rd.c
index 5a00bfd4b76..87c045a4464 100644
--- a/sys/arch/loongson/stand/boot/rd.c
+++ b/sys/arch/loongson/stand/boot/rd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rd.c,v 1.1 2010/02/17 21:25:49 miod Exp $ */
+/* $OpenBSD: rd.c,v 1.2 2010/04/03 19:13:27 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -62,6 +62,12 @@ rd_isvalid()
return 1;
}
+void
+rd_invalidate()
+{
+ bzero((void *)INITRD_BASE, sizeof(Elf64_Ehdr));
+}
+
/*
* INITRD filesystem
*/
@@ -69,8 +75,11 @@ int
rdfs_open(char *path, struct open_file *f)
{
if (f->f_dev->dv_open == rd_ioopen) {
- rdoffs = 0;
- return 0;
+ if (strcmp(path, kernelfile) == 0) {
+ rdoffs = 0;
+ return 0;
+ } else
+ return ENOENT;
}
return EINVAL;
@@ -97,13 +106,13 @@ rdfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
int
rdfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
{
- return EIO;
+ return EROFS;
}
off_t
-rdfs_seek(struct open_file *f, off_t offset, int where)
+rdfs_seek(struct open_file *f, off_t offset, int whence)
{
- switch (where) {
+ switch (whence) {
case 0: /* SEEK_SET */
rdoffs = offset;
break;