1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _MCSAFE_TEST_H_
3 #define _MCSAFE_TEST_H_
6 #ifdef CONFIG_MCSAFE_TEST
7 extern unsigned long mcsafe_test_src
;
8 extern unsigned long mcsafe_test_dst
;
10 static inline void mcsafe_inject_src(void *addr
)
13 mcsafe_test_src
= (unsigned long) addr
;
15 mcsafe_test_src
= ~0UL;
18 static inline void mcsafe_inject_dst(void *addr
)
21 mcsafe_test_dst
= (unsigned long) addr
;
23 mcsafe_test_dst
= ~0UL;
25 #else /* CONFIG_MCSAFE_TEST */
26 static inline void mcsafe_inject_src(void *addr
)
30 static inline void mcsafe_inject_dst(void *addr
)
33 #endif /* CONFIG_MCSAFE_TEST */
35 #else /* __ASSEMBLY__ */
36 #include <asm/export.h>
38 #ifdef CONFIG_MCSAFE_TEST
39 .macro MCSAFE_TEST_CTL
42 .globl mcsafe_test_src
45 EXPORT_SYMBOL_GPL(mcsafe_test_src
)
46 .globl mcsafe_test_dst
49 EXPORT_SYMBOL_GPL(mcsafe_test_dst
)
53 .macro MCSAFE_TEST_SRC reg count target
54 leaq \
count(\reg
), %r9
55 cmp mcsafe_test_src
, %r9
59 .macro MCSAFE_TEST_DST reg count target
60 leaq \
count(\reg
), %r9
61 cmp mcsafe_test_dst
, %r9
65 .macro MCSAFE_TEST_CTL
68 .macro MCSAFE_TEST_SRC reg count target
71 .macro MCSAFE_TEST_DST reg count target
73 #endif /* CONFIG_MCSAFE_TEST */
74 #endif /* __ASSEMBLY__ */
75 #endif /* _MCSAFE_TEST_H_ */