|
@@ -27,19 +27,20 @@
|
|
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
|
|
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-uint64_t rdtsc() {
|
|
|
|
|
|
+static uint64_t rdtsc(void)
|
|
|
|
+{
|
|
uint32_t lo, hi;
|
|
uint32_t lo, hi;
|
|
/* We cannot use "=A", since this would use %rax on x86_64 */
|
|
/* We cannot use "=A", since this would use %rax on x86_64 */
|
|
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
|
|
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
|
|
return (uint64_t)hi << 32 | lo;
|
|
return (uint64_t)hi << 32 | lo;
|
|
}
|
|
}
|
|
|
|
|
|
-void sigsegv_expect(int sig)
|
|
|
|
|
|
+static void sigsegv_expect(int sig)
|
|
{
|
|
{
|
|
/* */
|
|
/* */
|
|
}
|
|
}
|
|
|
|
|
|
-void segvtask(void)
|
|
|
|
|
|
+static void segvtask(void)
|
|
{
|
|
{
|
|
if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0)
|
|
if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0)
|
|
{
|
|
{
|
|
@@ -54,13 +55,13 @@ void segvtask(void)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-void sigsegv_fail(int sig)
|
|
|
|
|
|
+static void sigsegv_fail(int sig)
|
|
{
|
|
{
|
|
fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n");
|
|
fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n");
|
|
exit(0);
|
|
exit(0);
|
|
}
|
|
}
|
|
|
|
|
|
-void rdtsctask(void)
|
|
|
|
|
|
+static void rdtsctask(void)
|
|
{
|
|
{
|
|
if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0)
|
|
if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0)
|
|
{
|
|
{
|