summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-10-07 19:10:50 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-10-07 19:10:50 +0000
commit7263950487e336d0d63f11ef390fe3ed40db6b52 (patch)
tree77191481389b50b0e3b70d1a6242acd347c3e5eb
parentdbbf61eef3034e473ac3e644b18eb25300b5a305 (diff)
Put the kernel VBR page at the beginning of the kernel text, as done on
mvme88k, to be able to unmap the page at address zero in the kernel, and have the vbr page read-only after being initialized.
-rw-r--r--sys/arch/aviion/aviion/locore.S36
-rw-r--r--sys/arch/aviion/aviion/machdep.c8
-rw-r--r--sys/arch/aviion/aviion/prom.c4
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c8
4 files changed, 41 insertions, 15 deletions
diff --git a/sys/arch/aviion/aviion/locore.S b/sys/arch/aviion/aviion/locore.S
index ab7c2535b5b..2b924365288 100644
--- a/sys/arch/aviion/aviion/locore.S
+++ b/sys/arch/aviion/aviion/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.18 2013/09/28 19:56:46 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.19 2013/10/07 19:10:40 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -85,6 +85,26 @@ ASGLOBAL(__start)
br _ASM_LABEL(main_start)
/*
+ * Room for the kernel VBR page.
+ * Note this page is in kernel text, in order to be write-protected
+ * by pmap_bootstrap().
+ */
+ .balign PAGE_SIZE
+
+#ifdef M88100
+ /*
+ * The 88100 may execute the first instruction of the next trap
+ * handler, as documented in its Errata. Processing trap #511
+ * would then fall into the next page, unless the address computation
+ * wraps, or software traps are exempt from the issue - the Errata
+ * does not provide more detail.
+ * Although the MVME BUG does not add an extra NOP after its VBR page,
+ * it is cheap to add an extra NOP for safety.
+ */
+ NOP
+#endif
+
+ /*
* Startup code for main processor.
*/
ASLOCAL(main_start)
@@ -127,8 +147,6 @@ ASLOCAL(main_start)
ldcr %r12, VBR
or.u %r13, %r0, %hi16(_C_LABEL(prom_vbr))
st %r12, %r13, %lo16(_C_LABEL(prom_vbr))
- stcr %r0, VBR
- FLUSH_PIPELINE
/*
* Have curcpu() point at the dummy cpuinfo structure,
@@ -167,8 +185,14 @@ ASLOCAL(main_start)
#endif /* M88100 */
2:
or %r4, %r0, 1
+ or.u %r2, %r0, %hi16(_ASM_LABEL(__start))
bsr.n _C_LABEL(vector_init)
- ldcr %r2, VBR
+ or %r2, %r2, %lo16(_ASM_LABEL(__start))
+ stcr %r2, VBR
+ FLUSH_PIPELINE
+
+ or.u %r3, %r0, %hi16(_C_LABEL(kernel_vbr))
+ st %r2, %r3, %lo16(_C_LABEL(kernel_vbr))
#ifdef MULTIPROCESSOR
bsr _C_LABEL(atomic_init)
@@ -232,7 +256,9 @@ GLOBAL(secondary_start)
bsr.n _ASM_LABEL(setup_psr)
or %r31, %r31, %lo16(_ASM_LABEL(slavestack_end))
- stcr %r0, VBR /* set Vector Base Register to 0, ALWAYS! */
+ or.u %r3, %r0, %hi16(_C_LABEL(kernel_vbr))
+ ld %r2, %r3, %lo16(_C_LABEL(kernel_vbr))
+ stcr %r2, VBR
FLUSH_PIPELINE
/*
diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c
index de8985acaa4..e80f4b724f1 100644
--- a/sys/arch/aviion/aviion/machdep.c
+++ b/sys/arch/aviion/aviion/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.54 2013/10/07 19:09:08 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.55 2013/10/07 19:10:40 miod Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
*
@@ -156,7 +156,7 @@ u_int bootdev, bootunit, bootpart; /* set in locore.S */
int32_t cpuid;
int cputyp; /* set in locore.S */
-int avtyp;
+register_t kernel_vbr; /* set in locore.S */
const struct board *platform;
/* multiplication factor for delay() */
@@ -771,9 +771,7 @@ aviion_bootstrap()
MSGBUFSIZE);
/* ROM work area is on top of physical memory */
- /* but we need to make VBR page readable */
- /* XXX relocate VBR as done on mvme88k */
- pmap_bootstrap(0, PAGE_SIZE);
+ pmap_bootstrap(0, 0);
/* Initialize the "u-area" pages. */
bzero((caddr_t)curpcb, USPACE);
diff --git a/sys/arch/aviion/aviion/prom.c b/sys/arch/aviion/aviion/prom.c
index 1c79ecb6f62..9b4a2cf25f9 100644
--- a/sys/arch/aviion/aviion/prom.c
+++ b/sys/arch/aviion/aviion/prom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prom.c,v 1.6 2013/09/28 19:56:47 miod Exp $ */
+/* $OpenBSD: prom.c,v 1.7 2013/10/07 19:10:40 miod Exp $ */
/*
* Copyright (c) 2006, Miodrag Vallat.
@@ -58,7 +58,7 @@ register_t prom_vbr; /* set in locore.S */
__asm__ __volatile__ ("ldcr %0, %%cr20" : "=r" (ossr3))
#define OS_VBR() \
- __asm__ __volatile__ ("stcr %r0, %cr7")
+ __asm__ __volatile__ ("stcr %0, %%cr7" : : "r" (kernel_vbr))
#define OS_CONTEXT() \
__asm__ __volatile__ ("stcr %0, %%cr17" : : "r" (ossr0)); \
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index acb07c21216..83d9127b10f 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.57 2013/07/17 19:18:15 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.58 2013/10/07 19:10:49 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -83,7 +83,7 @@ typedef struct {
void dumpconf(void);
void dumpsys(void);
void regdump(struct trapframe *f);
-void vector_init(m88k_exception_vector_area *, u_int32_t *, int);
+void *vector_init(m88k_exception_vector_area *, u_int32_t *, int);
void atomic_init(void);
/*
@@ -438,7 +438,7 @@ spl0()
* more detail. And since the MVME BUG does not add an extra NOP after its
* VBR page, I'll assume this is safe for now -- miod
*/
-void
+void *
vector_init(m88k_exception_vector_area *vbr, u_int32_t *vector_init_list,
int bootstrap)
{
@@ -508,6 +508,8 @@ vector_init(m88k_exception_vector_area *vbr, u_int32_t *vector_init_list,
break;
#endif
}
+
+ return vbr;
}
#ifdef MULTIPROCESSOR