xref: /openbmc/linux/arch/arm64/kernel/vmlinux.lds.S (revision 6ee3cf6a209fc76d8ae51fba357a62841ec6124c)
1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
28c2c3df3SCatalin Marinas/*
38c2c3df3SCatalin Marinas * ld script to make ARM Linux kernel
48c2c3df3SCatalin Marinas * taken from the i386 version by Russell King
58c2c3df3SCatalin Marinas * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
68c2c3df3SCatalin Marinas */
78c2c3df3SCatalin Marinas
8ce492a16SDavid Brazdil#include <asm/hyp_image.h>
93471ee06SDavid Brazdil#ifdef CONFIG_KVM
10e9ee186bSJames Morse#define HYPERVISOR_EXTABLE					\
11e9ee186bSJames Morse	. = ALIGN(SZ_8);					\
12e9ee186bSJames Morse	__start___kvm_ex_table = .;				\
13e9ee186bSJames Morse	*(__kvm_ex_table)					\
14e9ee186bSJames Morse	__stop___kvm_ex_table = .;
1530c95391SDavid Brazdil
162d7bf218SDavid Brazdil#define HYPERVISOR_DATA_SECTIONS				\
1716174eeaSDavid Brazdil	HYP_SECTION_NAME(.rodata) : {				\
18b83042f0SQuentin Perret		. = ALIGN(PAGE_SIZE);				\
1916174eeaSDavid Brazdil		__hyp_rodata_start = .;				\
202d7bf218SDavid Brazdil		*(HYP_SECTION_NAME(.data..ro_after_init))	\
2116174eeaSDavid Brazdil		*(HYP_SECTION_NAME(.rodata))			\
22b83042f0SQuentin Perret		. = ALIGN(PAGE_SIZE);				\
2316174eeaSDavid Brazdil		__hyp_rodata_end = .;				\
242d7bf218SDavid Brazdil	}
252d7bf218SDavid Brazdil
2630c95391SDavid Brazdil#define HYPERVISOR_PERCPU_SECTION				\
2730c95391SDavid Brazdil	. = ALIGN(PAGE_SIZE);					\
2830c95391SDavid Brazdil	HYP_SECTION_NAME(.data..percpu) : {			\
2930c95391SDavid Brazdil		*(HYP_SECTION_NAME(.data..percpu))		\
3030c95391SDavid Brazdil	}
318c49b5d4SDavid Brazdil
328c49b5d4SDavid Brazdil#define HYPERVISOR_RELOC_SECTION				\
338c49b5d4SDavid Brazdil	.hyp.reloc : ALIGN(4) {					\
348c49b5d4SDavid Brazdil		__hyp_reloc_begin = .;				\
358c49b5d4SDavid Brazdil		*(.hyp.reloc)					\
368c49b5d4SDavid Brazdil		__hyp_reloc_end = .;				\
378c49b5d4SDavid Brazdil	}
388c49b5d4SDavid Brazdil
39380e18adSQuentin Perret#define BSS_FIRST_SECTIONS					\
40380e18adSQuentin Perret	__hyp_bss_start = .;					\
41380e18adSQuentin Perret	*(HYP_SECTION_NAME(.bss))				\
42380e18adSQuentin Perret	. = ALIGN(PAGE_SIZE);					\
43380e18adSQuentin Perret	__hyp_bss_end = .;
44380e18adSQuentin Perret
45380e18adSQuentin Perret/*
46380e18adSQuentin Perret * We require that __hyp_bss_start and __bss_start are aligned, and enforce it
47380e18adSQuentin Perret * with an assertion. But the BSS_SECTION macro places an empty .sbss section
48380e18adSQuentin Perret * between them, which can in some cases cause the linker to misalign them. To
49380e18adSQuentin Perret * work around the issue, force a page alignment for __bss_start.
50380e18adSQuentin Perret */
51380e18adSQuentin Perret#define SBSS_ALIGN			PAGE_SIZE
523471ee06SDavid Brazdil#else /* CONFIG_KVM */
533471ee06SDavid Brazdil#define HYPERVISOR_EXTABLE
542d7bf218SDavid Brazdil#define HYPERVISOR_DATA_SECTIONS
5530c95391SDavid Brazdil#define HYPERVISOR_PERCPU_SECTION
568c49b5d4SDavid Brazdil#define HYPERVISOR_RELOC_SECTION
57380e18adSQuentin Perret#define SBSS_ALIGN			0
583471ee06SDavid Brazdil#endif
59e9ee186bSJames Morse
60d6e2cc56SMark Rutland#define RO_EXCEPTION_TABLE_ALIGN	4
61380e18adSQuentin Perret#define RUNTIME_DISCARD_EXIT
62380e18adSQuentin Perret
63380e18adSQuentin Perret#include <asm-generic/vmlinux.lds.h>
64380e18adSQuentin Perret#include <asm/cache.h>
65380e18adSQuentin Perret#include <asm/kernel-pgtable.h>
6619a046f0SPasha Tatashin#include <asm/kexec.h>
67380e18adSQuentin Perret#include <asm/memory.h>
68380e18adSQuentin Perret#include <asm/page.h>
69380e18adSQuentin Perret
70380e18adSQuentin Perret#include "image.h"
71380e18adSQuentin Perret
72380e18adSQuentin PerretOUTPUT_ARCH(aarch64)
73380e18adSQuentin PerretENTRY(_text)
74380e18adSQuentin Perret
75380e18adSQuentin Perretjiffies = jiffies_64;
76380e18adSQuentin Perret
772240bbb6SMarc Zyngier#define HYPERVISOR_TEXT					\
78b83042f0SQuentin Perret	. = ALIGN(PAGE_SIZE);				\
795c636aa0SMasahiro Yamada	__hyp_idmap_text_start = .;			\
802240bbb6SMarc Zyngier	*(.hyp.idmap.text)				\
815c636aa0SMasahiro Yamada	__hyp_idmap_text_end = .;			\
825c636aa0SMasahiro Yamada	__hyp_text_start = .;				\
832240bbb6SMarc Zyngier	*(.hyp.text)					\
84e9ee186bSJames Morse	HYPERVISOR_EXTABLE				\
85b83042f0SQuentin Perret	. = ALIGN(PAGE_SIZE);				\
865c636aa0SMasahiro Yamada	__hyp_text_end = .;
872240bbb6SMarc Zyngier
885dfe9d7dSArd Biesheuvel#define IDMAP_TEXT					\
895dfe9d7dSArd Biesheuvel	. = ALIGN(SZ_4K);				\
905c636aa0SMasahiro Yamada	__idmap_text_start = .;				\
915dfe9d7dSArd Biesheuvel	*(.idmap.text)					\
925c636aa0SMasahiro Yamada	__idmap_text_end = .;
935dfe9d7dSArd Biesheuvel
9482869ac5SJames Morse#ifdef CONFIG_HIBERNATION
9582869ac5SJames Morse#define HIBERNATE_TEXT					\
965c636aa0SMasahiro Yamada	__hibernate_exit_text_start = .;		\
9782869ac5SJames Morse	*(.hibernate_exit.text)				\
985c636aa0SMasahiro Yamada	__hibernate_exit_text_end = .;
9982869ac5SJames Morse#else
10082869ac5SJames Morse#define HIBERNATE_TEXT
10182869ac5SJames Morse#endif
10282869ac5SJames Morse
10319a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE
10419a046f0SPasha Tatashin#define KEXEC_TEXT					\
10519a046f0SPasha Tatashin	__relocate_new_kernel_start = .;		\
10619a046f0SPasha Tatashin	*(.kexec_relocate.text)				\
10719a046f0SPasha Tatashin	__relocate_new_kernel_end = .;
10819a046f0SPasha Tatashin#else
10919a046f0SPasha Tatashin#define KEXEC_TEXT
11019a046f0SPasha Tatashin#endif
11119a046f0SPasha Tatashin
112c7b9adafSWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
113c7b9adafSWill Deacon#define TRAMP_TEXT					\
114c7b9adafSWill Deacon	. = ALIGN(PAGE_SIZE);				\
1155c636aa0SMasahiro Yamada	__entry_tramp_text_start = .;			\
116c7b9adafSWill Deacon	*(.entry.tramp.text)				\
117c7b9adafSWill Deacon	. = ALIGN(PAGE_SIZE);				\
1185c636aa0SMasahiro Yamada	__entry_tramp_text_end = .;
119c7b9adafSWill Deacon#else
120c7b9adafSWill Deacon#define TRAMP_TEXT
121c7b9adafSWill Deacon#endif
122c7b9adafSWill Deacon
123a352ea3eSArd Biesheuvel/*
124a352ea3eSArd Biesheuvel * The size of the PE/COFF section that covers the kernel image, which
125348a625dSArd Biesheuvel * runs from _stext to _edata, must be a round multiple of the PE/COFF
126348a625dSArd Biesheuvel * FileAlignment, which we set to its minimum value of 0x200. '_stext'
127a352ea3eSArd Biesheuvel * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
128a352ea3eSArd Biesheuvel * boundary should be sufficient.
129a352ea3eSArd Biesheuvel */
130a352ea3eSArd BiesheuvelPECOFF_FILE_ALIGNMENT = 0x200;
131a352ea3eSArd Biesheuvel
132a352ea3eSArd Biesheuvel#ifdef CONFIG_EFI
133a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING	\
134a352ea3eSArd Biesheuvel	.pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
135a352ea3eSArd Biesheuvel#else
136a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING
137a352ea3eSArd Biesheuvel#endif
138a352ea3eSArd Biesheuvel
1398c2c3df3SCatalin MarinasSECTIONS
1408c2c3df3SCatalin Marinas{
1418c2c3df3SCatalin Marinas	/*
1428c2c3df3SCatalin Marinas	 * XXX: The linker does not define how output sections are
1438c2c3df3SCatalin Marinas	 * assigned to input sections when there are multiple statements
1448c2c3df3SCatalin Marinas	 * matching the same input section name.  There is no documented
1458c2c3df3SCatalin Marinas	 * order of matching.
1468c2c3df3SCatalin Marinas	 */
1472883352bSKees Cook	DISCARDS
1488c2c3df3SCatalin Marinas	/DISCARD/ : {
1491e48ef7fSArd Biesheuvel		*(.interp .dynamic)
1503bbd3db8SArd Biesheuvel		*(.dynsym .dynstr .hash .gnu.hash)
1518c2c3df3SCatalin Marinas	}
1528c2c3df3SCatalin Marinas
153120dc60dSArd Biesheuvel	. = KIMAGE_VADDR;
1548c2c3df3SCatalin Marinas
1558c2c3df3SCatalin Marinas	.head.text : {
1568c2c3df3SCatalin Marinas		_text = .;
1578c2c3df3SCatalin Marinas		HEAD_TEXT
1588c2c3df3SCatalin Marinas	}
159e2a073ddSArd Biesheuvel	.text : ALIGN(SEGMENT_ALIGN) {	/* Real text segment		*/
1608c2c3df3SCatalin Marinas		_stext = .;		/* Text and read-only data	*/
1618c2c3df3SCatalin Marinas			IRQENTRY_TEXT
162be7635e7SAlexander Potapenko			SOFTIRQENTRY_TEXT
163888b3c87SPratyush Anand			ENTRY_TEXT
1648c2c3df3SCatalin Marinas			TEXT_TEXT
1658c2c3df3SCatalin Marinas			SCHED_TEXT
1666727ad9eSChris Metcalf			CPUIDLE_TEXT
1678c2c3df3SCatalin Marinas			LOCK_TEXT
1682dd0e8d2SSandeepa Prabhu			KPROBES_TEXT
1692240bbb6SMarc Zyngier			HYPERVISOR_TEXT
1705dfe9d7dSArd Biesheuvel			IDMAP_TEXT
1718c2c3df3SCatalin Marinas			*(.gnu.warning)
1728c2c3df3SCatalin Marinas		. = ALIGN(16);
1738c2c3df3SCatalin Marinas		*(.got)			/* Global offset table		*/
1748c2c3df3SCatalin Marinas	}
1758c2c3df3SCatalin Marinas
176be288182SKees Cook	/*
177be288182SKees Cook	 * Make sure that the .got.plt is either completely empty or it
178be288182SKees Cook	 * contains only the lazy dispatch entries.
179be288182SKees Cook	 */
180be288182SKees Cook	.got.plt : { *(.got.plt) }
181be288182SKees Cook	ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18,
182be288182SKees Cook	       "Unexpected GOT/PLT entries detected!")
183be288182SKees Cook
18497740051SArd Biesheuvel	. = ALIGN(SEGMENT_ALIGN);
1859fdc14c5SArd Biesheuvel	_etext = .;			/* End of text section */
1869fdc14c5SArd Biesheuvel
18719f6bc32SKees Cook	/* everything from this point to __init_begin will be marked RO NX */
18819f6bc32SKees Cook	RO_DATA(PAGE_SIZE)
1898c2c3df3SCatalin Marinas
190eb48d154SMarc Zyngier	HYPERVISOR_DATA_SECTIONS
191eb48d154SMarc Zyngier
192*6ee3cf6aSArd Biesheuvel	/* code sections that are never executed via the kernel mapping */
193*6ee3cf6aSArd Biesheuvel	.rodata.text : {
194*6ee3cf6aSArd Biesheuvel		TRAMP_TEXT
195*6ee3cf6aSArd Biesheuvel		HIBERNATE_TEXT
196*6ee3cf6aSArd Biesheuvel		KEXEC_TEXT
197*6ee3cf6aSArd Biesheuvel		. = ALIGN(PAGE_SIZE);
198*6ee3cf6aSArd Biesheuvel	}
199*6ee3cf6aSArd Biesheuvel
2008eb7e28dSJun Yao	idmap_pg_dir = .;
2018eb7e28dSJun Yao	. += IDMAP_DIR_SIZE;
2029d2d75edSGavin Shan	idmap_pg_end = .;
2038eb7e28dSJun Yao
2048eb7e28dSJun Yao#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
2058eb7e28dSJun Yao	tramp_pg_dir = .;
2068eb7e28dSJun Yao	. += PAGE_SIZE;
2078eb7e28dSJun Yao#endif
2088eb7e28dSJun Yao
209833be850SMark Rutland	reserved_pg_dir = .;
210833be850SMark Rutland	. += PAGE_SIZE;
211833be850SMark Rutland
2128eb7e28dSJun Yao	swapper_pg_dir = .;
2138eb7e28dSJun Yao	. += PAGE_SIZE;
2148eb7e28dSJun Yao
21597740051SArd Biesheuvel	. = ALIGN(SEGMENT_ALIGN);
2168c2c3df3SCatalin Marinas	__init_begin = .;
2172ebe088bSArd Biesheuvel	__inittext_begin = .;
2188c2c3df3SCatalin Marinas
2198c2c3df3SCatalin Marinas	INIT_TEXT_SECTION(8)
220ca2ef4ffSMark Rutland
221ca2ef4ffSMark Rutland	__exittext_begin = .;
2228c2c3df3SCatalin Marinas	.exit.text : {
2231eae811dSArd Biesheuvel		EXIT_TEXT
2248c2c3df3SCatalin Marinas	}
225ca2ef4ffSMark Rutland	__exittext_end = .;
226da141706SLaura Abbott
2272ebe088bSArd Biesheuvel	. = ALIGN(4);
2282ebe088bSArd Biesheuvel	.altinstructions : {
2292ebe088bSArd Biesheuvel		__alt_instructions = .;
2302ebe088bSArd Biesheuvel		*(.altinstructions)
2312ebe088bSArd Biesheuvel		__alt_instructions_end = .;
2322ebe088bSArd Biesheuvel	}
2332ebe088bSArd Biesheuvel
23476085affSArd Biesheuvel	. = ALIGN(SEGMENT_ALIGN);
2352ebe088bSArd Biesheuvel	__inittext_end = .;
2362ebe088bSArd Biesheuvel	__initdata_begin = .;
2372ebe088bSArd Biesheuvel
2388c2c3df3SCatalin Marinas	.init.data : {
2398c2c3df3SCatalin Marinas		INIT_DATA
2408c2c3df3SCatalin Marinas		INIT_SETUP(16)
2418c2c3df3SCatalin Marinas		INIT_CALLS
2428c2c3df3SCatalin Marinas		CON_INITCALL
2438c2c3df3SCatalin Marinas		INIT_RAM_FS
244ba4259a6SCatalin Marinas		*(.init.altinstructions .init.bss)	/* from the EFI stub */
2458c2c3df3SCatalin Marinas	}
2468c2c3df3SCatalin Marinas	.exit.data : {
2471eae811dSArd Biesheuvel		EXIT_DATA
2488c2c3df3SCatalin Marinas	}
2498c2c3df3SCatalin Marinas
25098fb7548SArd Biesheuvel	PERCPU_SECTION(L1_CACHE_BYTES)
25130c95391SDavid Brazdil	HYPERVISOR_PERCPU_SECTION
2528c2c3df3SCatalin Marinas
2538c49b5d4SDavid Brazdil	HYPERVISOR_RELOC_SECTION
2548c49b5d4SDavid Brazdil
2553bbd3db8SArd Biesheuvel	.rela.dyn : ALIGN(8) {
2561e48ef7fSArd Biesheuvel		*(.rela .rela*)
2571e48ef7fSArd Biesheuvel	}
258e039ee4eSAndre Przywara
2593bbd3db8SArd Biesheuvel	__rela_offset	= ABSOLUTE(ADDR(.rela.dyn) - KIMAGE_VADDR);
2603bbd3db8SArd Biesheuvel	__rela_size	= SIZEOF(.rela.dyn);
2610cd3defeSArd Biesheuvel
2625cf896fbSPeter Collingbourne#ifdef CONFIG_RELR
2635cf896fbSPeter Collingbourne	.relr.dyn : ALIGN(8) {
2645cf896fbSPeter Collingbourne		*(.relr.dyn)
2655cf896fbSPeter Collingbourne	}
2665cf896fbSPeter Collingbourne
2675cf896fbSPeter Collingbourne	__relr_offset	= ABSOLUTE(ADDR(.relr.dyn) - KIMAGE_VADDR);
2685cf896fbSPeter Collingbourne	__relr_size	= SIZEOF(.relr.dyn);
2695cf896fbSPeter Collingbourne#endif
2705cf896fbSPeter Collingbourne
27197740051SArd Biesheuvel	. = ALIGN(SEGMENT_ALIGN);
2722ebe088bSArd Biesheuvel	__initdata_end = .;
2739aa4ec15SMark Rutland	__init_end = .;
2749aa4ec15SMark Rutland
2753c620626SMark Salter	_data = .;
2768c2c3df3SCatalin Marinas	_sdata = .;
277c9174047SKees Cook	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
278b6113038SJames Morse
279b6113038SJames Morse	/*
280b6113038SJames Morse	 * Data written with the MMU off but read with the MMU on requires
281b6113038SJames Morse	 * cache lines to be invalidated, discarding up to a Cache Writeback
282b6113038SJames Morse	 * Granule (CWG) of data from the cache. Keep the section that
283b6113038SJames Morse	 * requires this type of maintenance to be in its own Cache Writeback
284b6113038SJames Morse	 * Granule (CWG) area so the cache maintenance operations don't
285b6113038SJames Morse	 * interfere with adjacent data.
286b6113038SJames Morse	 */
287b6113038SJames Morse	.mmuoff.data.write : ALIGN(SZ_2K) {
288b6113038SJames Morse		__mmuoff_data_start = .;
289b6113038SJames Morse		*(.mmuoff.data.write)
290b6113038SJames Morse	}
291b6113038SJames Morse	. = ALIGN(SZ_2K);
292b6113038SJames Morse	.mmuoff.data.read : {
293b6113038SJames Morse		*(.mmuoff.data.read)
294b6113038SJames Morse		__mmuoff_data_end = .;
295b6113038SJames Morse	}
296b6113038SJames Morse
297a352ea3eSArd Biesheuvel	PECOFF_EDATA_PADDING
298cad27ef2SArd Biesheuvel	__pecoff_data_rawsize = ABSOLUTE(. - __initdata_begin);
2998c2c3df3SCatalin Marinas	_edata = .;
3008c2c3df3SCatalin Marinas
301380e18adSQuentin Perret	BSS_SECTION(SBSS_ALIGN, 0, 0)
302bd00cd5fSMark Rutland
303bd00cd5fSMark Rutland	. = ALIGN(PAGE_SIZE);
3042b5548b6SJun Yao	init_pg_dir = .;
3052b5548b6SJun Yao	. += INIT_DIR_SIZE;
3062b5548b6SJun Yao	init_pg_end = .;
3072b5548b6SJun Yao
30876085affSArd Biesheuvel	. = ALIGN(SEGMENT_ALIGN);
309cad27ef2SArd Biesheuvel	__pecoff_data_size = ABSOLUTE(. - __initdata_begin);
3108c2c3df3SCatalin Marinas	_end = .;
3118c2c3df3SCatalin Marinas
3128c2c3df3SCatalin Marinas	STABS_DEBUG
313578d7f0fSKees Cook	DWARF_DEBUG
314c604abc3SKees Cook	ELF_DETAILS
315a2c1d73bSMark Rutland
316a2c1d73bSMark Rutland	HEAD_SYMBOLS
317be288182SKees Cook
318be288182SKees Cook	/*
319be288182SKees Cook	 * Sections that should stay zero sized, which is safer to
320be288182SKees Cook	 * explicitly check instead of blindly discarding.
321be288182SKees Cook	 */
322be288182SKees Cook	.plt : {
3235f692a81SArd Biesheuvel		*(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
324be288182SKees Cook	}
325be288182SKees Cook	ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
326be288182SKees Cook
327be288182SKees Cook	.data.rel.ro : { *(.data.rel.ro) }
328be288182SKees Cook	ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!")
3298c2c3df3SCatalin Marinas}
3302240bbb6SMarc Zyngier
33190776dd1SKees Cook#include "image-vars.h"
33290776dd1SKees Cook
3332240bbb6SMarc Zyngier/*
334b83042f0SQuentin Perret * The HYP init code and ID map text can't be longer than a page each. The
335b83042f0SQuentin Perret * former is page-aligned, but the latter may not be with 16K or 64K pages, so
336b83042f0SQuentin Perret * it should also not cross a page boundary.
3372240bbb6SMarc Zyngier */
338b83042f0SQuentin PerretASSERT(__hyp_idmap_text_end - __hyp_idmap_text_start <= PAGE_SIZE,
339b83042f0SQuentin Perret	"HYP init code too big")
3405dfe9d7dSArd BiesheuvelASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
3415dfe9d7dSArd Biesheuvel	"ID map text too big or misaligned")
34282869ac5SJames Morse#ifdef CONFIG_HIBERNATION
343*6ee3cf6aSArd BiesheuvelASSERT(__hibernate_exit_text_end - __hibernate_exit_text_start <= SZ_4K,
344*6ee3cf6aSArd Biesheuvel       "Hibernate exit text is bigger than 4 KiB")
34582869ac5SJames Morse#endif
3466c27c408SWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
347a9c406e6SJames MorseASSERT((__entry_tramp_text_end - __entry_tramp_text_start) <= 3*PAGE_SIZE,
3486c27c408SWill Deacon	"Entry trampoline text too big")
3496c27c408SWill Deacon#endif
350380e18adSQuentin Perret#ifdef CONFIG_KVM
351380e18adSQuentin PerretASSERT(__hyp_bss_start == __bss_start, "HYP and Host BSS are misaligned")
352380e18adSQuentin Perret#endif
353da57a369SMark Rutland/*
354da57a369SMark Rutland * If padding is applied before .head.text, virt<->phys conversions will fail.
355da57a369SMark Rutland */
356120dc60dSArd BiesheuvelASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned")
35700ef5434SJoey Gouly
35800ef5434SJoey GoulyASSERT(swapper_pg_dir - reserved_pg_dir == RESERVED_SWAPPER_OFFSET,
35900ef5434SJoey Gouly       "RESERVED_SWAPPER_OFFSET is wrong!")
3600188a894SJoey Gouly
3610188a894SJoey Gouly#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
3620188a894SJoey GoulyASSERT(swapper_pg_dir - tramp_pg_dir == TRAMP_SWAPPER_OFFSET,
3630188a894SJoey Gouly       "TRAMP_SWAPPER_OFFSET is wrong!")
3640188a894SJoey Gouly#endif
36519a046f0SPasha Tatashin
36619a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE
36719a046f0SPasha Tatashin/* kexec relocation code should fit into one KEXEC_CONTROL_PAGE_SIZE */
368*6ee3cf6aSArd BiesheuvelASSERT(__relocate_new_kernel_end - __relocate_new_kernel_start <= SZ_4K,
369*6ee3cf6aSArd Biesheuvel       "kexec relocation code is bigger than 4 KiB")
37019a046f0SPasha TatashinASSERT(KEXEC_CONTROL_PAGE_SIZE >= SZ_4K, "KEXEC_CONTROL_PAGE_SIZE is broken")
37119a046f0SPasha Tatashin#endif
372