Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Apr 2010 05:21:28 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r206588 - in user/jmallett/octeon/sys/mips: include mips
Message-ID:  <201004140521.o3E5LS85075388@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Wed Apr 14 05:21:28 2010
New Revision: 206588
URL: http://svn.freebsd.org/changeset/base/206588

Log:
  Use pmap_pte to look up PTEs outside of pmap.c rather than using pmap_segmap.

Modified:
  user/jmallett/octeon/sys/mips/include/pte.h
  user/jmallett/octeon/sys/mips/mips/pmap.c
  user/jmallett/octeon/sys/mips/mips/trap.c
  user/jmallett/octeon/sys/mips/mips/vm_machdep.c

Modified: user/jmallett/octeon/sys/mips/include/pte.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/pte.h	Wed Apr 14 04:10:13 2010	(r206587)
+++ user/jmallett/octeon/sys/mips/include/pte.h	Wed Apr 14 05:21:28 2010	(r206588)
@@ -38,12 +38,6 @@ typedef	pt_entry_t *pd_entry_t;
 #endif
 
 /*
- * Given a virtual address, get the offset of its PTE within its page
- * directory page.
- */
-#define	PDE_OFFSET(va)	(((vm_offset_t)(va) >> PAGE_SHIFT) & (NPTEPG - 1))
-
-/*
  * TLB and PTE management.  Most things operate within the context of
  * EntryLo0,1, and begin with TLBLO_.  Things which work with EntryHi
  * start with TLBHI_.  PTE bits begin with PG_.

Modified: user/jmallett/octeon/sys/mips/mips/pmap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/pmap.c	Wed Apr 14 04:10:13 2010	(r206587)
+++ user/jmallett/octeon/sys/mips/mips/pmap.c	Wed Apr 14 05:21:28 2010	(r206588)
@@ -136,6 +136,12 @@ __FBSDID("$FreeBSD$");
 #define	mips_segtrunc(va)	((va) & ~SEGOFSET)
 #define	is_kernel_pmap(x)	((x) == kernel_pmap)
 
+/*
+ * Given a virtual address, get the offset of its PTE within its page
+ * directory page.
+ */
+#define	PDE_OFFSET(va)	(((vm_offset_t)(va) >> PAGE_SHIFT) & (NPTEPG - 1))
+
 struct pmap kernel_pmap_store;
 pd_entry_t *kernel_segmap;
 

Modified: user/jmallett/octeon/sys/mips/mips/trap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/trap.c	Wed Apr 14 04:10:13 2010	(r206587)
+++ user/jmallett/octeon/sys/mips/mips/trap.c	Wed Apr 14 05:21:28 2010	(r206588)
@@ -374,10 +374,9 @@ trap(struct trapframe *trapframe)
 			vm_offset_t pa;
 
 			PMAP_LOCK(kernel_pmap);
-			if (!(pte = pmap_segmap(kernel_pmap,
-			    trapframe->badvaddr)))
-				panic("trap: ktlbmod: invalid segmap");
-			pte += PDE_OFFSET(trapframe->badvaddr);
+			pte = pmap_pte(kernel_pmap, trapframe->badvaddr);
+			if (pte == NULL)
+				panic("trap: ktlbmod: can't find PTE");
 #ifdef SMP
 			/* It is possible that some other CPU changed m-bit */
 			if (!pte_test(pte, PG_V) || pte_test(pte, PG_D)) {
@@ -414,9 +413,9 @@ trap(struct trapframe *trapframe)
 			pmap = &p->p_vmspace->vm_pmap;
 
 			PMAP_LOCK(pmap);
-			if (!(pte = pmap_segmap(pmap, trapframe->badvaddr)))
-				panic("trap: utlbmod: invalid segmap");
-			pte += PDE_OFFSET(trapframe->badvaddr);
+			pte = pmap_pte(pmap, trapframe->badvaddr);
+			if (pte == NULL)
+				panic("trap: utlbmod: can't find PTE");
 #ifdef SMP
 			/* It is possible that some other CPU changed m-bit */
 			if (!pte_test(pte, PG_V) || pte_test(pte, PG_D)) {

Modified: user/jmallett/octeon/sys/mips/mips/vm_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/vm_machdep.c	Wed Apr 14 04:10:13 2010	(r206587)
+++ user/jmallett/octeon/sys/mips/mips/vm_machdep.c	Wed Apr 14 05:21:28 2010	(r206588)
@@ -225,13 +225,9 @@ cpu_thread_swapin(struct thread *td)
 	 * part of the thread struct so cpu_switch() can quickly map in
 	 * the pcb struct and kernel stack.
 	 */
-	if (!(pte = pmap_segmap(kernel_pmap, td->td_kstack)))
-		panic("cpu_thread_swapin: invalid segmap");
-	pte += PDE_OFFSET(td->td_kstack);
-
 	for (i = 0; i < KSTACK_PAGES; i++) {
+		pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE);
 		td->td_md.md_upte[i] = *pte & ~TLBLO_SWBITS_MASK;
-		pte++;
 	}
 }
 
@@ -250,13 +246,9 @@ cpu_thread_alloc(struct thread *td)
 	    td->td_kstack_pages * PAGE_SIZE) - 1;
 	td->td_frame = &td->td_pcb->pcb_regs;
 
-	if (!(pte = pmap_segmap(kernel_pmap, td->td_kstack)))
-		panic("cpu_thread_alloc: invalid segmap");
-	pte += PDE_OFFSET(td->td_kstack);
-
 	for (i = 0; i < KSTACK_PAGES; i++) {
+		pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE);
 		td->td_md.md_upte[i] = *pte & ~TLBLO_SWBITS_MASK;
-		pte++;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004140521.o3E5LS85075388>