]> git.ipfire.org Git - thirdparty/glibc.git/blame - manual/platform.texi
Merge branch release/2.28/master into ibm/2.28/master
[thirdparty/glibc.git] / manual / platform.texi
CommitLineData
d9dc34cd
TMQMF
1@node Platform, Contributors, Maintenance, Top
2@c %MENU% Describe all platform-specific facilities provided
3@appendix Platform-specific facilities
4
5@Theglibc{} can provide machine-specific functionality.
6
7@menu
8* PowerPC:: Facilities Specific to the PowerPC Architecture
ba9e25a6 9* RISC-V:: Facilities Specific to the RISC-V Architecture
d9dc34cd
TMQMF
10@end menu
11
12@node PowerPC
13@appendixsec PowerPC-specific Facilities
14
15Facilities specific to PowerPC that are not specific to a particular
16operating system are declared in @file{sys/platform/ppc.h}.
17
18@deftypefun {uint64_t} __ppc_get_timebase (void)
e2dfb7f4 19@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
d9dc34cd
TMQMF
20Read the current value of the Time Base Register.
21
22The @dfn{Time Base Register} is a 64-bit register that stores a monotonically
23incremented value updated at a system-dependent frequency that may be
24different from the processor frequency. More information is available in
25@cite{Power ISA 2.06b - Book II - Section 5.2}.
26
27@code{__ppc_get_timebase} uses the processor's time base facility directly
28without requiring assistance from the operating system, so it is very
29efficient.
30@end deftypefun
8ad11b9a
TMQMF
31
32@deftypefun {uint64_t} __ppc_get_timebase_freq (void)
e2dfb7f4
AO
33@safety{@prelim{}@mtunsafe{@mtuinit{}}@asunsafe{@asucorrupt{:init}}@acunsafe{@acucorrupt{:init}}}
34@c __ppc_get_timebase_freq=__get_timebase_freq @mtuinit @acsfd
35@c __get_clockfreq @mtuinit @asucorrupt:init @acucorrupt:init @acsfd
36@c the initialization of the static timebase_freq is not exactly
37@c safe, because hp_timing_t cannot be atomically set up.
38@c syscall:get_tbfreq ok
39@c open dup @acsfd
40@c read dup ok
41@c memcpy dup ok
42@c memmem dup ok
43@c close dup @acsfd
8ad11b9a
TMQMF
44Read the current frequency at which the Time Base Register is updated.
45
46This frequency is not related to the processor clock or the bus clock.
47It is also possible that this frequency is not constant. More information is
48available in @cite{Power ISA 2.06b - Book II - Section 5.2}.
49@end deftypefun
9323d39b
EM
50
51The following functions provide hints about the usage of resources that are
52shared with other processors. They can be used, for example, if a program
53waiting on a lock intends to divert the shared resources to be used by other
54processors. More information is available in @cite{Power ISA 2.06b - Book II -
55Section 3.2}.
56
57@deftypefun {void} __ppc_yield (void)
e2dfb7f4 58@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
9323d39b
EM
59Provide a hint that performance will probably be improved if shared resources
60dedicated to the executing processor are released for use by other processors.
61@end deftypefun
62
63@deftypefun {void} __ppc_mdoio (void)
e2dfb7f4 64@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
9323d39b
EM
65Provide a hint that performance will probably be improved if shared resources
66dedicated to the executing processor are released until all outstanding storage
67accesses to caching-inhibited storage have been completed.
68@end deftypefun
69
70@deftypefun {void} __ppc_mdoom (void)
e2dfb7f4 71@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
9323d39b
EM
72Provide a hint that performance will probably be improved if shared resources
73dedicated to the executing processor are released until all outstanding storage
74accesses to cacheable storage for which the data is not in the cache have been
75completed.
2b66ef5d 76@end deftypefun
d116b7c4
AZ
77
78@deftypefun {void} __ppc_set_ppr_med (void)
e2dfb7f4 79@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
d116b7c4
AZ
80Set the Program Priority Register to medium value (default).
81
82The @dfn{Program Priority Register} (PPR) is a 64-bit register that controls
83the program's priority. By adjusting the PPR value the programmer may
84improve system throughput by causing the system resources to be used
85more efficiently, especially in contention situations.
86The three unprivileged states available are covered by the functions
87@code{__ppc_set_ppr_med} (medium -- default), @code{__ppc_set_ppc_low} (low)
88and @code{__ppc_set_ppc_med_low} (medium low). More information
89available in @cite{Power ISA 2.06b - Book II - Section 3.1}.
90@end deftypefun
91
92@deftypefun {void} __ppc_set_ppr_low (void)
e2dfb7f4 93@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
d116b7c4
AZ
94Set the Program Priority Register to low value.
95@end deftypefun
96
97@deftypefun {void} __ppc_set_ppr_med_low (void)
e2dfb7f4 98@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
d116b7c4 99Set the Program Priority Register to medium low value.
9323d39b 100@end deftypefun
1747fcda
GG
101
102Power ISA 2.07 extends the priorities that can be set to the Program Priority
103Register (PPR). The following functions implement the new priority levels:
104very low and medium high.
105
106@deftypefun {void} __ppc_set_ppr_very_low (void)
107@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
108Set the Program Priority Register to very low value.
109@end deftypefun
110
111@deftypefun {void} __ppc_set_ppr_med_high (void)
112@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
113Set the Program Priority Register to medium high value. The medium high
114priority is privileged and may only be set during certain time intervals by
115problem-state programs. If the program priority is medium high when the time
116interval expires or if an attempt is made to set the priority to medium high
117when it is not allowed, the priority is set to medium.
118@end deftypefun
ba9e25a6
PD
119
120@node RISC-V
121@appendixsec RISC-V-specific Facilities
122
123Cache management facilities specific to RISC-V systems that implement the Linux
124ABI are declared in @file{sys/cachectl.h}.
125
16efad51 126@deftypefun {void} __riscv_flush_icache (void *@var{start}, void *@var{end}, unsigned long int @var{flags})
ba9e25a6
PD
127@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
128Enforce ordering between stores and instruction cache fetches. The range of
129addresses over which ordering is enforced is specified by @var{start} and
130@var{end}. The @var{flags} argument controls the extent of this ordering, with
131the default behavior (a @var{flags} value of 0) being to enforce the fence on
132all threads in the current process. Setting the
133@code{SYS_RISCV_FLUSH_ICACHE_LOCAL} bit allows users to indicate that enforcing
134ordering on only the current thread is necessary. All other flag bits are
135reserved.
136@end deftypefun