1/*
2 * Copyright (c) 2007-2021 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#include <arm64/asm.h>
29#include <arm64/proc_reg.h>
30#include "assym.s"
31
32#if defined(__arm64__)
33/* We're fine, use adrp, add */
34#else
35#error Unknown architecture.
36#endif
37
38 .section __BOOTDATA, __data // Aligned data
39
40 .align 14
41
42 .globl EXT(intstack_low_guard)
43LEXT(intstack_low_guard)
44 .space (PAGE_MAX_SIZE_NUM)
45
46 /* IRQ stack */
47 .globl EXT(intstack) // Boot processor IRQ stack
48LEXT(intstack)
49 .space (INTSTACK_SIZE_NUM)
50 .globl EXT(intstack_top)
51LEXT(intstack_top)
52
53 .globl EXT(intstack_high_guard)
54LEXT(intstack_high_guard)
55 .space (PAGE_MAX_SIZE_NUM)
56
57/* Low guard for fiq/exception stack is shared w/ interrupt stack high guard */
58
59#ifdef __arm64__
60 .global EXT(excepstack)
61LEXT(excepstack)
62 .space (EXCEPSTACK_SIZE_NUM)
63 .globl EXT(excepstack_top)
64LEXT(excepstack_top)
65
66 .globl EXT(excepstack_high_guard)
67LEXT(excepstack_high_guard)
68 .space (PAGE_MAX_SIZE_NUM)
69
70#endif
71
72// Must align to 16K here, due to <rdar://problem/33268668>
73 .global EXT(kd_early_buffer)
74 .align 14
75LEXT(kd_early_buffer) // space for kdebug's early event buffer
76 .space 16*1024,0
77
78 .section __DATA, __data // Aligned data
79 .align 3 // unsigned long long aligned Section
80 .globl EXT(RTClockData)
81LEXT(RTClockData) // Real Time clock area
82 .space RTCLOCKDataSize_NUM,0 // (filled with 0s)
83
84#if TRASH_VFP_ON_SAVE
85 .align 4
86 .globl EXT(vfptrash_data)
87LEXT(vfptrash_data)
88 .fill 64, 4, 0xca55e77e
89#endif
90
91#if __arm64__
92
93#if defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR)
94#if CONFIG_SPTM
95 .section __DATA_SPTM, __const
96 .align 14
97 /* reserve a page for xnu-CTRR covered SPTM data */
98 .space 16*1024,0
99#else
100 .section __DATA, __const
101 .align 14
102#endif /* CONFIG_SPTM */
103/* reserve space for read only page tables */
104LEXT(ropagetable_begin)
105#if XNU_TARGET_OS_OSX
106 // A big auxKC might need more page tables, especially because
107 // it's not block mapped.
108 // Note that we don't distuinguish between KASAN or not: With
109 // a KASAN kernel, the effective auxKC limit is smaller.
110 .space 18*16*1024,0
111#elif KASAN
112 .space 16*16*1024,0
113#else
114 .space 14*16*1024,0
115#endif
116#else
117LEXT(ropagetable_begin)
118#endif /* defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) */
119
120LEXT(ropagetable_end)
121
122 .globl EXT(ropagetable_begin)
123 .globl EXT(ropagetable_end)
124#endif /* __arm64__ */
125
126/* vim: set ts=4: */
127