/* * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) * * Tests if the control register is updated correctly * when set with prctl() * * Warning: this test will cause a very high load for a few seconds * */ #include #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 /* snippet from wikipedia :-) */ 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; } int should_segv = 0; static void sigsegv_cb(int sig) { if (!should_segv) { fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n"); exit(0); } if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0) { perror("prctl"); exit(0); } should_segv = 0; rdtsc(); } static void task(void) { signal(SIGSEGV, sigsegv_cb); alarm(10); for(;;) { rdtsc(); if (should_segv) { fprintf(stderr, "FATAL ERROR, rdtsc() succeeded while disabled\n"); exit(0); } if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0) { perror("prctl"); exit(0); } should_segv = 1; } } int main(void) { int n_tasks = 100, i; fprintf(stderr, "[No further output means we're allright]\n"); for (i=0; ilogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-01-26 17:15:44 +0100
committerJohannes Berg <johannes.berg@intel.com>2017-01-26 18:03:09 +0100
commit228c8c6b1f4376788e9d5ab00d50b10228eb40d3 (patch)
treedfd7010fa9480284fe72bb2c4ab50a5225792a10 /sound/pci/lola
parent731977e97b3697454a862fec656c2561eabc0b87 (diff)
wireless: define cipher/AKM suites using a macro
The spec writes cipher/AKM suites as something like 00-0F-AC:9, but the part after the colon isn't hex, it's decimal, so that we've already had a few mistakes (in other code, or unmerged patches) to e.g. write 0x000FAC10 instead of 0x000FAC0A. Use a macro to avoid that problem. Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'sound/pci/lola')