diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-04-24 13:23:03 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-04-24 13:23:03 +0000 |
| commit | 75c66218401c00f4728d5312e2b933b8d3aefde1 (patch) | |
| tree | bc7580aa37288ebb1006fd834bd3eb37e9669300 | |
| parent | e0751ae801b3e29c6dd52905ef1d63d5cd643b0a (diff) | |
tests/posixshm: Check for hardware support in largepage_pkru
MFC after: 3 days
Fixes: ca87c0b8e396 ("pkru: Fix handling of 1GB largepage mappings")
| -rw-r--r-- | tests/sys/posixshm/posixshm_test.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/sys/posixshm/posixshm_test.c b/tests/sys/posixshm/posixshm_test.c index 8333faa90594..fe6386c6aa4b 100644 --- a/tests/sys/posixshm/posixshm_test.c +++ b/tests/sys/posixshm/posixshm_test.c @@ -39,6 +39,8 @@ #include <sys/wait.h> #ifdef __amd64__ +#include <machine/cpufunc.h> +#include <machine/specialreg.h> #include <machine/sysarch.h> #endif @@ -1966,6 +1968,14 @@ ATF_TC_BODY(largepage_pkru, tc) struct sigaction sa; char *addr, *addr1; int error, fd, pscnt; + u_int regs[4]; + + do_cpuid(0, regs); + if (regs[0] < 7) + atf_tc_skip("PKU not supported"); + cpuid_count(7, 0, regs); + if ((regs[2] & CPUID_STDEXT2_PKU) == 0) + atf_tc_skip("PKU not supported"); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = sigsegv; |
