summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2011-08-05 23:10:47 +0000
committermarcel <marcel@FreeBSD.org>2011-08-05 23:10:47 +0000
commit729191f841b21f040585b9ff3eb717cce0b52b76 (patch)
treef1036919c4bf1695311fdf4b6d782a7a60cd6683 /sys/ia64
parent1d5d907de5b24e643a0451748af9893066583485 (diff)
downloadFreeBSD-src-729191f841b21f040585b9ff3eb717cce0b52b76.zip
FreeBSD-src-729191f841b21f040585b9ff3eb717cce0b52b76.tar.gz
Follow-up commit: refactor pmap_kextract() to make it easier to
catch and debug issues like the one fixed in the previous commit: Replace all return statements with goto statements so that we end up at a single place with a value for the physical address. Print a message for all unknown KVA addresses. Approved by: re (blanket)
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/pmap.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c
index 6301b70..e10c6cf 100644
--- a/sys/ia64/ia64/pmap.c
+++ b/sys/ia64/ia64/pmap.c
@@ -1217,43 +1217,54 @@ pmap_kextract(vm_offset_t va)
{
struct ia64_lpte *pte;
uint64_t *pbvm_pgtbl;
+ vm_paddr_t pa;
u_int idx;
KASSERT(va >= VM_MAXUSER_ADDRESS, ("Must be kernel VA"));
/* Regions 6 and 7 are direct mapped. */
- if (va >= IA64_RR_BASE(6))
- return (IA64_RR_MASK(va));
+ if (va >= IA64_RR_BASE(6)) {
+ pa = IA64_RR_MASK(va);
+ goto out;
+ }
- /* Bail out if the virtual address is beyond our limits. */
+ /* Region 5 is our KVA. Bail out if the VA is beyond our limits. */
if (va >= kernel_vm_end)
- return (0);
-
+ goto err_out;
if (va >= VM_MIN_KERNEL_ADDRESS) {
pte = pmap_find_kpte(va);
- return (pmap_present(pte) ? pmap_ppn(pte)|(va&PAGE_MASK) : 0);
+ pa = pmap_present(pte) ? pmap_ppn(pte) | (va & PAGE_MASK) : 0;
+ goto out;
}
- /* PBVM page table. */
+ /* The PBVM page table. */
if (va >= IA64_PBVM_PGTBL + bootinfo->bi_pbvm_pgtblsz)
- return (0);
- if (va >= IA64_PBVM_PGTBL)
- return (va - IA64_PBVM_PGTBL) + bootinfo->bi_pbvm_pgtbl;
+ goto err_out;
+ if (va >= IA64_PBVM_PGTBL) {
+ pa = (va - IA64_PBVM_PGTBL) + bootinfo->bi_pbvm_pgtbl;
+ goto out;
+ }
- /* PBVM. */
+ /* The PBVM itself. */
if (va >= IA64_PBVM_BASE) {
pbvm_pgtbl = (void *)IA64_PBVM_PGTBL;
idx = (va - IA64_PBVM_BASE) >> IA64_PBVM_PAGE_SHIFT;
if (idx >= (bootinfo->bi_pbvm_pgtblsz >> 3))
- return (0);
+ goto err_out;
if ((pbvm_pgtbl[idx] & PTE_PRESENT) == 0)
- return (0);
- return ((pbvm_pgtbl[idx] & PTE_PPN_MASK) +
- (va & IA64_PBVM_PAGE_MASK));
+ goto err_out;
+ pa = (pbvm_pgtbl[idx] & PTE_PPN_MASK) +
+ (va & IA64_PBVM_PAGE_MASK);
+ goto out;
}
- printf("XXX: %s: va=%#lx\n", __func__, va);
- return (0);
+ err_out:
+ printf("XXX: %s: va=%#lx is invalid\n", __func__, va);
+ pa = 0;
+ /* FALLTHROUGH */
+
+ out:
+ return (pa);
}
/*
OpenPOWER on IntegriCloud