Blame manual/platform.texi

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