1 /* SPDX-License-Identifier: GPL-2.0 */
9 #include <linux/linkage.h>
10 #include <asm/memory.h>
11 #include <asm/pgtable-types.h>
14 * KASAN_SHADOW_START: beginning of the kernel virtual addresses.
15 * KASAN_SHADOW_END: KASAN_SHADOW_START + 1/N of kernel virtual addresses,
16 * where N = (1 << KASAN_SHADOW_SCALE_SHIFT).
18 #define KASAN_SHADOW_START (VA_START)
19 #define KASAN_SHADOW_END (KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
22 * This value is used to map an address to the corresponding shadow
23 * address by the following formula:
24 * shadow_addr = (address >> KASAN_SHADOW_SCALE_SHIFT) + KASAN_SHADOW_OFFSET
26 * (1 << (64 - KASAN_SHADOW_SCALE_SHIFT)) shadow addresses that lie in range
27 * [KASAN_SHADOW_OFFSET, KASAN_SHADOW_END) cover all 64-bits of virtual
28 * addresses. So KASAN_SHADOW_OFFSET should satisfy the following equation:
29 * KASAN_SHADOW_OFFSET = KASAN_SHADOW_END -
30 * (1ULL << (64 - KASAN_SHADOW_SCALE_SHIFT))
32 #define KASAN_SHADOW_OFFSET (KASAN_SHADOW_END - (1ULL << \
33 (64 - KASAN_SHADOW_SCALE_SHIFT)))
35 void kasan_init(void);
36 void kasan_copy_shadow(pgd_t
*pgdir
);
37 asmlinkage
void kasan_early_init(void);
40 static inline void kasan_init(void) { }
41 static inline void kasan_copy_shadow(pgd_t
*pgdir
) { }