Module Name: src
Committed By: matt
Date: Tue Feb 14 01:51:12 UTC 2012
Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mem.c mips_machdep.c pmap.c
vm_machdep.c
Log Message:
Fix various LP64 thinkos.
To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.34 -r1.78.36.1.2.35 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.35.38.11 -r1.35.38.12 src/sys/arch/mips/mips/mem.c
cvs rdiff -u -r1.205.4.1.2.1.2.65 -r1.205.4.1.2.1.2.66 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.41 -r1.179.16.42 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.121.6.1.2.27 -r1.121.6.1.2.28 \
src/sys/arch/mips/mips/vm_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.78.36.1.2.34 src/sys/arch/mips/include/locore.h:1.78.36.1.2.35
--- src/sys/arch/mips/include/locore.h:1.78.36.1.2.34 Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/include/locore.h Tue Feb 14 01:51:11 2012
@@ -424,12 +424,12 @@ paddr_t kvtophys(vaddr_t);
extern struct phys_ram_seg mem_clusters[];
extern u_int mem_cluster_cnt;
-#ifndef _LP64
/*
* Helper routines for kernel coredumps.
*/
-bool mips_kcore_window_vtophys(vaddr_t, paddr_t *);
vaddr_t mips_kcore_window_map(paddr_t, vsize_t *);
+#ifndef _LP64
+bool mips_kcore_window_vtophys(vaddr_t, paddr_t *);
#endif
Index: src/sys/arch/mips/mips/mem.c
diff -u src/sys/arch/mips/mips/mem.c:1.35.38.11 src/sys/arch/mips/mips/mem.c:1.35.38.12
--- src/sys/arch/mips/mips/mem.c:1.35.38.11 Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/mips/mem.c Tue Feb 14 01:51:11 2012
@@ -133,10 +133,10 @@ mmrw(dev_t dev, struct uio *uio, int fla
if (c > vs)
c = vs;
if (pa > mips_avail_end
- + mips_round_page(MSGBUFSIZE) - c)) {
+ + mips_round_page(MSGBUFSIZE) - c)
return (EFAULT);
} else if (MIPS_XKSEG_P(va)
- && v < MIPS_KSEG0_START
+ && va < MIPS_KSEG0_START
&& !uvm_kernacc((void *)va, c,
uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) {
return (EFAULT);
Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.65 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.66
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.65 Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/mips/mips_machdep.c Tue Feb 14 01:51:11 2012
@@ -2052,7 +2052,7 @@ dumpsys(void)
delay(5000000); /* 5 seconds */
}
-#ifdef MIPS3_PLUS
+#if defined(MIPS3_PLUS) && !defined(_LP64)
static struct mips_kcore_window_info {
struct tlbmask mkwi_tlb;
int mkwi_tlb_slot;
@@ -2063,12 +2063,10 @@ static struct mips_kcore_window_info {
},
.mkwi_tlb_slot = -1,
};
-#endif
bool
mips_kcore_window_vtophys(vaddr_t va, paddr_t *pap)
{
-#ifdef MIPS3_PLUS
struct mips_kcore_window_info * const mkwi = &mips_kcore_window_info;
const vaddr_t tlb_va = mkwi->mkwi_tlb.tlb_hi & -PAGE_SIZE;
psize_t tlb_size = MIPS3_PG_SIZE_MASK_TO_SIZE(mkwi->mkwi_tlb.tlb_mask);
@@ -2078,9 +2076,9 @@ mips_kcore_window_vtophys(vaddr_t va, pa
+ mips_tlbpfn_to_paddr(mkwi->mkwi_tlb.tlb_lo0);
return true;
}
-#endif
return false;
}
+#endif
vaddr_t
mips_kcore_window_map(paddr_t pa, vsize_t *vsp)
@@ -2553,7 +2551,7 @@ mm_md_direct_mapped_phys(paddr_t pa, vad
if (vap != NULL)
*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
if (vsp != NULL)
- *vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XKPHYS_MASK) - pa + 1;
+ *vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XSEG_MASK) - pa + 1;
return true;
#else
#ifdef ENABLE_MIPS_KSEGX
@@ -2585,7 +2583,7 @@ mm_md_direct_mapped_virt(vaddr_t va, pad
if (pap != NULL)
*pap = pa;
if (vsp != NULL)
- *vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XKPHYS_MASK) - pa + 1;
+ *vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XSEG_MASK) - pa + 1;
return true;
}
#endif
Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.41 src/sys/arch/mips/mips/pmap.c:1.179.16.42
--- src/sys/arch/mips/mips/pmap.c:1.179.16.41 Mon Feb 13 18:20:26 2012
+++ src/sys/arch/mips/mips/pmap.c Tue Feb 14 01:51:11 2012
@@ -367,6 +367,10 @@ pmap_map_ephemeral_page(struct vm_page *
vaddr_t va;
if (!mm_md_direct_mapped_phys(pa, &va, NULL)) {
+#ifdef _LP64
+ panic("%s: direct_mapped_phys failed for pa %#"PRIxPADDR,
+ __func__, pa);
+#else
KASSERT(pmap_initialized);
/*
* Make sure to use a congruent mapping to the last mapped
@@ -379,6 +383,7 @@ pmap_map_ephemeral_page(struct vm_page *
+ mips_cache_indexof(MIPS_CACHE_VIRTUAL_ALIAS ? pv->pv_va : pa);
*old_pt_entry_p = *kvtopte(va);
pmap_kenter_pa(va, pa, prot);
+#endif
}
if (MIPS_CACHE_VIRTUAL_ALIAS) {
/*
Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.27 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.28
--- src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.27 Mon Feb 13 18:20:26 2012
+++ src/sys/arch/mips/mips/vm_machdep.c Tue Feb 14 01:51:12 2012
@@ -490,12 +490,14 @@ kvtophys(vaddr_t kva)
{
paddr_t phys;
+#if defined(MIPS3_PLUS) && !defined(_LP64)
/*
* When we dumping memory in a crash dump, we try to use a large
* TLB entry to reduce the TLB trashing.
*/
if (__predict_false(mips_kcore_window_vtophys(kva, &phys)))
return phys;
+#endif
/*
* If the KVA is direct mapped, we're done!