Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sh3/sh3 fix pmap_extract() to handle addresses with...



details:   https://anonhg.NetBSD.org/src/rev/bd847c2d4141
branches:  trunk
changeset: 517577:bd847c2d4141
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Nov 15 05:16:41 2001 +0000

description:
fix pmap_extract() to handle addresses with a PTP but an invalid PTE.

diffstat:

 sys/arch/sh3/sh3/pmap.c |  27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diffs (42 lines):

diff -r d6f50f3ed3c6 -r bd847c2d4141 sys/arch/sh3/sh3/pmap.c
--- a/sys/arch/sh3/sh3/pmap.c   Thu Nov 15 04:49:01 2001 +0000
+++ b/sys/arch/sh3/sh3/pmap.c   Thu Nov 15 05:16:41 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.28 2001/09/19 07:54:48 chs Exp $    */
+/*     $NetBSD: pmap.c,v 1.29 2001/11/15 05:16:41 chs Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -1738,18 +1738,21 @@
        vaddr_t va;
        paddr_t *pap;
 {
-       paddr_t retval;
-       pt_entry_t *ptes;
-
-       if (pmap->pm_pdir[pdei(va)]) {
-               ptes = pmap_map_ptes(pmap);
-               retval = (paddr_t)(ptes[sh3_btop(va)] & PG_FRAME);
-               pmap_unmap_ptes(pmap);
-               if (pap != NULL)
-                       *pap = retval | (va & ~PG_FRAME);
-               return (TRUE);
+       pt_entry_t *ptes, pte;
+
+       if (pmap->pm_pdir[pdei(va)] == 0) {
+               return (FALSE);
        }
-       return (FALSE);
+       ptes = pmap_map_ptes(pmap);
+       pte = ptes[sh3_btop(va)];
+       pmap_unmap_ptes(pmap);
+       if ((pte & PG_V) == 0) {
+               return (FALSE);
+       }
+       if (pap != NULL) {
+               *pap = (pte & PG_FRAME) | (va & ~PG_FRAME);
+       }
+       return (TRUE);
 }
 
 



Home | Main Index | Thread Index | Old Index