From 0d1bd6d896a3eedcade2ce101a06fb14b58c6a86 Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 17 Mar 2003 03:18:56 +0000 Subject: 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. --- sys/sparc64/sparc64/pmap.c | 15 +++++++++++---- 1 file 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; -- cgit v1.1