vtop(D3) vtop(D3)
NAME
vtop - convert virtual address to physical address
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
paddr_t vtop(caddr_t vaddr, proc_t *p);
Arguments
vaddr Virtual address to convert.
p Pointer to the process structure used by vtop to
locate the information tables used for memory
management.
DESCRIPTION
vtop converts a virtual address to a physical address.
Return Values
On success, the physical address is returned. Otherwise, if
there is no physical memory mapped to the virtual address, 0
is returned.
USAGE
When a driver receives a memory address from the kernel, that
address is virtual. Generally, memory management is performed
by the MMU. However, devices that access memory directly
using physical DMA deal only with physical memory addresses.
In such cases, the driver must provide the device with
physical memory addresses.
p Argument
To indicate that the address is in kernel virtual space, p
must be set to NULL. Block drivers that can transfer data
directly in and out of user memory space must set p to the
b_proc member of the buf(D4) structure. A pointer to the
currently running process can be obtained by calling
drv_getparm(D3) with the UPROCP parameter.
vaddr Argument
The only addresses that are safe to pass to vtop are those
provided to drivers from the kernel through driver entry
points, DDI/DKI kernel routines, DDI/DKI kernel data
structures, or statically-allocated global driver variables.
Copyright 1994 Novell, Inc. Page 1
vtop(D3) vtop(D3)
Level
Initialization, Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
Warnings
If vaddr specifies an invalid kernel address, a system panic
will occur.
REFERENCES
btop(D3), btopr(D3), buf(D4), drv_getparm(D3), ptob(D3)
NOTICES
Portability
All processors
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2