diff options
author | dyson <dyson@FreeBSD.org> | 1997-08-07 05:15:52 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1997-08-07 05:15:52 +0000 |
commit | 7ef841bb28f98ebd93a23b29f591c51b8749d9c9 (patch) | |
tree | b3844312e725a087759a01919147055bc999ab9c | |
parent | 5518cdfcf3ad6acb9802df68a89a552421166445 (diff) | |
download | FreeBSD-src-7ef841bb28f98ebd93a23b29f591c51b8749d9c9.zip FreeBSD-src-7ef841bb28f98ebd93a23b29f591c51b8749d9c9.tar.gz |
Fix the DDB breakpoint code when using the 4MB page support.
-rw-r--r-- | sys/amd64/amd64/db_interface.c | 27 | ||||
-rw-r--r-- | sys/amd64/amd64/pmap.c | 13 | ||||
-rw-r--r-- | sys/i386/i386/db_interface.c | 27 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 13 | ||||
-rw-r--r-- | sys/i386/include/param.h | 5 |
5 files changed, 60 insertions, 25 deletions
diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 5c5bccc..738b647 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.34 1997/07/18 21:27:52 fsmp Exp $ + * $Id: db_interface.c,v 1.35 1997/07/20 08:37:17 bde Exp $ */ /* @@ -254,14 +254,23 @@ db_write_bytes(addr, size, data) ptep0 = pmap_pte(kernel_pmap, addr); oldmap0 = *ptep0; *ptep0 |= PG_RW; - - addr1 = trunc_page(addr + size - 1); - - /* Map another page if the data crosses a page boundary. */ - if (trunc_page(addr) != addr1) { - ptep1 = pmap_pte(kernel_pmap, addr1); - oldmap1 = *ptep1; - *ptep1 |= PG_RW; + if ((*ptep0 & PG_PS) == 0) { + + addr1 = trunc_page(addr + size - 1); + + /* Map another page if the data crosses a page boundary. */ + if (trunc_page(addr) != addr1) { + ptep1 = pmap_pte(kernel_pmap, addr1); + oldmap1 = *ptep1; + *ptep1 |= PG_RW; + } + } else { + addr1 = trunc_4mpage(addr + size - 1); + if (trunc_4mpage(addr) != addr1) { + ptep1 = pmap_pte(kernel_pmap, addr1); + oldmap1 = *ptep1; + *ptep1 |= PG_RW; + } } invltlb(); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 315b5c1..1fee006 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.156 1997/08/05 22:24:08 dyson Exp $ + * $Id: pmap.c,v 1.157 1997/08/07 03:52:50 dyson Exp $ */ /* @@ -232,8 +232,15 @@ pmap_pte(pmap, va) register pmap_t pmap; vm_offset_t va; { - if (pmap && *pmap_pde(pmap, va)) { - return get_ptbase(pmap) + i386_btop(va); + unsigned *pdeaddr; + + if (pmap) { + pdeaddr = (unsigned *) pmap_pde(pmap, va); + if (*pdeaddr & PG_PS) + return pdeaddr; + if (*pdeaddr) { + return get_ptbase(pmap) + i386_btop(va); + } } return (0); } diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 5c5bccc..738b647 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.34 1997/07/18 21:27:52 fsmp Exp $ + * $Id: db_interface.c,v 1.35 1997/07/20 08:37:17 bde Exp $ */ /* @@ -254,14 +254,23 @@ db_write_bytes(addr, size, data) ptep0 = pmap_pte(kernel_pmap, addr); oldmap0 = *ptep0; *ptep0 |= PG_RW; - - addr1 = trunc_page(addr + size - 1); - - /* Map another page if the data crosses a page boundary. */ - if (trunc_page(addr) != addr1) { - ptep1 = pmap_pte(kernel_pmap, addr1); - oldmap1 = *ptep1; - *ptep1 |= PG_RW; + if ((*ptep0 & PG_PS) == 0) { + + addr1 = trunc_page(addr + size - 1); + + /* Map another page if the data crosses a page boundary. */ + if (trunc_page(addr) != addr1) { + ptep1 = pmap_pte(kernel_pmap, addr1); + oldmap1 = *ptep1; + *ptep1 |= PG_RW; + } + } else { + addr1 = trunc_4mpage(addr + size - 1); + if (trunc_4mpage(addr) != addr1) { + ptep1 = pmap_pte(kernel_pmap, addr1); + oldmap1 = *ptep1; + *ptep1 |= PG_RW; + } } invltlb(); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 315b5c1..1fee006 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.156 1997/08/05 22:24:08 dyson Exp $ + * $Id: pmap.c,v 1.157 1997/08/07 03:52:50 dyson Exp $ */ /* @@ -232,8 +232,15 @@ pmap_pte(pmap, va) register pmap_t pmap; vm_offset_t va; { - if (pmap && *pmap_pde(pmap, va)) { - return get_ptbase(pmap) + i386_btop(va); + unsigned *pdeaddr; + + if (pmap) { + pdeaddr = (unsigned *) pmap_pde(pmap, va); + if (*pdeaddr & PG_PS) + return pdeaddr; + if (*pdeaddr) { + return get_ptbase(pmap) + i386_btop(va); + } } return (0); } diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index bb3a700..1015164 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.30 1997/07/24 23:48:51 fsmp Exp $ + * $Id: param.h,v 1.31 1997/08/04 19:14:47 fsmp Exp $ */ #ifndef _MACHINE_PARAM_H_ @@ -64,6 +64,7 @@ #define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t))) #define PDRSHIFT 22 /* LOG2(NBPDR) */ #define NBPDR (1<<PDRSHIFT) /* bytes/page dir */ +#define PDRMASK (NBPDR-1) #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #define DEV_BSIZE (1<<DEV_BSHIFT) @@ -121,6 +122,8 @@ */ #define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK) #define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) #define atop(x) ((unsigned)(x) >> PAGE_SHIFT) #define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) |