Copy code from gnu/usr.bin/gdb/gdb/kvm-fbsd.c to deal with 4 MB pages.

This commit is contained in:
Tor Egge 1997-08-17 17:42:59 +00:00
parent 19c0663e5e
commit 4afb0d5a5b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28318
2 changed files with 26 additions and 0 deletions

View File

@ -151,6 +151,19 @@ _kvm_vatop(kvm_t *kd, u_long va, u_long *pa)
if (((u_long)pde & PG_V) == 0)
goto invalid;
if ((u_long)pde & 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)
*pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
return (NBPDR - (va & PAGE4M_MASK));
}
pteindex = (va >> PAGE_SHIFT) & (NPTEPG-1);
pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pt_entry_t));

View File

@ -151,6 +151,19 @@ _kvm_vatop(kvm_t *kd, u_long va, u_long *pa)
if (((u_long)pde & PG_V) == 0)
goto invalid;
if ((u_long)pde & 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)
*pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
return (NBPDR - (va & PAGE4M_MASK));
}
pteindex = (va >> PAGE_SHIFT) & (NPTEPG-1);
pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pt_entry_t));