/* * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) * * Basic test to test behaviour of PR_GET_TSC and PR_SET_TSC */ #include #include #include #include #include #include #include /* Get/set the process' ability to use the timestamp counter instruction */ #ifndef PR_GET_TSC #define PR_GET_TSC 25 #define PR_SET_TSC 26 # define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ #endif const char *tsc_names[] = { [0] = "[not set]", [PR_TSC_ENABLE] = "PR_TSC_ENABLE", [PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV", }; static uint64_t rdtsc(void) { uint32_t lo, hi; /* We cannot use "=A", since this would use %rax on x86_64 */ __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (uint64_t)hi << 32 | lo; } static void sigsegv_cb(int sig) { int tsc_val = 0; printf("[ SIG_SEGV ]\n"); printf("prctl(PR_GET_TSC, &tsc_val); "); fflush(stdout); if ( prctl(PR_GET_TSC, &tsc_val) == -1) perror("prctl"); printf("tsc_val == %s\n", tsc_names[tsc_val]); printf("prctl(PR_SET_TSC, PR_TSC_ENABLE)\n"); fflush(stdout); if ( prctl(PR_SET_TSC, PR_TSC_ENABLE) == -1) perror("prctl"); printf("rdtsc() == "); } int main(void) { int tsc_val = 0; signal(SIGSEGV, sigsegv_cb); printf("rdtsc() == %llu\n", (unsigned long long)rdtsc()); printf("prctl(PR_GET_TSC, &tsc_val); "); fflush(stdout); if ( prctl(PR_GET_TSC, &tsc_val) == -1) perror("prctl"); printf("tsc_val == %s\n", tsc_names[tsc_val]); printf("rdtsc() == %llu\n", (unsigned long long)rdtsc()); printf("prctl(PR_SET_TSC, PR_TSC_ENABLE)\n"); fflush(stdout); if ( prctl(PR_SET_TSC, PR_TSC_ENABLE) == -1) perror("prctl"); printf("rdtsc() == %llu\n", (unsigned long long)rdtsc()); printf("prctl(PR_SET_TSC, PR_TSC_SIGSEGV)\n"); fflush(stdout); if ( prctl(PR_SET_TSC, PR_TSC_SIGSEGV) == -1) perror("prctl"); printf("rdtsc() == "); fflush(stdout); printf("%llu\n", (unsigned long long)rdtsc()); fflush(stdout); exit(EXIT_SUCCESS); } aed1538544f0fa849c5b76c7823469'>diff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2017-01-18 14:29:21 +0100
committerIngo Molnar <mingo@kernel.org>2017-01-19 08:39:44 +0100
commitb5b46c4740aed1538544f0fa849c5b76c7823469 (patch)
tree125e7aced4835bad6f6a0c0d02d012f333caf922 /drivers/usb/phy/phy-qcom-8x16-usb.c
parentfa19a769f82fb9a5ca000b83cacd13fcaeda51ac (diff)
objtool: Fix IRET's opcode
The IRET opcode is 0xcf according to the Intel manual and also to objdump of my vmlinux: 1ea8: 48 cf iretq Fix the opcode in arch_decode_instruction(). The previous value (0xc5) seems to correspond to LDS. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170118132921.19319-1-jslaby@suse.cz Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/usb/phy/phy-qcom-8x16-usb.c')