1 @node Platform, Contributors, Maintenance, Top
2 @c %MENU% Describe all platform-specific facilities provided
3 @appendix Platform-specific facilities
5 @Theglibc{} can provide machine-specific functionality.
8 * PowerPC:: Facilities Specific to the PowerPC Architecture
9 * RISC-V:: Facilities Specific to the RISC-V Architecture
13 @appendixsec PowerPC-specific Facilities
15 Facilities specific to PowerPC that are not specific to a particular
16 operating system are declared in @file{sys/platform/ppc.h}.
18 @deftypefun {uint64_t} __ppc_get_timebase (void)
19 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
20 Read the current value of the Time Base Register.
22 The @dfn{Time Base Register} is a 64-bit register that stores a monotonically
23 incremented value updated at a system-dependent frequency that may be
24 different from the processor frequency. More information is available in
25 @cite{Power ISA 2.06b - Book II - Section 5.2}.
27 @code{__ppc_get_timebase} uses the processor's time base facility directly
28 without requiring assistance from the operating system, so it is very
32 @deftypefun {uint64_t} __ppc_get_timebase_freq (void)
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
44 Read the current frequency at which the Time Base Register is updated.
46 This frequency is not related to the processor clock or the bus clock.
47 It is also possible that this frequency is not constant. More information is
48 available in @cite{Power ISA 2.06b - Book II - Section 5.2}.
51 The following functions provide hints about the usage of resources that are
52 shared with other processors. They can be used, for example, if a program
53 waiting on a lock intends to divert the shared resources to be used by other
54 processors. More information is available in @cite{Power ISA 2.06b - Book II -
57 @deftypefun {void} __ppc_yield (void)
58 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
59 Provide a hint that performance will probably be improved if shared resources
60 dedicated to the executing processor are released for use by other processors.
63 @deftypefun {void} __ppc_mdoio (void)
64 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
65 Provide a hint that performance will probably be improved if shared resources
66 dedicated to the executing processor are released until all outstanding storage
67 accesses to caching-inhibited storage have been completed.
70 @deftypefun {void} __ppc_mdoom (void)
71 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
72 Provide a hint that performance will probably be improved if shared resources
73 dedicated to the executing processor are released until all outstanding storage
74 accesses to cacheable storage for which the data is not in the cache have been
78 @deftypefun {void} __ppc_set_ppr_med (void)
79 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
80 Set the Program Priority Register to medium value (default).
82 The @dfn{Program Priority Register} (PPR) is a 64-bit register that controls
83 the program's priority. By adjusting the PPR value the programmer may
84 improve system throughput by causing the system resources to be used
85 more efficiently, especially in contention situations.
86 The three unprivileged states available are covered by the functions
87 @code{__ppc_set_ppr_med} (medium -- default), @code{__ppc_set_ppc_low} (low)
88 and @code{__ppc_set_ppc_med_low} (medium low). More information
89 available in @cite{Power ISA 2.06b - Book II - Section 3.1}.
92 @deftypefun {void} __ppc_set_ppr_low (void)
93 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
94 Set the Program Priority Register to low value.
97 @deftypefun {void} __ppc_set_ppr_med_low (void)
98 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
99 Set the Program Priority Register to medium low value.
102 Power ISA 2.07 extends the priorities that can be set to the Program Priority
103 Register (PPR). The following functions implement the new priority levels:
104 very low and medium high.
106 @deftypefun {void} __ppc_set_ppr_very_low (void)
107 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
108 Set the Program Priority Register to very low value.
111 @deftypefun {void} __ppc_set_ppr_med_high (void)
112 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
113 Set the Program Priority Register to medium high value. The medium high
114 priority is privileged and may only be set during certain time intervals by
115 problem-state programs. If the program priority is medium high when the time
116 interval expires or if an attempt is made to set the priority to medium high
117 when it is not allowed, the priority is set to medium.
121 @appendixsec RISC-V-specific Facilities
123 Cache management facilities specific to RISC-V systems that implement the Linux
124 ABI are declared in @file{sys/cachectl.h}.
126 @deftypefun {void} __riscv_flush_icache (void *@var{start}, void *@var{end}, unsigned long int @var{flags})
127 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
128 Enforce ordering between stores and instruction cache fetches. The range of
129 addresses 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
131 the default behavior (a @var{flags} value of 0) being to enforce the fence on
132 all threads in the current process. Setting the
133 @code{SYS_RISCV_FLUSH_ICACHE_LOCAL} bit allows users to indicate that enforcing
134 ordering on only the current thread is necessary. All other flag bits are