1 | /* |
2 | * Copyright (c) 2007 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | #ifdef PRIVATE |
29 | |
30 | #ifndef _ARM_CPU_CAPABILITIES_H |
31 | #define _ARM_CPU_CAPABILITIES_H |
32 | |
33 | #if defined (__arm__) || defined (__arm64__) |
34 | |
35 | #ifndef __ASSEMBLER__ |
36 | #include <stdint.h> |
37 | #include <mach/vm_types.h> |
38 | #endif |
39 | |
40 | |
41 | #define USER_TIMEBASE_NONE 0 |
42 | #define USER_TIMEBASE_SPEC 1 |
43 | #define USER_TIMEBASE_NOSPEC 2 |
44 | #define USER_TIMEBASE_NOSPEC_APPLE 3 |
45 | |
46 | /* |
47 | * This is the authoritative way to determine from user mode what |
48 | * implementation-specific processor features are available. |
49 | * This API only supported for Apple internal use. |
50 | * |
51 | */ |
52 | |
53 | /* |
54 | * Bit definitions for _cpu_capabilities: |
55 | */ |
56 | #define kHasFeatFP16 0x00000008 // ARM v8.2 NEON FP16 supported |
57 | #define kCache32 0x00000010 // cache line size is 32 bytes |
58 | #define kCache64 0x00000020 // cache line size is 64 bytes |
59 | #define kCache128 0x00000040 // cache line size is 128 bytes |
60 | #define kFastThreadLocalStorage 0x00000080 // TLS ptr is kept in a user-mode-readable register |
61 | #define kHasAdvSIMD 0x00000100 // Advanced SIMD is supported |
62 | #define kHasAdvSIMD_HPFPCvt 0x00000200 // Advanced SIMD half-precision |
63 | #define kHasVfp 0x00000400 // VFP is supported |
64 | #define kHasUCNormalMemory 0x00000800 // Uncacheable normal memory type supported |
65 | #define kHasEvent 0x00001000 // WFE/SVE and period event wakeup |
66 | #define kHasFMA 0x00002000 // Fused multiply add is supported |
67 | #define kHasFeatFHM 0x00004000 // Optional ARMv8.2 FMLAL/FMLSL instructions (required in ARMv8.4) |
68 | #define kUP 0x00008000 // set if (kNumCPUs == 1) |
69 | #define kNumCPUs 0x00FF0000 // number of CPUs (see _NumCPUs() below) |
70 | #define kHasARMv8Crypto 0x01000000 // Optional ARMv8 Crypto extensions |
71 | #define kHasFeatLSE 0x02000000 // ARMv8.1 Atomic instructions supported |
72 | #define kHasARMv8Crc32 0x04000000 // Optional ARMv8 crc32 instructions (required in ARMv8.1) |
73 | #define kHasFeatSHA512 0x80000000 // Optional ARMv8.2 SHA512 instructions |
74 | /* Extending into 64-bits from here: */ |
75 | #define kHasFeatSHA3 0x0000000100000000 // Optional ARMv8.2 SHA3 instructions |
76 | #define kHasFeatFCMA 0x0000000200000000 // ARMv8.3 complex number instructions |
77 | #define kHasFeatAFP 0x0000000400000000 // ARMv8.7 alternate floating point mode |
78 | #define kHasFEATFlagM 0x0000010000000000 |
79 | #define kHasFEATFlagM2 0x0000020000000000 |
80 | #define kHasFeatDotProd 0x0000040000000000 |
81 | #define kHasFeatRDM 0x0000080000000000 |
82 | #define kHasFeatSPECRES 0x0000100000000000 |
83 | #define kHasFeatSB 0x0000200000000000 |
84 | #define kHasFeatFRINTTS 0x0000400000000000 |
85 | #define kHasArmv8GPI 0x0000800000000000 |
86 | #define kHasFeatLRCPC 0x0001000000000000 |
87 | #define kHasFeatLRCPC2 0x0002000000000000 |
88 | #define kHasFeatJSCVT 0x0004000000000000 |
89 | #define kHasFeatPAuth 0x0008000000000000 |
90 | #define kHasFeatDPB 0x0010000000000000 |
91 | #define kHasFeatDPB2 0x0020000000000000 |
92 | #define kHasFeatLSE2 0x0040000000000000 |
93 | #define kHasFeatCSV2 0x0080000000000000 |
94 | #define kHasFeatCSV3 0x0100000000000000 |
95 | #define kHasFeatDIT 0x0200000000000000 |
96 | #define kHasFP_SyncExceptions 0x0400000000000000 |
97 | |
98 | /* Individual features coalesced to save bits */ |
99 | #define kHasFeatSHA256 kHasARMv8Crypto |
100 | #define kHasFeatSHA1 kHasARMv8Crypto |
101 | #define kHasFeatAES kHasARMv8Crypto |
102 | #define kHasFeatPMULL kHasARMv8Crypto |
103 | |
104 | /* Deprecated names */ |
105 | #define kHasNeonFP16 kHasFeatFP16 |
106 | #define kHasNeon kHasAdvSIMD |
107 | #define kHasNeonHPFP kHasAdvSIMD_HPFPCvt |
108 | #define kHasARMv82FHM kHasFeatFHM |
109 | #define kHasARMv81Atomics kHasFeatLSE |
110 | #define kHasARMv82SHA512 kHasFeatSHA512 |
111 | #define kHasARMv82SHA3 kHasFeatSHA3 |
112 | #define kHasARMv83CompNum kHasFeatFCMA |
113 | |
114 | #define kNumCPUsShift 16 // see _NumCPUs() below |
115 | /* |
116 | * Bit definitions for multiuser_config: |
117 | */ |
118 | #define kIsMultiUserDevice 0x80000000 // this device is in multiuser mode |
119 | #define kHasSecondaryUsers 0x40000000 // this device has Secondary Users |
120 | #define kMultiUserCurrentUserMask 0x3fffffff // the current user UID of the multiuser device |
121 | |
122 | #ifndef __ASSEMBLER__ |
123 | #include <sys/commpage.h> |
124 | |
125 | __BEGIN_DECLS |
126 | extern uint64_t _get_cpu_capabilities( void ); |
127 | __END_DECLS |
128 | |
129 | __inline static |
130 | int |
131 | _NumCPUs( void ) |
132 | { |
133 | return (_get_cpu_capabilities() & kNumCPUs) >> kNumCPUsShift; |
134 | } |
135 | |
136 | |
137 | typedef struct { |
138 | volatile uint64_t TimeBase; |
139 | volatile uint32_t TimeStamp_sec; |
140 | volatile uint32_t TimeStamp_usec; |
141 | volatile uint32_t TimeBaseTicks_per_sec; |
142 | volatile uint32_t TimeBaseTicks_per_usec; |
143 | volatile uint64_t TimeBase_magic; |
144 | volatile uint32_t TimeBase_add; |
145 | volatile uint32_t TimeBase_shift; |
146 | } commpage_timeofday_data_t; |
147 | |
148 | __BEGIN_DECLS |
149 | extern vm_address_t _get_commpage_priv_address(void); |
150 | extern vm_address_t _get_commpage_ro_address(void); |
151 | extern vm_address_t _get_commpage_text_priv_address(void); |
152 | __END_DECLS |
153 | |
154 | #endif /* __ASSEMBLER__ */ |
155 | |
156 | |
157 | /* |
158 | * The shared kernel/user "comm page(s)": |
159 | */ |
160 | |
161 | #if defined(__LP64__) |
162 | |
163 | #define _COMM_PAGE64_BASE_ADDRESS (0x0000000FFFFFC000ULL) /* In TTBR0 */ |
164 | #define _COMM_PAGE64_RO_ADDRESS (0x0000000FFFFF4000ULL) /* In TTBR0 */ |
165 | #define _COMM_PAGE64_AREA_LENGTH (_COMM_PAGE32_AREA_LENGTH) |
166 | #define _COMM_PAGE64_AREA_USED (-1) |
167 | |
168 | #define _COMM_PAGE_PRIV(_addr_) ((_addr_) - (_COMM_PAGE_START_ADDRESS) + _get_commpage_priv_address()) |
169 | |
170 | #ifdef KERNEL_PRIVATE |
171 | #define _COMM_PAGE_RW_OFFSET (0) |
172 | #define _COMM_PAGE_RO_OFFSET (0) |
173 | #define _COMM_PAGE_AREA_LENGTH (PAGE_SIZE) |
174 | |
175 | #define _COMM_PAGE_BASE_ADDRESS (_get_commpage_priv_address()) |
176 | #define _COMM_PAGE_START_ADDRESS (_get_commpage_priv_address()) |
177 | #define _COMM_PAGE_RO_ADDRESS (_get_commpage_ro_address()) |
178 | |
179 | /** |
180 | * This represents the size of the memory region that the commpage is nested in. |
181 | * On 4K page systems, this is 1GB, and on 16KB page systems this is technically |
182 | * only 32MB, but to keep consistency across address spaces we always reserve |
183 | * 1GB for the commpage on ARM devices. |
184 | * |
185 | * The commpage itself only takes up a single page, but its page tables are |
186 | * being shared across every user process. Entries should not be allowed to |
187 | * be created in those shared tables, which is why the VM uses these values to |
188 | * reserve the entire nesting region in every user process address space. |
189 | * |
190 | * If the commpage base address changes, these values might also need to be |
191 | * updated. |
192 | */ |
193 | #define _COMM_PAGE64_NESTING_START (0x0000000FC0000000ULL) |
194 | #define _COMM_PAGE64_NESTING_SIZE (0x40000000ULL) /* 1GiB */ |
195 | _Static_assert((_COMM_PAGE64_BASE_ADDRESS >= _COMM_PAGE64_NESTING_START) && |
196 | (_COMM_PAGE64_BASE_ADDRESS < (_COMM_PAGE64_NESTING_START + _COMM_PAGE64_NESTING_SIZE)), |
197 | "_COMM_PAGE64_BASE_ADDRESS is not within the nesting region. Commpage nesting " |
198 | "region probably needs to be updated." ); |
199 | |
200 | #else /* KERNEL_PRIVATE */ |
201 | /* |
202 | * <sys/commpage.h> defines a couple of convenience macros |
203 | * to help read data from the commpage. |
204 | */ |
205 | #define _COMM_PAGE_AREA_LENGTH (4096) |
206 | |
207 | #define _COMM_PAGE_BASE_ADDRESS _COMM_PAGE64_BASE_ADDRESS |
208 | #define _COMM_PAGE_START_ADDRESS _COMM_PAGE64_BASE_ADDRESS |
209 | #define _COMM_PAGE_RO_ADDRESS _COMM_PAGE64_RO_ADDRESS |
210 | #endif /* KERNEL_PRIVATE */ |
211 | |
212 | #else /* __LP64__ */ |
213 | |
214 | #define _COMM_PAGE64_BASE_ADDRESS (-1) |
215 | #define _COMM_PAGE64_AREA_LENGTH (-1) |
216 | #define _COMM_PAGE64_AREA_USED (-1) |
217 | |
218 | // macro to change a user comm page address to one that is accessible from privileged mode |
219 | // this macro is stubbed as PAN is not available on AARCH32, |
220 | // but this may still be required for compatibility |
221 | #define _COMM_PAGE_PRIV(_addr_) (_addr_) |
222 | |
223 | #ifdef KERNEL_PRIVATE |
224 | #define _COMM_PAGE_RW_OFFSET (_get_commpage_priv_address()-_COMM_PAGE_BASE_ADDRESS) |
225 | #define _COMM_PAGE_RO_OFFSET (_get_commpage_ro_address()-_COMM_PAGE_RO_ADDRESS) |
226 | #define _COMM_PAGE_AREA_LENGTH (PAGE_SIZE) |
227 | #else /* KERNEL_PRIVATE */ |
228 | #define _COMM_PAGE_AREA_LENGTH (4096) |
229 | #endif /* KERNEL_PRIVATE */ |
230 | |
231 | #define _COMM_PAGE_BASE_ADDRESS _COMM_PAGE32_BASE_ADDRESS |
232 | #define _COMM_PAGE_START_ADDRESS _COMM_PAGE32_BASE_ADDRESS |
233 | #define _COMM_PAGE_RO_ADDRESS _COMM_PAGE32_RO_ADDRESS |
234 | |
235 | #endif /* __LP64__ */ |
236 | |
237 | #define _COMM_PAGE32_BASE_ADDRESS (0xFFFF4000) /* Must be outside of normal map bounds */ |
238 | #define _COMM_PAGE32_RO_ADDRESS (0xFFFFC000) /* Must be outside of normal map bounds */ |
239 | #define _COMM_PAGE32_AREA_LENGTH (_COMM_PAGE_AREA_LENGTH) |
240 | #define _COMM_PAGE32_TEXT_START (-1) |
241 | |
242 | #define _COMM_PAGE32_OBJC_SIZE 0ULL |
243 | #define _COMM_PAGE32_OBJC_BASE 0ULL |
244 | #define _COMM_PAGE64_OBJC_SIZE 0ULL |
245 | #define _COMM_PAGE64_OBJC_BASE 0ULL |
246 | |
247 | /* |
248 | * Comm page layout versions |
249 | * |
250 | * If you need to create an RO variant of an existing commpage field (see "Comm page data fields" |
251 | * description below), bump the maximum value of _COMM_PAGE_LAYOUT_VERSION. The kernel should |
252 | * always use the latest version. Individual build targets may default to lower versions as |
253 | * needed. For layout versions lower than the version in which an RO variant was added, the |
254 | * field should be defined to use the "legacy" RW offset. In general, we expect these comm page |
255 | * fields to only be used by platform-level binaries, which are typically coupled to the SDK. |
256 | * A notable exception are simulator targets, which must run the latest platform binaries against |
257 | * older host kernels. Individual builds can also override _COMM_PAGE_LAYOUT_VERSION if they |
258 | * should need to for some reason. |
259 | * Note that we don't use the _COMM_PAGE_VERSION field to provide conditional runtime access |
260 | * to these RO fields, as the version resides in the legacy kernel-writable page and could be |
261 | * spoofed by an attacker. |
262 | */ |
263 | |
264 | #ifndef _COMM_PAGE_LAYOUT_VERSION |
265 | |
266 | #if KERNEL |
267 | #define _COMM_PAGE_LAYOUT_VERSION 1 |
268 | #elif TARGET_OS_SIMULATOR |
269 | // Simulators require running platform libraries built against new SDKs on older hosts |
270 | #define _COMM_PAGE_LAYOUT_VERSION 0 |
271 | #else |
272 | #define _COMM_PAGE_LAYOUT_VERSION 1 |
273 | #endif |
274 | |
275 | #endif // #ifndef _COMM_PAGE_LAYOUT_VERSION |
276 | |
277 | /* |
278 | * Comm page data fields |
279 | * |
280 | * There is always at least one comm page, backed by a physical page with a kernel RW mapping. |
281 | * Apply the _COMM_PAGE_PRIV macro to use this mapping in kernel mode. |
282 | * Depending on device configuration, there may be an additional comm page, backed by a physical |
283 | * page with a kernel RO mapping. This is an additional security measure for certain high-value |
284 | * comm page fields which only need to be accessed from the kernel during early boot. |
285 | * Fields that wish to use this page when available should be defined here as an offset from |
286 | * _COMM_PAGE_RO_ADDRESS instead of _COMM_PAGE_START_ADDRESS, and should be placed at an offset |
287 | * that does not overlap with any other RO or RW field. If an existing field is migrated from |
288 | * the RW to the RO page, the RW definition should be preserved with a _LEGACY suffix in order |
289 | * to maintain binary compatibility. |
290 | */ |
291 | #define _COMM_PAGE_SIGNATURE (_COMM_PAGE_START_ADDRESS+0x000) // first few bytes are a signature |
292 | #define _COMM_PAGE_SIGNATURELEN (0x10) |
293 | #define _COMM_PAGE_CPU_CAPABILITIES64 (_COMM_PAGE_START_ADDRESS+0x010) /* uint64_t _cpu_capabilities */ |
294 | #define _COMM_PAGE_UNUSED (_COMM_PAGE_START_ADDRESS+0x018) /* 6 unused bytes */ |
295 | #define _COMM_PAGE_VERSION (_COMM_PAGE_START_ADDRESS+0x01E) // 16-bit version# |
296 | #define _COMM_PAGE_THIS_VERSION 3 // version of the commarea format |
297 | |
298 | #define _COMM_PAGE_CPU_CAPABILITIES (_COMM_PAGE_START_ADDRESS+0x020) // uint32_t _cpu_capabilities |
299 | #define _COMM_PAGE_NCPUS (_COMM_PAGE_START_ADDRESS+0x022) // uint8_t number of configured CPUs |
300 | |
301 | #define _COMM_PAGE_USER_PAGE_SHIFT_32_LEGACY (_COMM_PAGE_START_ADDRESS+0x024) // VM page shift for 32-bit processes |
302 | #if _COMM_PAGE_LAYOUT_VERSION >= 1 |
303 | #define _COMM_PAGE_USER_PAGE_SHIFT_32 (_COMM_PAGE_RO_ADDRESS+0x024) // VM page shift for 32-bit processes |
304 | #else |
305 | #define _COMM_PAGE_USER_PAGE_SHIFT_32 _COMM_PAGE_USER_PAGE_SHIFT_32_LEGACY |
306 | #endif |
307 | |
308 | #define _COMM_PAGE_USER_PAGE_SHIFT_64_LEGACY (_COMM_PAGE_START_ADDRESS+0x025) // VM page shift for 64-bit processes |
309 | #if _COMM_PAGE_LAYOUT_VERSION >= 1 |
310 | #define _COMM_PAGE_USER_PAGE_SHIFT_64 (_COMM_PAGE_RO_ADDRESS+0x025) // VM page shift for 64-bit processes |
311 | #else |
312 | #define _COMM_PAGE_USER_PAGE_SHIFT_64 _COMM_PAGE_USER_PAGE_SHIFT_64_LEGACY |
313 | #endif |
314 | |
315 | #define _COMM_PAGE_CACHE_LINESIZE (_COMM_PAGE_START_ADDRESS+0x026) // uint16_t cache line size |
316 | #define _COMM_PAGE_UNUSED4 (_COMM_PAGE_START_ADDRESS+0x028) // used to be _COMM_PAGE_SCHED_GEN: uint32_t scheduler generation number (count of pre-emptions) |
317 | #define _COMM_PAGE_UNUSED3 (_COMM_PAGE_START_ADDRESS+0x02C) // used to be _COMM_PAGE_SPIN_COUNT: uint32_t max spin count for mutex's (3 bytes unused) |
318 | #define _COMM_PAGE_CPU_CLUSTERS (_COMM_PAGE_START_ADDRESS+0x02F) // uint8_t number of CPU clusters |
319 | #define _COMM_PAGE_MEMORY_PRESSURE (_COMM_PAGE_START_ADDRESS+0x030) // uint32_t copy of vm_memory_pressure |
320 | #define _COMM_PAGE_ACTIVE_CPUS (_COMM_PAGE_START_ADDRESS+0x034) // uint8_t number of active CPUs (hw.activecpu) |
321 | #define _COMM_PAGE_PHYSICAL_CPUS (_COMM_PAGE_START_ADDRESS+0x035) // uint8_t number of physical CPUs (hw.physicalcpu_max) |
322 | #define _COMM_PAGE_LOGICAL_CPUS (_COMM_PAGE_START_ADDRESS+0x036) // uint8_t number of logical CPUs (hw.logicalcpu_max) |
323 | |
324 | #define _COMM_PAGE_KERNEL_PAGE_SHIFT_LEGACY (_COMM_PAGE_START_ADDRESS+0x037) // uint8_t kernel vm page shift */ |
325 | #if _COMM_PAGE_LAYOUT_VERSION >= 1 |
326 | #define _COMM_PAGE_KERNEL_PAGE_SHIFT (_COMM_PAGE_RO_ADDRESS+0x037) // uint8_t kernel vm page shift */ |
327 | #else |
328 | #define _COMM_PAGE_KERNEL_PAGE_SHIFT _COMM_PAGE_KERNEL_PAGE_SHIFT_LEGACY |
329 | #endif |
330 | |
331 | #define _COMM_PAGE_MEMORY_SIZE (_COMM_PAGE_START_ADDRESS+0x038) // uint64_t max memory size */ |
332 | #define _COMM_PAGE_TIMEOFDAY_DATA (_COMM_PAGE_START_ADDRESS+0x040) // used by gettimeofday(). Currently, sizeof(commpage_timeofday_data_t) = 40. A new struct is used on gettimeofday but space is reserved on the commpage for compatibility |
333 | #define _COMM_PAGE_CPUFAMILY (_COMM_PAGE_START_ADDRESS+0x080) // used by memcpy() resolver |
334 | |
335 | #define _COMM_PAGE_DEV_FIRM_LEGACY (_COMM_PAGE_START_ADDRESS+0x084) // uint32_t handle on PE_i_can_has_debugger |
336 | #if _COMM_PAGE_LAYOUT_VERSION >= 1 |
337 | #define _COMM_PAGE_DEV_FIRM (_COMM_PAGE_RO_ADDRESS+0x084) // uint32_t handle on PE_i_can_has_debugger |
338 | #else |
339 | #define _COMM_PAGE_DEV_FIRM _COMM_PAGE_DEV_FIRM_LEGACY |
340 | #endif |
341 | |
342 | #define _COMM_PAGE_TIMEBASE_OFFSET (_COMM_PAGE_START_ADDRESS+0x088) // uint64_t timebase offset for constructing mach_absolute_time() |
343 | #define _COMM_PAGE_USER_TIMEBASE (_COMM_PAGE_START_ADDRESS+0x090) // uint8_t is userspace mach_absolute_time supported (can read the timebase) |
344 | #define _COMM_PAGE_CONT_HWCLOCK (_COMM_PAGE_START_ADDRESS+0x091) // uint8_t is always-on hardware clock present for mach_continuous_time() |
345 | #define _COMM_PAGE_DTRACE_DOF_ENABLED (_COMM_PAGE_START_ADDRESS+0x092) // uint8_t 0 if userspace DOF disable, 1 if enabled |
346 | #define _COMM_PAGE_UNUSED0 (_COMM_PAGE_START_ADDRESS+0x093) // 5 unused bytes |
347 | #define _COMM_PAGE_CONT_TIMEBASE (_COMM_PAGE_START_ADDRESS+0x098) // uint64_t base for mach_continuous_time() relative to mach_absolute_time() |
348 | #define _COMM_PAGE_BOOTTIME_USEC (_COMM_PAGE_START_ADDRESS+0x0A0) // uint64_t boottime in microseconds |
349 | #define _COMM_PAGE_CONT_HW_TIMEBASE (_COMM_PAGE_START_ADDRESS+0x0A8) // uint64_t base for mach_continuous_time() relative to CNT[PV]CT |
350 | |
351 | // aligning to 64byte for cacheline size |
352 | #define _COMM_PAGE_APPROX_TIME (_COMM_PAGE_START_ADDRESS+0x0C0) // uint64_t last known mach_absolute_time() |
353 | #define _COMM_PAGE_APPROX_TIME_SUPPORTED (_COMM_PAGE_START_ADDRESS+0x0C8) // uint8_t is mach_approximate_time supported |
354 | |
355 | |
356 | #define _COMM_PAGE_UNUSED1 (_COMM_PAGE_START_ADDRESS+0x0D9) // 39 unused bytes, align next mutable value to a separate cache line |
357 | |
358 | #define _COMM_PAGE_KDEBUG_ENABLE (_COMM_PAGE_START_ADDRESS+0x100) // uint32_t export kdebug status bits to userspace |
359 | #define _COMM_PAGE_ATM_DIAGNOSTIC_CONFIG (_COMM_PAGE_START_ADDRESS+0x104) // uint32_t export "atm_diagnostic_config" to userspace |
360 | #define _COMM_PAGE_MULTIUSER_CONFIG (_COMM_PAGE_START_ADDRESS+0x108) // uint32_t export "multiuser_config" to userspace |
361 | |
362 | |
363 | #define _COMM_PAGE_NEWTIMEOFDAY_DATA (_COMM_PAGE_START_ADDRESS+0x120) // used by gettimeofday(). Currently, sizeof(new_commpage_timeofday_data_t) = 40. |
364 | #define _COMM_PAGE_REMOTETIME_PARAMS (_COMM_PAGE_START_ADDRESS+0x148) // used by mach_bridge_remote_time(). Currently, sizeof(struct bt_params) = 24 |
365 | #define _COMM_PAGE_DYLD_FLAGS (_COMM_PAGE_START_ADDRESS+0x160) // uint64_t export kern.dyld_system_flags to userspace |
366 | |
367 | // aligning to 128 bytes for cacheline/fabric size |
368 | #define _COMM_PAGE_CPU_QUIESCENT_COUNTER (_COMM_PAGE_START_ADDRESS+0x180) // uint64_t, but reserve the whole 128 (0x80) bytes |
369 | |
370 | #define _COMM_PAGE_CPU_TO_CLUSTER (_COMM_PAGE_START_ADDRESS+0x200) // 256 bytes reserved for (logical) CPU_ID -> CLUSTER_ID mappings |
371 | |
372 | // Apple Security Bounty random values |
373 | #define _COMM_PAGE_ASB_TARGET_VALUE (_COMM_PAGE_START_ADDRESS+0x320) // uint64_t for random value |
374 | #define _COMM_PAGE_ASB_TARGET_ADDRESS (_COMM_PAGE_START_ADDRESS+0x328) // uint64_t for random target address |
375 | #define _COMM_PAGE_ASB_TARGET_KERN_VALUE (_COMM_PAGE_START_ADDRESS+0x330) // uint64_t for random kernel value |
376 | #define _COMM_PAGE_ASB_TARGET_KERN_ADDRESS (_COMM_PAGE_START_ADDRESS+0x338) // uint64_t for random kernel target address |
377 | |
378 | #define _COMM_PAGE_END (_COMM_PAGE_START_ADDRESS+0xfff) // end of common page |
379 | |
380 | #if defined(__LP64__) |
381 | #if KERNEL_PRIVATE |
382 | #define _COMM_PAGE64_TEXT_START_ADDRESS (_get_commpage_text_priv_address()) // Address through physical aperture |
383 | #endif |
384 | /* Offset in bytes from start of text comm page to get to these functions. Start |
385 | * address to text comm page is from apple array */ |
386 | #define _COMM_PAGE_TEXT_ATOMIC_ENQUEUE (0x0) |
387 | #define _COMM_PAGE_TEXT_ATOMIC_DEQUEUE (0x4) |
388 | |
389 | #else /* __LP64__ */ |
390 | /* No 32 bit text region */ |
391 | #endif /* __LP64__ */ |
392 | |
393 | #endif /* defined (__arm__) || defined (__arm64__) */ |
394 | #endif /* _ARM_CPU_CAPABILITIES_H */ |
395 | #endif /* PRIVATE */ |
396 | |