VSPY(2V) GENIX Programmer's Manual VSPY(2V)
NAME
vspy - set up mapping to physical memory
SYNOPSIS
vspy(virtaddr, physaddr, flag)
char *virtaddr;
char *physaddr;
DESCRIPTION
Vspy changes the mmu mapping for the current process to allow refer-
ences directly to physical memory. This capability allows user mode
programs to communicate directly with the various peripherals of the
system (such as a bitmapped graphics screen).
Virtaddr is the address in the process which is to be used to access
the physical memory. Physaddr is the physical memory address to be
accessed, or -1 to remove existing access to physical memory. Flag
is 0 if only read access is desired, or 1 if both read and write
access is desired.
Since the lowest mapping granularity for GENIX is one page (1024
bytes), the low order ten bits of the given addresses are ignored,
so that the whole virtual page specified by virtaddr will map to the
whole physical memory page specified by physaddr. Thus to reference
a particular offset into the physical memory page, you must access
the same offset into the virtual memory page.
The virtaddr specified does not have to lie within the data, text,
or stack segment of the process, so that memory does not have to be
allocated using sbrk(2) before calling vspy. If the page specified
by virtaddr already exists, that page is deleted. Fork(2) will
duplicate the physical mapping for the new process. A successful
exec(2) or exit(2) removes all existing physical mapping. Only the
super-user is allowed to map physical memory arbitrarily. However,
certain physical memory addresses corresponding to "safe" devices
(such as the graphics memory) may be mapped by anyone.
SEE ALSO
vlock(2V)
DIAGNOSTICS
Zero is returned if the call was successful. -1 is returned if any
of the arguments are illegal or if the user is not privileged.
BUGS
I/O cannot be done to pages mapped to physical memory. Arguments to
system calls cannot lie in such pages either.
Printed 11/16/83 1