hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/arm64/include/asm/vdso/gettimeofday.h
....@@ -102,6 +102,71 @@
102102 }
103103 #endif
104104
105
+#ifdef CONFIG_GENERIC_CLOCKSOURCE_VDSO
106
+
107
+#include <uapi/linux/fcntl.h>
108
+
109
+extern struct vdso_priv _vdso_priv; /* vdso.lds.S */
110
+
111
+static __always_inline struct vdso_priv *__arch_get_vdso_priv(void)
112
+{
113
+ return &_vdso_priv;
114
+}
115
+
116
+static __always_inline int clock_open_device(const char *path, int mode)
117
+{
118
+ register int sc asm("w8") = __NR_openat;
119
+ register long ret asm("x0");
120
+ register long x0 asm("x0") = AT_FDCWD;
121
+ register long x1 asm("x1") = (long)path;
122
+ register long x2 asm("x2") = mode;
123
+
124
+ asm volatile(
125
+ "svc #0\n"
126
+ : "=r" (ret)
127
+ : "r" (sc),
128
+ "r" (x0), "r" (x1), "r" (x2)
129
+ : "cc", "memory");
130
+
131
+ return ret;
132
+}
133
+
134
+static __always_inline int clock_ioctl_device(int fd, unsigned int cmd, long arg)
135
+{
136
+ register int sc asm("w8") = __NR_ioctl;
137
+ register long ret asm("x0");
138
+ register long x0 asm("x0") = fd;
139
+ register long x1 asm("x1") = cmd;
140
+ register long x2 asm("x2") = arg;
141
+
142
+ asm volatile(
143
+ "svc #0\n"
144
+ : "=r" (ret)
145
+ : "r" (sc),
146
+ "r" (x0), "r" (x1), "r" (x2)
147
+ : "cc", "memory");
148
+
149
+ return ret;
150
+}
151
+
152
+static __always_inline int clock_close_device(int fd)
153
+{
154
+ register int sc asm("w8") = __NR_close;
155
+ register long ret asm("x0");
156
+ register long x0 asm("x0") = fd;
157
+
158
+ asm volatile(
159
+ "svc #0\n"
160
+ : "=r" (ret)
161
+ : "r" (sc),
162
+ "r" (x0)
163
+ : "cc", "memory");
164
+
165
+ return ret;
166
+}
167
+
168
+#endif /* CONFIG_GENERIC_CLOCKSOURCE_VDSO */
169
+
105170 #endif /* !__ASSEMBLY__ */
106171
107172 #endif /* __ASM_VDSO_GETTIMEOFDAY_H */