SCO OpenServer
vtop(D3oddi)
vtop --
convert a virtual address to a physical address
Synopsis
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/types.h>
paddr_t vtop(caddr_t vaddr, prot_t proc_ptr);
Description
vtop returns a physical address
associated with the specified virtual address.
Arguments
vaddr-
virtual address to be translated
proc_ptr-
pointer to a proc structure
(described in <sys/proc.h>)
It can be specified as either
u.u_procp
or as bp->b_proc
,
where bp is a pointer to the buf structure.
This argument can be omitted
if vtop is called from user context.
Return values
Normally, vtop returns a physical address.
If the specified virtual address
is in the user context of another process
(in other words, proc_ptr
is not u.u_procp
)
but there is no physical memory,
then 0 (zero) is returned.
This can happen, for example, if a portion of the
user address space has been swapped out.
If the specified virtual address
is in kernel context
or in the user context of the current process
but there is no associated physical memory,
then
vtop( )
panics the system.
Usage
The proc_ptr parameter is not examined
when vaddr specifies a normal kernel virtual address
(meaning an address in the top gigabyte
of the virtual address space
but not included in the u_area, the kernel stack,
or the area reserved for Weitek emulation).
To conform with ANSI C syntax, however,
the second parameter must always be specified.
If you know a that a kernel virtual address is being processed,
use
kvtophys(D3oddi)
instead.
Context and synchronization
All
contexts.
If vtop is called with one argument,
or with u.u_procp
as the proc_ptr,
then vtop can only be called from user context.
Hardware applicability
All
Version applicability
oddi:
1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp
SVR5 DDI compatibility
vtop(D3)
is identical to the SCO OpenServer version
in syntax and return values.
It is supported for all DDI versions prior to version 8.
For DDI 8 and later drivers,
``Scatter/gather operations'' in HDK Technical Reference
discusses how to set up a scatter/gather list
without using
vtop( ).
References
kvtophys(D3oddi)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005