]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/arm64/kernel/image.h
arm/arm64: crypto: assure that ECB modes don't require an IV
[mirror_ubuntu-zesty-kernel.git] / arch / arm64 / kernel / image.h
CommitLineData
a2c1d73b
MR
1/*
2 * Linker script macros to generate Image header fields.
3 *
4 * Copyright (C) 2014 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef __ASM_IMAGE_H
19#define __ASM_IMAGE_H
20
21#ifndef LINKER_SCRIPT
22#error This file should only be included in vmlinux.lds.S
23#endif
24
25/*
26 * There aren't any ELF relocations we can use to endian-swap values known only
27 * at link time (e.g. the subtraction of two symbol addresses), so we must get
28 * the linker to endian-swap certain values before emitting them.
29 */
30#ifdef CONFIG_CPU_BIG_ENDIAN
31#define DATA_LE64(data) \
32 ((((data) & 0x00000000000000ff) << 56) | \
33 (((data) & 0x000000000000ff00) << 40) | \
34 (((data) & 0x0000000000ff0000) << 24) | \
35 (((data) & 0x00000000ff000000) << 8) | \
36 (((data) & 0x000000ff00000000) >> 8) | \
37 (((data) & 0x0000ff0000000000) >> 24) | \
38 (((data) & 0x00ff000000000000) >> 40) | \
39 (((data) & 0xff00000000000000) >> 56))
40#else
41#define DATA_LE64(data) ((data) & 0xffffffffffffffff)
42#endif
43
44#ifdef CONFIG_CPU_BIG_ENDIAN
45#define __HEAD_FLAG_BE 1
46#else
47#define __HEAD_FLAG_BE 0
48#endif
49
9d372c9f
AB
50#define __HEAD_FLAG_PAGE_SIZE ((PAGE_SHIFT - 10) / 2)
51
52#define __HEAD_FLAGS ((__HEAD_FLAG_BE << 0) | \
53 (__HEAD_FLAG_PAGE_SIZE << 1))
a2c1d73b
MR
54
55/*
56 * These will output as part of the Image header, which should be little-endian
57 * regardless of the endianness of the kernel. While constant values could be
58 * endian swapped in head.S, all are done here for consistency.
59 */
60#define HEAD_SYMBOLS \
61 _kernel_size_le = DATA_LE64(_end - _text); \
62 _kernel_offset_le = DATA_LE64(TEXT_OFFSET); \
63 _kernel_flags_le = DATA_LE64(__HEAD_FLAGS);
64
e8f3010f
AB
65#ifdef CONFIG_EFI
66
75feee3d
AB
67/*
68 * Prevent the symbol aliases below from being emitted into the kallsyms
69 * table, by forcing them to be absolute symbols (which are conveniently
70 * ignored by scripts/kallsyms) rather than section relative symbols.
71 * The distinction is only relevant for partial linking, and only for symbols
72 * that are defined within a section declaration (which is not the case for
73 * the definitions below) so the resulting values will be identical.
74 */
75#define KALLSYMS_HIDE(sym) ABSOLUTE(sym)
76
e8f3010f
AB
77/*
78 * The EFI stub has its own symbol namespace prefixed by __efistub_, to
79 * isolate it from the kernel proper. The following symbols are legally
80 * accessed by the stub, so provide some aliases to make them accessible.
81 * Only include data symbols here, or text symbols of functions that are
82 * guaranteed to be safe when executed at another offset than they were
83 * linked at. The routines below are all implemented in assembler in a
84 * position independent manner
85 */
75feee3d
AB
86__efistub_memcmp = KALLSYMS_HIDE(__pi_memcmp);
87__efistub_memchr = KALLSYMS_HIDE(__pi_memchr);
88__efistub_memcpy = KALLSYMS_HIDE(__pi_memcpy);
89__efistub_memmove = KALLSYMS_HIDE(__pi_memmove);
90__efistub_memset = KALLSYMS_HIDE(__pi_memset);
91__efistub_strlen = KALLSYMS_HIDE(__pi_strlen);
92__efistub_strcmp = KALLSYMS_HIDE(__pi_strcmp);
93__efistub_strncmp = KALLSYMS_HIDE(__pi_strncmp);
94__efistub___flush_dcache_area = KALLSYMS_HIDE(__pi___flush_dcache_area);
e8f3010f 95
39d114dd 96#ifdef CONFIG_KASAN
75feee3d
AB
97__efistub___memcpy = KALLSYMS_HIDE(__pi_memcpy);
98__efistub___memmove = KALLSYMS_HIDE(__pi_memmove);
99__efistub___memset = KALLSYMS_HIDE(__pi_memset);
39d114dd
AR
100#endif
101
75feee3d
AB
102__efistub__text = KALLSYMS_HIDE(_text);
103__efistub__end = KALLSYMS_HIDE(_end);
104__efistub__edata = KALLSYMS_HIDE(_edata);
e8f3010f
AB
105
106#endif
107
a2c1d73b 108#endif /* __ASM_IMAGE_H */