Commit | Line | Data |
---|---|---|
a866f568 MS |
1 | /* |
2 | * Userspace implementations of fallback calls | |
3 | * | |
4 | * Copyright (C) 2017 Cavium, Inc. | |
5 | * Copyright (C) 2012 ARM Limited | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License version 2 as | |
9 | * published by the Free Software Foundation. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | * | |
19 | * Author: Will Deacon <will.deacon@arm.com> | |
20 | * Rewriten into C by: Andrew Pinski <apinski@cavium.com> | |
21 | */ | |
22 | ||
23 | #ifndef __VDSO_COMPILER_H | |
24 | #define __VDSO_COMPILER_H | |
25 | ||
26 | #include <asm/arch_timer.h> /* for arch_counter_get_cntvct() */ | |
27 | #include <asm/processor.h> /* for cpu_relax() */ | |
28 | #include <asm/unistd.h> | |
29 | #include <linux/compiler.h> | |
f21c33d6 | 30 | #include <linux/time.h> /* for NSEC_PER_SEC */ |
a866f568 MS |
31 | |
32 | #ifndef CONFIG_AEABI | |
33 | #error This code depends on AEABI system call conventions | |
34 | #endif | |
35 | ||
36 | #define DEFINE_FALLBACK(name, type_arg1, name_arg1, type_arg2, name_arg2) \ | |
37 | static notrace long name##_fallback(type_arg1 _##name_arg1, \ | |
38 | type_arg2 _##name_arg2) \ | |
39 | { \ | |
40 | register type_arg1 name_arg1 asm("r0") = _##name_arg1; \ | |
41 | register type_arg2 name_arg2 asm("r1") = _##name_arg2; \ | |
42 | register long ret asm ("r0"); \ | |
43 | register long nr asm("r7") = __NR_##name; \ | |
44 | \ | |
45 | asm volatile( \ | |
46 | " swi #0\n" \ | |
47 | : "=r" (ret) \ | |
48 | : "r" (name_arg1), "r" (name_arg2), "r" (nr) \ | |
49 | : "memory"); \ | |
50 | \ | |
51 | return ret; \ | |
52 | } | |
53 | ||
54 | #define arch_vdso_read_counter() arch_counter_get_cntvct() | |
55 | ||
56 | /* Avoid unresolved references emitted by GCC */ | |
57 | ||
58 | void __aeabi_unwind_cpp_pr0(void) | |
59 | { | |
60 | } | |
61 | ||
62 | void __aeabi_unwind_cpp_pr1(void) | |
63 | { | |
64 | } | |
65 | ||
66 | void __aeabi_unwind_cpp_pr2(void) | |
67 | { | |
68 | } | |
69 | ||
70 | #endif /* __VDSO_COMPILER_H */ |