platform.texi 5.8 KB

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