hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/tools/testing/selftests/x86/unwind_vdso.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * unwind_vdso.c - tests unwind info for AT_SYSINFO in the vDSO
34 * Copyright (c) 2014-2015 Andrew Lutomirski
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but
10
- * WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
- * General Public License for more details.
135 *
146 * This tests __kernel_vsyscall's unwind info.
157 */
....@@ -18,6 +10,8 @@
1810
1911 #include <features.h>
2012 #include <stdio.h>
13
+
14
+#include "helpers.h"
2115
2216 #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16
2317
....@@ -44,7 +38,6 @@
4438 #include <stdbool.h>
4539 #include <sys/ptrace.h>
4640 #include <sys/user.h>
47
-#include <sys/ucontext.h>
4841 #include <link.h>
4942 #include <sys/auxv.h>
5043 #include <dlfcn.h>
....@@ -61,27 +54,6 @@
6154 if (sigaction(sig, &sa, 0))
6255 err(1, "sigaction");
6356 }
64
-
65
-#ifdef __x86_64__
66
-# define WIDTH "q"
67
-#else
68
-# define WIDTH "l"
69
-#endif
70
-
71
-static unsigned long get_eflags(void)
72
-{
73
- unsigned long eflags;
74
- asm volatile ("pushf" WIDTH "\n\tpop" WIDTH " %0" : "=rm" (eflags));
75
- return eflags;
76
-}
77
-
78
-static void set_eflags(unsigned long eflags)
79
-{
80
- asm volatile ("push" WIDTH " %0\n\tpopf" WIDTH
81
- : : "rm" (eflags) : "flags");
82
-}
83
-
84
-#define X86_EFLAGS_TF (1UL << 8)
8557
8658 static volatile sig_atomic_t nerrs;
8759 static unsigned long sysinfo;