1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright 2023 Google LLC
3 // Author: Ard Biesheuvel <ardb@google.com>
5 #include <linux/types.h>
7 #define __prel64_initconst __section(".init.rodata.prel64")
9 #define PREL64(type, name) union { type *name; prel64_t name ## _prel; }
11 #define prel64_pointer(__d) (typeof(__d))prel64_to_pointer(&__d##_prel)
13 typedef volatile signed long prel64_t
;
15 static inline void *prel64_to_pointer(const prel64_t
*offset
)
19 return (void *)offset
+ *offset
;
22 extern bool dynamic_scs_is_enabled
;
24 extern pgd_t init_idmap_pg_dir
[], init_idmap_pg_end
[];
26 void init_feature_override(u64 boot_status
, const void *fdt
, int chosen
);
27 u64
kaslr_early_init(void *fdt
, int chosen
);
28 void relocate_kernel(u64 offset
);
29 int scs_patch(const u8 eh_frame
[], int size
);
31 void map_range(u64
*pgd
, u64 start
, u64 end
, u64 pa
, pgprot_t prot
,
32 int level
, pte_t
*tbl
, bool may_use_cont
, u64 va_offset
);
34 asmlinkage
void early_map_kernel(u64 boot_status
, void *fdt
);
36 asmlinkage u64
create_init_idmap(pgd_t
*pgd
, pteval_t clrmask
);