Blame manual/platform.texi

Packit Service 82fcde
@node Platform, Contributors, Maintenance, Top
Packit Service 82fcde
@c %MENU% Describe all platform-specific facilities provided
Packit Service 82fcde
@appendix Platform-specific facilities
Packit Service 82fcde
Packit Service 82fcde
@Theglibc{} can provide machine-specific functionality.
Packit Service 82fcde
Packit Service 82fcde
@menu
Packit Service 82fcde
* PowerPC::           Facilities Specific to the PowerPC Architecture
Packit Service 82fcde
* RISC-V::            Facilities Specific to the RISC-V Architecture
Packit Service 82fcde
@end menu
Packit Service 82fcde
Packit Service 82fcde
@node PowerPC
Packit Service 82fcde
@appendixsec PowerPC-specific Facilities
Packit Service 82fcde
Packit Service 82fcde
Facilities specific to PowerPC that are not specific to a particular
Packit Service 82fcde
operating system are declared in @file{sys/platform/ppc.h}.
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {uint64_t} __ppc_get_timebase (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Read the current value of the Time Base Register.
Packit Service 82fcde
Packit Service 82fcde
The @dfn{Time Base Register} is a 64-bit register that stores a monotonically
Packit Service 82fcde
incremented value updated at a system-dependent frequency that may be
Packit Service 82fcde
different from the processor frequency.  More information is available in
Packit Service 82fcde
@cite{Power ISA 2.06b - Book II - Section 5.2}.
Packit Service 82fcde
Packit Service 82fcde
@code{__ppc_get_timebase} uses the processor's time base facility directly
Packit Service 82fcde
without requiring assistance from the operating system, so it is very
Packit Service 82fcde
efficient.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {uint64_t} __ppc_get_timebase_freq (void)
Packit Service 82fcde
@safety{@prelim{}@mtunsafe{@mtuinit{}}@asunsafe{@asucorrupt{:init}}@acunsafe{@acucorrupt{:init}}}
Packit Service 82fcde
@c __ppc_get_timebase_freq=__get_timebase_freq @mtuinit @acsfd
Packit Service 82fcde
@c  __get_clockfreq @mtuinit @asucorrupt:init @acucorrupt:init @acsfd
Packit Service 82fcde
@c    the initialization of the static timebase_freq is not exactly
Packit Service 82fcde
@c    safe, because hp_timing_t cannot be atomically set up.
Packit Service 82fcde
@c   syscall:get_tbfreq ok
Packit Service 82fcde
@c   open dup @acsfd
Packit Service 82fcde
@c   read dup ok
Packit Service 82fcde
@c   memcpy dup ok
Packit Service 82fcde
@c   memmem dup ok
Packit Service 82fcde
@c   close dup @acsfd
Packit Service 82fcde
Read the current frequency at which the Time Base Register is updated.
Packit Service 82fcde
Packit Service 82fcde
This frequency is not related to the processor clock or the bus clock.
Packit Service 82fcde
It is also possible that this frequency is not constant.  More information is
Packit Service 82fcde
available in @cite{Power ISA 2.06b - Book II - Section 5.2}.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
The following functions provide hints about the usage of resources that are
Packit Service 82fcde
shared with other processors.  They can be used, for example, if a program
Packit Service 82fcde
waiting on a lock intends to divert the shared resources to be used by other
Packit Service 82fcde
processors.  More information is available in @cite{Power ISA 2.06b - Book II -
Packit Service 82fcde
Section 3.2}.
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_yield (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Provide a hint that performance will probably be improved if shared resources
Packit Service 82fcde
dedicated to the executing processor are released for use by other processors.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_mdoio (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Provide a hint that performance will probably be improved if shared resources
Packit Service 82fcde
dedicated to the executing processor are released until all outstanding storage
Packit Service 82fcde
accesses to caching-inhibited storage have been completed.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_mdoom (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Provide a hint that performance will probably be improved if shared resources
Packit Service 82fcde
dedicated to the executing processor are released until all outstanding storage
Packit Service 82fcde
accesses to cacheable storage for which the data is not in the cache have been
Packit Service 82fcde
completed.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_set_ppr_med (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Set the Program Priority Register to medium value (default).
Packit Service 82fcde
Packit Service 82fcde
The @dfn{Program Priority Register} (PPR) is a 64-bit register that controls
Packit Service 82fcde
the program's priority.  By adjusting the PPR value the programmer may
Packit Service 82fcde
improve system throughput by causing the system resources to be used
Packit Service 82fcde
more efficiently, especially in contention situations.
Packit Service 82fcde
The three unprivileged states available are covered by the functions
Packit Service 82fcde
@code{__ppc_set_ppr_med} (medium -- default), @code{__ppc_set_ppc_low} (low)
Packit Service 82fcde
and @code{__ppc_set_ppc_med_low} (medium low).  More information
Packit Service 82fcde
available in @cite{Power ISA 2.06b - Book II - Section 3.1}.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_set_ppr_low (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Set the Program Priority Register to low value.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_set_ppr_med_low (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Set the Program Priority Register to medium low value.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
Power ISA 2.07 extends the priorities that can be set to the Program Priority
Packit Service 82fcde
Register (PPR).  The following functions implement the new priority levels:
Packit Service 82fcde
very low and medium high.
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_set_ppr_very_low (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Set the Program Priority Register to very low value.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __ppc_set_ppr_med_high (void)
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Set the Program Priority Register to medium high value.  The medium high
Packit Service 82fcde
priority is privileged and may only be set during certain time intervals by
Packit Service 82fcde
problem-state programs.  If the program priority is medium high when the time
Packit Service 82fcde
interval expires or if an attempt is made to set the priority to medium high
Packit Service 82fcde
when it is not allowed, the priority is set to medium.
Packit Service 82fcde
@end deftypefun
Packit Service 82fcde
Packit Service 82fcde
@node RISC-V
Packit Service 82fcde
@appendixsec RISC-V-specific Facilities
Packit Service 82fcde
Packit Service 82fcde
Cache management facilities specific to RISC-V systems that implement the Linux
Packit Service 82fcde
ABI are declared in @file{sys/cachectl.h}.
Packit Service 82fcde
Packit Service 82fcde
@deftypefun {void} __riscv_flush_icache (void *@var{start}, void *@var{end}, unsigned long int @var{flags})
Packit Service 82fcde
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Packit Service 82fcde
Enforce ordering between stores and instruction cache fetches.  The range of
Packit Service 82fcde
addresses over which ordering is enforced is specified by @var{start} and
Packit Service 82fcde
@var{end}.  The @var{flags} argument controls the extent of this ordering, with
Packit Service 82fcde
the default behavior (a @var{flags} value of 0) being to enforce the fence on
Packit Service 82fcde
all threads in the current process.  Setting the
Packit Service 82fcde
@code{SYS_RISCV_FLUSH_ICACHE_LOCAL} bit allows users to indicate that enforcing
Packit Service 82fcde
ordering on only the current thread is necessary.  All other flag bits are
Packit Service 82fcde
reserved.
Packit Service 82fcde
@end deftypefun