1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2017, Linaro Limited
4  */
5 #ifndef __KERNEL_LINKER_H
6 #define __KERNEL_LINKER_H
7 
8 #include <kernel/dt.h>
9 #include <types_ext.h>
10 
11 /*
12  * Symbols exported by the link script.
13  */
14 
15 #ifdef ARM32
16 
17 /*
18  * These addresses will be the start or end of the exception binary search
19  * index table (.ARM.exidx section)
20  */
21 extern const uint8_t __exidx_start[];
22 extern const uint8_t __exidx_end[];
23 extern const uint8_t __extab_start[];
24 extern const uint8_t __extab_end[];
25 
26 #endif
27 
28 #define VCORE_UNPG_RX_PA	((unsigned long)__vcore_unpg_rx_start)
29 #define VCORE_UNPG_RX_SZ	((size_t)(__vcore_unpg_rx_end - \
30 					  __vcore_unpg_rx_start))
31 #define VCORE_UNPG_RO_PA	((unsigned long)__vcore_unpg_ro_start)
32 #define VCORE_UNPG_RO_SZ	((size_t)(__vcore_unpg_ro_end - \
33 					  __vcore_unpg_ro_start))
34 #define VCORE_UNPG_RW_PA	((unsigned long)__vcore_unpg_rw_start)
35 #define VCORE_UNPG_RW_SZ	((size_t)(__vcore_unpg_rw_end - \
36 					  __vcore_unpg_rw_start))
37 #define VCORE_NEX_RW_PA	((unsigned long)__vcore_nex_rw_start)
38 #define VCORE_NEX_RW_SZ	((size_t)(__vcore_nex_rw_end - \
39 					 __vcore_nex_rw_start))
40 #define VCORE_INIT_RX_PA	((unsigned long)__vcore_init_rx_start)
41 #define VCORE_INIT_RX_SZ	((size_t)(__vcore_init_rx_end - \
42 					  __vcore_init_rx_start))
43 #define VCORE_INIT_RO_PA	((unsigned long)__vcore_init_ro_start)
44 #define VCORE_INIT_RO_SZ	((size_t)(__vcore_init_ro_end - \
45 					  __vcore_init_ro_start))
46 
47 #define VCORE_START_VA		((vaddr_t)__text_start)
48 
49 #ifndef CFG_WITH_PAGER
50 #define VCORE_FREE_PA		((unsigned long)__vcore_free_start)
51 #define VCORE_FREE_SZ		((size_t)(__vcore_free_end - \
52 					  __vcore_free_start))
53 #define VCORE_FREE_END_PA	((unsigned long)__vcore_free_end)
54 #else
55 /* No VCORE_FREE range in pager configuration since it uses all memory */
56 #define VCORE_FREE_PA		PADDR_MAX
57 #define VCORE_FREE_SZ		0
58 #define VCORE_FREE_END_PA	PADDR_MAX
59 #endif
60 
61 #define EMIT_SECTION_INFO_SYMBOLS(section_name) \
62 	extern const uint8_t __vcore_ ## section_name ## _start[]; \
63 	extern const uint8_t __vcore_ ## section_name ## _end[]; \
64 	extern const uint8_t __vcore_ ## section_name ## _size[]
65 
66 EMIT_SECTION_INFO_SYMBOLS(unpg_rx);
67 EMIT_SECTION_INFO_SYMBOLS(unpg_ro);
68 EMIT_SECTION_INFO_SYMBOLS(unpg_rw);
69 EMIT_SECTION_INFO_SYMBOLS(nex_rw);
70 EMIT_SECTION_INFO_SYMBOLS(init_ro);
71 EMIT_SECTION_INFO_SYMBOLS(init_rx);
72 EMIT_SECTION_INFO_SYMBOLS(free);
73 
74 #undef EMIT_SECTION_INFO_SYMBOLS
75 
76 extern const uint8_t __text_start[];
77 extern const uint8_t __text_data_start[];
78 extern const uint8_t __text_data_end[];
79 extern const uint8_t __text_end[];
80 extern const uint8_t __end[];
81 
82 extern const uint8_t __identity_map_init_start[];
83 extern const uint8_t __identity_map_init_end[];
84 
85 extern uint8_t __data_start[];
86 extern const uint8_t __data_end[];
87 extern const uint8_t __rodata_start[];
88 extern const uint8_t __rodata_end[];
89 extern const uint8_t __bss_start[];
90 extern const uint8_t __bss_end[];
91 extern const uint8_t __nozi_start[];
92 extern const uint8_t __nozi_end[];
93 extern const uint8_t __nozi_stack_start[];
94 extern const uint8_t __nozi_stack_end[];
95 extern const uint8_t __init_start[];
96 extern const uint8_t __init_end[];
97 
98 extern uint8_t __heap1_start[];
99 extern const uint8_t __heap1_end[];
100 extern uint8_t __heap2_start[];
101 extern const uint8_t __heap2_end[];
102 
103 extern uint8_t __nex_heap_start[];
104 extern const uint8_t __nex_heap_end[];
105 
106 extern const uint8_t __pageable_part_start[];
107 extern const uint8_t __pageable_part_end[];
108 extern const uint8_t __pageable_start[];
109 extern const uint8_t __pageable_end[];
110 
111 extern const uint8_t __rodata_init_start[];
112 extern const uint8_t __rodata_init_end[];
113 extern const uint8_t __rodata_pageable_start[];
114 extern const uint8_t __rodata_pageable_end[];
115 extern const uint8_t __text_init_start[];
116 extern const uint8_t __text_init_end[];
117 extern const uint8_t __text_pageable_start[];
118 extern const uint8_t __text_pageable_end[];
119 
120 #define ASAN_SHADOW_PA	((paddr_t)(vaddr_t)__asan_shadow_start)
121 #define ASAN_SHADOW_SZ	((size_t)__asan_shadow_size)
122 extern const uint8_t __asan_shadow_start[];
123 extern const uint8_t __asan_shadow_end[];
124 extern const uint8_t __asan_shadow_size[];
125 
126 #define ASAN_MAP_PA	((paddr_t)(vaddr_t)__asan_map_start)
127 #define ASAN_MAP_SZ	((size_t)__asan_map_size)
128 extern const uint8_t __asan_map_start[];
129 extern const uint8_t __asan_map_end[];
130 extern const uint8_t __asan_map_size[];
131 
132 extern const vaddr_t __ctor_list;
133 extern const vaddr_t __ctor_end;
134 
135 /* Generated by core/arch/$(ARCH)/kernel/link.mk */
136 extern const char core_v_str[];
137 
138 #endif /*__KERNEL_LINKER_H*/
139 
140