summaryrefslogtreecommitdiff
path: root/sys/arch/m88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-11-03 09:42:56 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-11-03 09:42:56 +0000
commit760ba43cf6946c6268893914c56967c7aa3eb994 (patch)
tree59b24389a621a954df09ed2fcb8a984f620cd78d /sys/arch/m88k
parent344cdb7f54d236c36edfbbb8456046e896d6d91c (diff)
Even saner kernel layout, so that .rodata can be batc mapped by a read-only
dbatc. Add batc mapping support for 88110 systems as well.
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r--sys/arch/m88k/m88k/m8820x_machdep.c19
-rw-r--r--sys/arch/m88k/m88k/pmap.c12
2 files changed, 18 insertions, 13 deletions
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c
index f5751b7b1f6..90cf25c5480 100644
--- a/sys/arch/m88k/m88k/m8820x_machdep.c
+++ b/sys/arch/m88k/m88k/m8820x_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m8820x_machdep.c,v 1.59 2013/11/02 23:10:30 miod Exp $ */
+/* $OpenBSD: m8820x_machdep.c,v 1.60 2013/11/03 09:42:55 miod Exp $ */
/*
* Copyright (c) 2004, 2007, 2010, 2011, 2013, Miodrag Vallat.
*
@@ -360,11 +360,12 @@ m8820x_ibatc_set(cpuid_t cpu, uint batcno, uint32_t batc)
void
m8820x_batc_setup(cpuid_t cpu, apr_t cmode)
{
- paddr_t s_text, e_text, s_data, e_data;
+ paddr_t s_text, e_text, s_data, e_data, e_rodata;
uint batcno;
uint32_t batc, proto;
extern caddr_t kernelstart;
extern caddr_t etext;
+ extern caddr_t erodata;
extern caddr_t end;
proto = BATC_SO | BATC_V;
@@ -374,8 +375,8 @@ m8820x_batc_setup(cpuid_t cpu, apr_t cmode)
proto |= BATC_INH;
s_text = round_batc((paddr_t)&kernelstart);
- e_text = round_batc((paddr_t)&etext);
- s_data = trunc_batc((paddr_t)&etext);
+ s_data = e_text = round_batc((paddr_t)&etext);
+ e_rodata = round_batc((paddr_t)&erodata);
#if 0 /* not until pmap makes sure kvm starts on a BATC boundary */
e_data = round_batc((paddr_t)&end);
#else
@@ -397,8 +398,7 @@ m8820x_batc_setup(cpuid_t cpu, apr_t cmode)
break;
}
-#if !defined(MULTIPROCESSOR) /* XXX */
- /* map s_data..e_data with DBATC */
+ /* map e_text..e_data with DBATC */
if (cmode & CACHE_GLOBAL)
proto |= BATC_GLOBAL;
batcno = 0;
@@ -406,6 +406,12 @@ m8820x_batc_setup(cpuid_t cpu, apr_t cmode)
batc = (s_data >> BATC_BLKSHIFT) << BATC_VSHIFT;
batc |= (s_data >> BATC_BLKSHIFT) << BATC_PSHIFT;
batc |= proto;
+ if (s_data < e_rodata)
+ batc |= BATC_PROT;
+#if defined(MULTIPROCESSOR) /* XXX */
+ else
+ break;
+#endif
#ifdef DEBUG
printf("cpu%d dbat%d %p(%08x)\n", cpu, batcno, s_data, batc);
#endif
@@ -414,7 +420,6 @@ m8820x_batc_setup(cpuid_t cpu, apr_t cmode)
if (++batcno == BATC_MAX)
break;
}
-#endif
}
/*
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index ca992455ea7..a9a73e87ebb 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.73 2013/11/02 23:10:30 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.74 2013/11/03 09:42:55 miod Exp $ */
/*
* Copyright (c) 2001-2004, 2010, Miodrag Vallat.
@@ -540,7 +540,7 @@ pmap_map(paddr_t pa, psize_t sz, vm_prot_t prot, u_int cmode)
void
pmap_bootstrap(paddr_t s_rom, paddr_t e_rom)
{
- paddr_t s_low, s_text, e_text;
+ paddr_t s_low, s_text, e_rodata;
unsigned int npdtpg, nsdt, npdt;
unsigned int i;
sdt_entry_t *sdt;
@@ -548,12 +548,12 @@ pmap_bootstrap(paddr_t s_rom, paddr_t e_rom)
paddr_t pa, sdtpa, ptepa;
const struct pmap_table *ptable;
extern void *kernelstart;
- extern void *etext;
+ extern void *erodata;
virtual_avail = (vaddr_t)avail_end;
s_text = trunc_page((vaddr_t)&kernelstart);
- e_text = round_page((vaddr_t)&etext);
+ e_rodata = round_page((vaddr_t)&erodata);
/*
* Reserve space for 1:1 memory mapping in supervisor space.
@@ -622,9 +622,9 @@ pmap_bootstrap(paddr_t s_rom, paddr_t e_rom)
/* memory below the kernel image */
for (i = atop(s_text); i != 0; i--)
*pte++ = PG_NV;
- /* kernel text */
+ /* kernel text and rodata */
pa = s_text;
- for (i = atop(e_text) - atop(pa); i != 0; i--) {
+ for (i = atop(e_rodata) - atop(pa); i != 0; i--) {
*pte++ = pa | PG_SO | PG_RO | PG_W | PG_V;
pa += PAGE_SIZE;
}