summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-03-17 03:18:56 +0000
committerjake <jake@FreeBSD.org>2003-03-17 03:18:56 +0000
commit0d1bd6d896a3eedcade2ce101a06fb14b58c6a86 (patch)
treef1dc8b2fba6347b5cd06b0c5097c6dd8f8f4aae1
parent17dd501c20f0cfd9bb1b2baedc85b00830d6d439 (diff)
downloadFreeBSD-src-0d1bd6d896a3eedcade2ce101a06fb14b58c6a86.zip
FreeBSD-src-0d1bd6d896a3eedcade2ce101a06fb14b58c6a86.tar.gz
Ensure that kstack0 has physical colour equal to virtual colour, so that
illegal aliases will not be created in the data cache if its accessed through another such mapping.
-rw-r--r--sys/sparc64/sparc64/pmap.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c
index 12372a1..1d6619f 100644
--- a/sys/sparc64/sparc64/pmap.c
+++ b/sys/sparc64/sparc64/pmap.c
@@ -399,12 +399,19 @@ pmap_bootstrap(vm_offset_t ekva)
/*
* Allocate a kernel stack with guard page for thread0 and map it into
- * the kernel tsb.
+ * the kernel tsb. We must ensure that the virtual address is coloured
+ * properly, since we're allocating from phys_avail so the memory won't
+ * have an associated vm_page_t.
*/
- pa = pmap_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE);
+ pa = pmap_bootstrap_alloc(roundup(KSTACK_PAGES, DCACHE_COLORS) *
+ PAGE_SIZE);
kstack0_phys = pa;
- kstack0 = virtual_avail + (KSTACK_GUARD_PAGES * PAGE_SIZE);
- virtual_avail += (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE;
+ virtual_avail += roundup(KSTACK_GUARD_PAGES, DCACHE_COLORS) *
+ PAGE_SIZE;
+ kstack0 = virtual_avail;
+ virtual_avail += roundup(KSTACK_PAGES, DCACHE_COLORS) * PAGE_SIZE;
+ KASSERT(DCACHE_COLOR(kstack0) == DCACHE_COLOR(kstack0_phys),
+ ("pmap_bootstrap: kstack0 miscoloured"));
for (i = 0; i < KSTACK_PAGES; i++) {
pa = kstack0_phys + i * PAGE_SIZE;
va = kstack0 + i * PAGE_SIZE;
OpenPOWER on IntegriCloud