MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pmap_kextract

Function pmap_kextract

freebsd/mips/mips/pmap.c:3579–3640  ·  view source on GitHub ↗

* Routine: pmap_kextract * Function: * Extract the physical page address associated * virtual address. */

Source from the content-addressed store, hash-verified

3577 * virtual address.
3578 */
3579vm_paddr_t
3580pmap_kextract(vm_offset_t va)
3581{
3582 int mapped;
3583
3584 /*
3585 * First, the direct-mapped regions.
3586 */
3587#if defined(__mips_n64)
3588 if (va >= MIPS_XKPHYS_START && va < MIPS_XKPHYS_END)
3589 return (MIPS_XKPHYS_TO_PHYS(va));
3590#endif
3591 if (va >= MIPS_KSEG0_START && va < MIPS_KSEG0_END)
3592 return (MIPS_KSEG0_TO_PHYS(va));
3593
3594 if (va >= MIPS_KSEG1_START && va < MIPS_KSEG1_END)
3595 return (MIPS_KSEG1_TO_PHYS(va));
3596
3597 /*
3598 * User virtual addresses.
3599 */
3600 if (va < VM_MAXUSER_ADDRESS) {
3601 pt_entry_t *ptep;
3602
3603 if (curproc && curproc->p_vmspace) {
3604 ptep = pmap_pte(&curproc->p_vmspace->vm_pmap, va);
3605 if (ptep) {
3606 return (TLBLO_PTE_TO_PA(*ptep) |
3607 (va & PAGE_MASK));
3608 }
3609 return (0);
3610 }
3611 }
3612
3613 /*
3614 * Should be kernel virtual here, otherwise fail
3615 */
3616 mapped = (va >= MIPS_KSEG2_START || va < MIPS_KSEG2_END);
3617#if defined(__mips_n64)
3618 mapped = mapped || (va >= MIPS_XKSEG_START || va < MIPS_XKSEG_END);
3619#endif
3620 /*
3621 * Kernel virtual.
3622 */
3623
3624 if (mapped) {
3625 pt_entry_t *ptep;
3626
3627 /* Is the kernel pmap initialized? */
3628 if (!CPU_EMPTY(&kernel_pmap->pm_active)) {
3629 /* It's inside the virtual address range */
3630 ptep = pmap_pte(kernel_pmap, va);
3631 if (ptep) {
3632 return (TLBLO_PTE_TO_PA(*ptep) |
3633 (va & PAGE_MASK));
3634 }
3635 }
3636 return (0);

Callers 15

_bus_dmamap_count_pagesFunction · 0.70
_bus_dmamap_load_bufferFunction · 0.70
alloc_bounce_pagesFunction · 0.70
vtoslabFunction · 0.50
vtozoneslabFunction · 0.50
vsetzoneslabFunction · 0.50
cvmx_ptr_to_physFunction · 0.50
XX_VirtToPhysFunction · 0.50
ccp_shaFunction · 0.50
jzlcd_allocfbFunction · 0.50
_sglist_append_bufFunction · 0.50
sglist_countFunction · 0.50

Calls 2

pmap_pteFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected