xref: /linux/tools/testing/selftests/bpf/progs/bpf_test_utils.h (revision 4f38da1f027ea2c9f01bb71daa7a299c191b6940)
1*12741630SIlya Leoshkevich /* SPDX-License-Identifier: GPL-2.0 */
2*12741630SIlya Leoshkevich #ifndef __BPF_TEST_UTILS_H__
3*12741630SIlya Leoshkevich #define __BPF_TEST_UTILS_H__
4*12741630SIlya Leoshkevich 
5*12741630SIlya Leoshkevich #include <bpf/bpf_helpers.h>
6*12741630SIlya Leoshkevich #include "bpf_misc.h"
7*12741630SIlya Leoshkevich 
8*12741630SIlya Leoshkevich /* Clobber as many native registers and stack slots as possible. */
9*12741630SIlya Leoshkevich static __always_inline void clobber_regs_stack(void)
10*12741630SIlya Leoshkevich {
11*12741630SIlya Leoshkevich 	char tmp_str[] = "123456789";
12*12741630SIlya Leoshkevich 	unsigned long tmp;
13*12741630SIlya Leoshkevich 
14*12741630SIlya Leoshkevich 	bpf_strtoul(tmp_str, sizeof(tmp_str), 0, &tmp);
15*12741630SIlya Leoshkevich 	__sink(tmp);
16*12741630SIlya Leoshkevich }
17*12741630SIlya Leoshkevich 
18*12741630SIlya Leoshkevich #endif
19