Skip to content

Commit

Permalink
Skip trap_cpuid_test on old kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Feb 23, 2023
1 parent bbac69d commit e6539a8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/func/trap_cpuid_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ int main(int argc, char *argv[]) {
int ax, bx, cx, dx;
ax = cx = 0;
asm volatile("cpuid" : "+a"(ax), "=b"(bx), "+c"(cx), "=d"(dx));
if (syscall(SYS_arch_prctl, ARCH_GET_CPUID_) != 1) return 1;
if (syscall(SYS_arch_prctl, ARCH_SET_CPUID_, 0) != 0) return 2;
if (syscall(SYS_arch_prctl, ARCH_GET_CPUID_) != 1 ||
syscall(SYS_arch_prctl, ARCH_SET_CPUID_, 0) != 0) {
fprintf(stderr, "skipping %s\n", argv[0]);
return 0;
}
if (syscall(SYS_arch_prctl, ARCH_GET_CPUID_) != 0) return 3;
struct sigaction sa = {.sa_sigaction = OnSigSegv};
if (sigaction(SIGSEGV, &sa, 0)) return 4;
Expand Down

0 comments on commit e6539a8

Please sign in to comment.