osVirtualToPhysical.3p
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.TH osVirtualToPhysical 3P local "Silicon Graphics, Inc."
.SH NAME
osVirtualToPhysical, osPhysicalToVirtual \- translate to,
from a CPU virtual address to a physical memory address
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
u32 osVirtualToPhysical(void \(**vaddr)
.sp .8v
void *osPhysicalToVirtual(void \(**paddr)
.Op
\f1
.fi
.SH DESCRIPTION
The
.I osVirtualToPhysical
routine will translate an arbitrary CPU virtual address to its physical
address,
if such a translation exists.
If the address is KSEG0 or KSEG1 address,
the returned result is equivalent to that of
.I OS_K0_TO_PHYSICAL
or
.IR OS_K1_TO_PHYSICAL ,
respectively.
Otherwise the address is part of a TLB mapped address space
(KUSEG, KSSEG, or KSEG3) and the TLB is probed to determine if a mapping
exists for the given address.
If so, the corresponding physical address is returned;
otherwise,
-1 is returned.
.PP
The
.I osPhysicalToVirtual
routine is simply a function version of
.IR OS_PHYSICAL_TO_K0 (3P),
and thus returns the direct mapped, cached (KSEG0) address corresponding to
.IR paddr.
.SH SEE ALSO
.IR osTLBMap (3P),
.IR OS_K0_TO_PHYSICAL (3P),
.IR OS_K1_TO_PHYSICAL (3P),
.IR OS_PHYSICAL_TO_K0 (3P),
.IR OS_PHYSICAL_TO_K1 (3P)