]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: mm: move fpregs printing
authorJoey Gouly <joey.gouly@arm.com>
Thu, 22 Aug 2024 15:11:08 +0000 (16:11 +0100)
committerWill Deacon <will@kernel.org>
Wed, 4 Sep 2024 11:54:06 +0000 (12:54 +0100)
arm64's fpregs are not at a constant offset from sigcontext. Since this is
not an important part of the test, don't print the fpregs pointer on arm64.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/r/20240822151113.1479789-26-joey.gouly@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
tools/testing/selftests/mm/pkey-powerpc.h
tools/testing/selftests/mm/pkey-x86.h
tools/testing/selftests/mm/protection_keys.c

index ae5df26104e5fdc0f4fa34073d590f28b5e47114..6275d0f474b35c88e5cc555a90b651404cef4bde 100644 (file)
@@ -9,6 +9,7 @@
 #endif
 #define REG_IP_IDX             PT_NIP
 #define REG_TRAPNO             PT_TRAP
+#define MCONTEXT_FPREGS
 #define gregs                  gp_regs
 #define fpregs                 fp_regs
 #define si_pkey_offset         0x20
index 814758e109c0ba69d3b7bfdc4e116acfc5facbee..b9170a26bfcb2f0ac1f4fa7baaeda29ff1a17bce 100644 (file)
@@ -15,6 +15,8 @@
 
 #endif
 
+#define MCONTEXT_FPREGS
+
 #ifndef PKEY_DISABLE_ACCESS
 # define PKEY_DISABLE_ACCESS   0x1
 #endif
index eaa6d1fc5328f4e4221db7a4c6a0d4178cf22d9b..4337106a985e3fdec2742d95f7330e8279570ff0 100644 (file)
@@ -314,7 +314,9 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)
        ucontext_t *uctxt = vucontext;
        int trapno;
        unsigned long ip;
+#ifdef MCONTEXT_FPREGS
        char *fpregs;
+#endif
 #if defined(__i386__) || defined(__x86_64__) /* arch */
        u32 *pkey_reg_ptr;
        int pkey_reg_offset;
@@ -330,7 +332,9 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)
 
        trapno = uctxt->uc_mcontext.gregs[REG_TRAPNO];
        ip = uctxt->uc_mcontext.gregs[REG_IP_IDX];
+#ifdef MCONTEXT_FPREGS
        fpregs = (char *) uctxt->uc_mcontext.fpregs;
+#endif
 
        dprintf2("%s() trapno: %d ip: 0x%016lx info->si_code: %s/%d\n",
                        __func__, trapno, ip, si_code_str(si->si_code),
@@ -359,7 +363,9 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)
 #endif /* arch */
 
        dprintf1("siginfo: %p\n", si);
+#ifdef MCONTEXT_FPREGS
        dprintf1(" fpregs: %p\n", fpregs);
+#endif
 
        if ((si->si_code == SEGV_MAPERR) ||
            (si->si_code == SEGV_ACCERR) ||