diff options
author | bde <bde@FreeBSD.org> | 1997-07-27 18:29:04 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-07-27 18:29:04 +0000 |
commit | 8efe1426a0f175e3290b32c5da2a3e5118696132 (patch) | |
tree | 679193a8f971bc054b1a9e117a202c2e7bcc0b31 /gnu/usr.bin/gdb | |
parent | 2e6b2cf4d31de805f00a8227beda29d0fdf6e419 (diff) | |
download | FreeBSD-src-8efe1426a0f175e3290b32c5da2a3e5118696132.zip FreeBSD-src-8efe1426a0f175e3290b32c5da2a3e5118696132.tar.gz |
Support 4MB pages.
Diffstat (limited to 'gnu/usr.bin/gdb')
-rw-r--r-- | gnu/usr.bin/gdb/gdb/kvm-fbsd.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c index e0721be..fc6b0c6 100644 --- a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c +++ b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c @@ -791,14 +791,29 @@ kvtophys (fd, addr) if (physrd (fd, v, (char *)&pte, sizeof pte) < 0 || (pte&PG_V) == 0) return (~0); - /* - * Read the second-level page table. - */ - v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte; - if (physrd (fd, v, (char *) &pte, sizeof (pte)) < 0 || (pte&PG_V) == 0) - return (~0); - - addr = (pte & PG_FRAME) + (addr & PAGE_MASK); + if (pte & PG_PS) + { + /* + * No second-level page table; ptd describes one 4MB page. + * (We assume that the kernel wouldn't set PG_PS without enabling + * it cr0, and that the kernel doesn't support 36-bit physical + * addresses). + */ +#define PAGE4M_MASK (NBPDR - 1) +#define PG_FRAME4M (~PAGE4M_MASK) + addr = (pte & PG_FRAME4M) + (addr & PAGE4M_MASK); + } + else + { + /* + * Read the second-level page table. + */ + v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte; + if (physrd (fd, v, (char *) &pte, sizeof (pte)) < 0 || (pte&PG_V) == 0) + return (~0); + + addr = (pte & PG_FRAME) + (addr & PAGE_MASK); + } #if 0 printf ("vtophys (%x) -> %x\n", oldaddr, addr); #endif |