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); \ 1181c9a8e87SArd Biesheuvel __entry_tramp_text_end = .; \ 1191c9a8e87SArd Biesheuvel *(.entry.tramp.rodata) 120c7b9adafSWill Deacon#else 121c7b9adafSWill Deacon#define TRAMP_TEXT 122c7b9adafSWill Deacon#endif 123c7b9adafSWill Deacon 124*68c76ad4SArd Biesheuvel#ifdef CONFIG_UNWIND_TABLES 125*68c76ad4SArd Biesheuvel#define UNWIND_DATA_SECTIONS \ 126*68c76ad4SArd Biesheuvel .eh_frame : { \ 127*68c76ad4SArd Biesheuvel __eh_frame_start = .; \ 128*68c76ad4SArd Biesheuvel *(.eh_frame) \ 129*68c76ad4SArd Biesheuvel __eh_frame_end = .; \ 130*68c76ad4SArd Biesheuvel } 131*68c76ad4SArd Biesheuvel#else 132*68c76ad4SArd Biesheuvel#define UNWIND_DATA_SECTIONS 133*68c76ad4SArd Biesheuvel#endif 134*68c76ad4SArd Biesheuvel 135a352ea3eSArd Biesheuvel/* 136a352ea3eSArd Biesheuvel * The size of the PE/COFF section that covers the kernel image, which 137348a625dSArd Biesheuvel * runs from _stext to _edata, must be a round multiple of the PE/COFF 138348a625dSArd Biesheuvel * FileAlignment, which we set to its minimum value of 0x200. '_stext' 139a352ea3eSArd Biesheuvel * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned 140a352ea3eSArd Biesheuvel * boundary should be sufficient. 141a352ea3eSArd Biesheuvel */ 142a352ea3eSArd BiesheuvelPECOFF_FILE_ALIGNMENT = 0x200; 143a352ea3eSArd Biesheuvel 144a352ea3eSArd Biesheuvel#ifdef CONFIG_EFI 145a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING \ 146a352ea3eSArd Biesheuvel .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); } 147a352ea3eSArd Biesheuvel#else 148a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING 149a352ea3eSArd Biesheuvel#endif 150a352ea3eSArd Biesheuvel 1518c2c3df3SCatalin MarinasSECTIONS 1528c2c3df3SCatalin Marinas{ 1538c2c3df3SCatalin Marinas /* 1548c2c3df3SCatalin Marinas * XXX: The linker does not define how output sections are 1558c2c3df3SCatalin Marinas * assigned to input sections when there are multiple statements 1568c2c3df3SCatalin Marinas * matching the same input section name. There is no documented 1578c2c3df3SCatalin Marinas * order of matching. 1588c2c3df3SCatalin Marinas */ 1592883352bSKees Cook DISCARDS 1608c2c3df3SCatalin Marinas /DISCARD/ : { 1611e48ef7fSArd Biesheuvel *(.interp .dynamic) 1623bbd3db8SArd Biesheuvel *(.dynsym .dynstr .hash .gnu.hash) 1638c2c3df3SCatalin Marinas } 1648c2c3df3SCatalin Marinas 165120dc60dSArd Biesheuvel . = KIMAGE_VADDR; 1668c2c3df3SCatalin Marinas 1678c2c3df3SCatalin Marinas .head.text : { 1688c2c3df3SCatalin Marinas _text = .; 1698c2c3df3SCatalin Marinas HEAD_TEXT 1708c2c3df3SCatalin Marinas } 171e2a073ddSArd Biesheuvel .text : ALIGN(SEGMENT_ALIGN) { /* Real text segment */ 1728c2c3df3SCatalin Marinas _stext = .; /* Text and read-only data */ 1738c2c3df3SCatalin Marinas IRQENTRY_TEXT 174be7635e7SAlexander Potapenko SOFTIRQENTRY_TEXT 175888b3c87SPratyush Anand ENTRY_TEXT 1768c2c3df3SCatalin Marinas TEXT_TEXT 1778c2c3df3SCatalin Marinas SCHED_TEXT 1786727ad9eSChris Metcalf CPUIDLE_TEXT 1798c2c3df3SCatalin Marinas LOCK_TEXT 1802dd0e8d2SSandeepa Prabhu KPROBES_TEXT 1812240bbb6SMarc Zyngier HYPERVISOR_TEXT 1825dfe9d7dSArd Biesheuvel IDMAP_TEXT 1838c2c3df3SCatalin Marinas *(.gnu.warning) 1848c2c3df3SCatalin Marinas . = ALIGN(16); 1858c2c3df3SCatalin Marinas *(.got) /* Global offset table */ 1868c2c3df3SCatalin Marinas } 1878c2c3df3SCatalin Marinas 188be288182SKees Cook /* 189be288182SKees Cook * Make sure that the .got.plt is either completely empty or it 190be288182SKees Cook * contains only the lazy dispatch entries. 191be288182SKees Cook */ 192be288182SKees Cook .got.plt : { *(.got.plt) } 193be288182SKees Cook ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, 194be288182SKees Cook "Unexpected GOT/PLT entries detected!") 195be288182SKees Cook 19697740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 1979fdc14c5SArd Biesheuvel _etext = .; /* End of text section */ 1989fdc14c5SArd Biesheuvel 19919f6bc32SKees Cook /* everything from this point to __init_begin will be marked RO NX */ 20019f6bc32SKees Cook RO_DATA(PAGE_SIZE) 2018c2c3df3SCatalin Marinas 202eb48d154SMarc Zyngier HYPERVISOR_DATA_SECTIONS 203eb48d154SMarc Zyngier 2046ee3cf6aSArd Biesheuvel /* code sections that are never executed via the kernel mapping */ 2056ee3cf6aSArd Biesheuvel .rodata.text : { 2066ee3cf6aSArd Biesheuvel TRAMP_TEXT 2076ee3cf6aSArd Biesheuvel HIBERNATE_TEXT 2086ee3cf6aSArd Biesheuvel KEXEC_TEXT 2096ee3cf6aSArd Biesheuvel . = ALIGN(PAGE_SIZE); 2106ee3cf6aSArd Biesheuvel } 2116ee3cf6aSArd Biesheuvel 2128eb7e28dSJun Yao idmap_pg_dir = .; 213c3cee924SArd Biesheuvel . += PAGE_SIZE; 2148eb7e28dSJun Yao 2158eb7e28dSJun Yao#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 2168eb7e28dSJun Yao tramp_pg_dir = .; 2178eb7e28dSJun Yao . += PAGE_SIZE; 2188eb7e28dSJun Yao#endif 2198eb7e28dSJun Yao 220833be850SMark Rutland reserved_pg_dir = .; 221833be850SMark Rutland . += PAGE_SIZE; 222833be850SMark Rutland 2238eb7e28dSJun Yao swapper_pg_dir = .; 2248eb7e28dSJun Yao . += PAGE_SIZE; 2258eb7e28dSJun Yao 22697740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2278c2c3df3SCatalin Marinas __init_begin = .; 2282ebe088bSArd Biesheuvel __inittext_begin = .; 2298c2c3df3SCatalin Marinas 2308c2c3df3SCatalin Marinas INIT_TEXT_SECTION(8) 231ca2ef4ffSMark Rutland 232ca2ef4ffSMark Rutland __exittext_begin = .; 2338c2c3df3SCatalin Marinas .exit.text : { 2341eae811dSArd Biesheuvel EXIT_TEXT 2358c2c3df3SCatalin Marinas } 236ca2ef4ffSMark Rutland __exittext_end = .; 237da141706SLaura Abbott 2382ebe088bSArd Biesheuvel . = ALIGN(4); 2392ebe088bSArd Biesheuvel .altinstructions : { 2402ebe088bSArd Biesheuvel __alt_instructions = .; 2412ebe088bSArd Biesheuvel *(.altinstructions) 2422ebe088bSArd Biesheuvel __alt_instructions_end = .; 2432ebe088bSArd Biesheuvel } 2442ebe088bSArd Biesheuvel 245*68c76ad4SArd Biesheuvel UNWIND_DATA_SECTIONS 246*68c76ad4SArd Biesheuvel 24776085affSArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2482ebe088bSArd Biesheuvel __inittext_end = .; 2492ebe088bSArd Biesheuvel __initdata_begin = .; 2502ebe088bSArd Biesheuvel 251c3cee924SArd Biesheuvel init_idmap_pg_dir = .; 252c3cee924SArd Biesheuvel . += INIT_IDMAP_DIR_SIZE; 253c3cee924SArd Biesheuvel init_idmap_pg_end = .; 254c3cee924SArd Biesheuvel 2558c2c3df3SCatalin Marinas .init.data : { 2568c2c3df3SCatalin Marinas INIT_DATA 2578c2c3df3SCatalin Marinas INIT_SETUP(16) 2588c2c3df3SCatalin Marinas INIT_CALLS 2598c2c3df3SCatalin Marinas CON_INITCALL 2608c2c3df3SCatalin Marinas INIT_RAM_FS 261ba4259a6SCatalin Marinas *(.init.altinstructions .init.bss) /* from the EFI stub */ 2628c2c3df3SCatalin Marinas } 2638c2c3df3SCatalin Marinas .exit.data : { 2641eae811dSArd Biesheuvel EXIT_DATA 2658c2c3df3SCatalin Marinas } 2668c2c3df3SCatalin Marinas 26798fb7548SArd Biesheuvel PERCPU_SECTION(L1_CACHE_BYTES) 26830c95391SDavid Brazdil HYPERVISOR_PERCPU_SECTION 2698c2c3df3SCatalin Marinas 2708c49b5d4SDavid Brazdil HYPERVISOR_RELOC_SECTION 2718c49b5d4SDavid Brazdil 2723bbd3db8SArd Biesheuvel .rela.dyn : ALIGN(8) { 273d7bea550SArd Biesheuvel __rela_start = .; 2741e48ef7fSArd Biesheuvel *(.rela .rela*) 275d7bea550SArd Biesheuvel __rela_end = .; 2761e48ef7fSArd Biesheuvel } 277e039ee4eSAndre Przywara 2785cf896fbSPeter Collingbourne .relr.dyn : ALIGN(8) { 279d7bea550SArd Biesheuvel __relr_start = .; 2805cf896fbSPeter Collingbourne *(.relr.dyn) 281d7bea550SArd Biesheuvel __relr_end = .; 2825cf896fbSPeter Collingbourne } 2835cf896fbSPeter Collingbourne 28497740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2852ebe088bSArd Biesheuvel __initdata_end = .; 2869aa4ec15SMark Rutland __init_end = .; 2879aa4ec15SMark Rutland 2883c620626SMark Salter _data = .; 2898c2c3df3SCatalin Marinas _sdata = .; 290c9174047SKees Cook RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN) 291b6113038SJames Morse 292b6113038SJames Morse /* 293b6113038SJames Morse * Data written with the MMU off but read with the MMU on requires 294b6113038SJames Morse * cache lines to be invalidated, discarding up to a Cache Writeback 295b6113038SJames Morse * Granule (CWG) of data from the cache. Keep the section that 296b6113038SJames Morse * requires this type of maintenance to be in its own Cache Writeback 297b6113038SJames Morse * Granule (CWG) area so the cache maintenance operations don't 298b6113038SJames Morse * interfere with adjacent data. 299b6113038SJames Morse */ 300b6113038SJames Morse .mmuoff.data.write : ALIGN(SZ_2K) { 301b6113038SJames Morse __mmuoff_data_start = .; 302b6113038SJames Morse *(.mmuoff.data.write) 303b6113038SJames Morse } 304b6113038SJames Morse . = ALIGN(SZ_2K); 305b6113038SJames Morse .mmuoff.data.read : { 306b6113038SJames Morse *(.mmuoff.data.read) 307b6113038SJames Morse __mmuoff_data_end = .; 308b6113038SJames Morse } 309b6113038SJames Morse 310a352ea3eSArd Biesheuvel PECOFF_EDATA_PADDING 311cad27ef2SArd Biesheuvel __pecoff_data_rawsize = ABSOLUTE(. - __initdata_begin); 3128c2c3df3SCatalin Marinas _edata = .; 3138c2c3df3SCatalin Marinas 314380e18adSQuentin Perret BSS_SECTION(SBSS_ALIGN, 0, 0) 315bd00cd5fSMark Rutland 316bd00cd5fSMark Rutland . = ALIGN(PAGE_SIZE); 3172b5548b6SJun Yao init_pg_dir = .; 3182b5548b6SJun Yao . += INIT_DIR_SIZE; 3192b5548b6SJun Yao init_pg_end = .; 3202b5548b6SJun Yao 32176085affSArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 322cad27ef2SArd Biesheuvel __pecoff_data_size = ABSOLUTE(. - __initdata_begin); 3238c2c3df3SCatalin Marinas _end = .; 3248c2c3df3SCatalin Marinas 3258c2c3df3SCatalin Marinas STABS_DEBUG 326578d7f0fSKees Cook DWARF_DEBUG 327c604abc3SKees Cook ELF_DETAILS 328a2c1d73bSMark Rutland 329a2c1d73bSMark Rutland HEAD_SYMBOLS 330be288182SKees Cook 331be288182SKees Cook /* 332be288182SKees Cook * Sections that should stay zero sized, which is safer to 333be288182SKees Cook * explicitly check instead of blindly discarding. 334be288182SKees Cook */ 335be288182SKees Cook .plt : { 3365f692a81SArd Biesheuvel *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt) 337be288182SKees Cook } 338be288182SKees Cook ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") 339be288182SKees Cook 340be288182SKees Cook .data.rel.ro : { *(.data.rel.ro) } 341be288182SKees Cook ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!") 3428c2c3df3SCatalin Marinas} 3432240bbb6SMarc Zyngier 34490776dd1SKees Cook#include "image-vars.h" 34590776dd1SKees Cook 3462240bbb6SMarc Zyngier/* 347b83042f0SQuentin Perret * The HYP init code and ID map text can't be longer than a page each. The 348b83042f0SQuentin Perret * former is page-aligned, but the latter may not be with 16K or 64K pages, so 349b83042f0SQuentin Perret * it should also not cross a page boundary. 3502240bbb6SMarc Zyngier */ 351b83042f0SQuentin PerretASSERT(__hyp_idmap_text_end - __hyp_idmap_text_start <= PAGE_SIZE, 352b83042f0SQuentin Perret "HYP init code too big") 3535dfe9d7dSArd BiesheuvelASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K, 3545dfe9d7dSArd Biesheuvel "ID map text too big or misaligned") 35582869ac5SJames Morse#ifdef CONFIG_HIBERNATION 3566ee3cf6aSArd BiesheuvelASSERT(__hibernate_exit_text_end - __hibernate_exit_text_start <= SZ_4K, 3576ee3cf6aSArd Biesheuvel "Hibernate exit text is bigger than 4 KiB") 35882869ac5SJames Morse#endif 3596c27c408SWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 360a9c406e6SJames MorseASSERT((__entry_tramp_text_end - __entry_tramp_text_start) <= 3*PAGE_SIZE, 3616c27c408SWill Deacon "Entry trampoline text too big") 3626c27c408SWill Deacon#endif 363380e18adSQuentin Perret#ifdef CONFIG_KVM 364380e18adSQuentin PerretASSERT(__hyp_bss_start == __bss_start, "HYP and Host BSS are misaligned") 365380e18adSQuentin Perret#endif 366da57a369SMark Rutland/* 367da57a369SMark Rutland * If padding is applied before .head.text, virt<->phys conversions will fail. 368da57a369SMark Rutland */ 369120dc60dSArd BiesheuvelASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned") 37000ef5434SJoey Gouly 37100ef5434SJoey GoulyASSERT(swapper_pg_dir - reserved_pg_dir == RESERVED_SWAPPER_OFFSET, 37200ef5434SJoey Gouly "RESERVED_SWAPPER_OFFSET is wrong!") 3730188a894SJoey Gouly 3740188a894SJoey Gouly#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 3750188a894SJoey GoulyASSERT(swapper_pg_dir - tramp_pg_dir == TRAMP_SWAPPER_OFFSET, 3760188a894SJoey Gouly "TRAMP_SWAPPER_OFFSET is wrong!") 3770188a894SJoey Gouly#endif 37819a046f0SPasha Tatashin 37919a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE 38019a046f0SPasha Tatashin/* kexec relocation code should fit into one KEXEC_CONTROL_PAGE_SIZE */ 3816ee3cf6aSArd BiesheuvelASSERT(__relocate_new_kernel_end - __relocate_new_kernel_start <= SZ_4K, 3826ee3cf6aSArd Biesheuvel "kexec relocation code is bigger than 4 KiB") 38319a046f0SPasha TatashinASSERT(KEXEC_CONTROL_PAGE_SIZE >= SZ_4K, "KEXEC_CONTROL_PAGE_SIZE is broken") 38419a046f0SPasha Tatashin#endif 385