summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-08-16 14:41:30 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-08-16 14:41:30 +0000
commit08687e764ba49ccb118051314db11ce785823ccc (patch)
treef3061fc7793ca1ad8e576ed1c7738e2df289f176 /sys/arch
parentaa9be06f3017f38dbb65f5d1d438bae0b5dd26be (diff)
Make sure we reserve enough room after the kernel image to avoid stomping
over the PROM page tables on sun4c; also crank the tape kernel generous size estimate to 4MB; crank version. ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/stand/boot/boot.c24
-rw-r--r--sys/arch/sparc/stand/common/version.c6
2 files changed, 16 insertions, 14 deletions
diff --git a/sys/arch/sparc/stand/boot/boot.c b/sys/arch/sparc/stand/boot/boot.c
index 3d3d8a9d13d..b55260111bd 100644
--- a/sys/arch/sparc/stand/boot/boot.c
+++ b/sys/arch/sparc/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.8 2010/07/06 20:41:04 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.9 2010/08/16 14:41:28 miod Exp $ */
/* $NetBSD: boot.c,v 1.2 1997/09/14 19:27:21 pk Exp $ */
/*-
@@ -152,13 +152,13 @@ loadk(char *file, u_long *marks)
/*
* Regardless of the address where we load the kernel, we need to
- * make sure it has enough valid space to use during pmap_bootstrap;
- * 4/4c picks it in locore, 4m needs it now.
+ * make sure it has enough valid space to use during pmap_bootstrap.
+ * locore.s tries to map the 512KB following the kernel image, and
+ * we need to make sure this extra room does not overwrite PROM data
+ * (such as the PROM page tables which are immediately below 4MB on
+ * most sun4c).
*/
- if (cputyp == CPU_SUN4 || cputyp == CPU_SUN4C)
- extra = 0;
- else
- extra = 512 * 1024;
+ extra = 512 * 1024;
if ((fd = open(file, 0)) < 0)
return (errno ? errno : ENOENT);
@@ -170,7 +170,7 @@ loadk(char *file, u_long *marks)
if (files[fd].f_flags & F_RAW) {
flags = (COUNT_KERNEL & ~COUNT_SYM) | (LOAD_KERNEL & ~LOAD_SYM);
- minsize = RELOC2 - LOWSTACK;
+ minsize = FOURMB;
va = 0xf8000000; /* KERNBASE */
#ifdef DEBUG
printf("Tape boot: expecting a bsd.rd kernel smaller than %p\n",
@@ -257,9 +257,11 @@ loadk(char *file, u_long *marks)
/* try and double-map at VA 0 for compatibility */
if (pa + size > bstart) {
+#ifdef DEBUG
printf("WARNING: %s is too large for compat mode.\n"
"If your kernel is too old, it will not run correctly.\n",
file);
+#endif
} else {
if (pa != 0 && pmap_map(0, pa, size) != 0) {
error = EFAULT;
@@ -326,10 +328,8 @@ main(int argc, char *argv[])
if ((error = loadk(file, marks)) == 0)
break;
- if (error != ENOENT) {
- printf("Cannot load %s: error=%d\n", file, error);
- prom_boothow |= RB_ASKNAME;
- }
+ printf("Cannot load %s: error=%d\n", file, error);
+ prom_boothow |= RB_ASKNAME;
}
/* Note: args 2-4 not used due to conflicts with SunOS loaders */
diff --git a/sys/arch/sparc/stand/common/version.c b/sys/arch/sparc/stand/common/version.c
index 7b405495f53..e14e64486ca 100644
--- a/sys/arch/sparc/stand/common/version.c
+++ b/sys/arch/sparc/stand/common/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.6 2010/07/06 20:41:06 miod Exp $ */
+/* $OpenBSD: version.c,v 1.7 2010/08/16 14:41:29 miod Exp $ */
/* $NetBSD: version.c,v 1.4 1995/09/16 23:20:39 pk Exp $ */
/*
@@ -45,6 +45,8 @@
* 2.3 Bumped RELOC
* 2.4 Support for larger kernels and fragmented memory layouts.
* 2.5 sun4e support
+ * 2.6 Support for larger kernels when booting from tape, and avoid
+ * stomping on PROM data below 4MB on sun4c
*/
-char *version = "2.5";
+char *version = "2.6";