Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / arm64 / include / asm / kasan.h
blob8758bb008436d4e3fb6a5b119c55fa07d0186bbb
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_KASAN_H
3 #define __ASM_KASAN_H
5 #ifndef __ASSEMBLY__
7 #ifdef CONFIG_KASAN
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);
39 #else
40 static inline void kasan_init(void) { }
41 static inline void kasan_copy_shadow(pgd_t *pgdir) { }
42 #endif
44 #endif
45 #endif