]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
powerpc: Allow relative pointers in bug table entries
authorJordan Niethe <jniethe5@gmail.com>
Tue, 1 Dec 2020 00:52:03 +0000 (11:52 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Dec 2020 14:01:20 +0000 (01:01 +1100)
This enables GENERIC_BUG_RELATIVE_POINTERS on Power so that 32-bit
offsets are stored in the bug entries rather than 64-bit pointers.
While this doesn't save space for 32-bit machines, use it anyway so
there is only one code path.

Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201201005203.15210-1-jniethe5@gmail.com
arch/powerpc/Kconfig
arch/powerpc/include/asm/bug.h
arch/powerpc/xmon/xmon.c

index 8d12da224cb99af3b8e81eb90905fd87996c766d..9e679ba0811cfb4e7a44697cf394f81a2bccdbd4 100644 (file)
@@ -313,6 +313,10 @@ config GENERIC_BUG
        default y
        depends on BUG
 
+config GENERIC_BUG_RELATIVE_POINTERS
+       def_bool y
+       depends on GENERIC_BUG
+
 config SYS_SUPPORTS_APM_EMULATION
        default y if PMAC_APM_EMU
        bool
index 338f36cd9934bc4e4d95ff712e33d83da97a051e..ba0500872cce0bb8c0176c044972e88a9fc20329 100644 (file)
@@ -12,7 +12,7 @@
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 .macro EMIT_BUG_ENTRY addr,file,line,flags
         .section __bug_table,"aw"
-5001:   PPC_LONG \addr, 5002f
+5001:   .4byte \addr - 5001b, 5002f - 5001b
         .short \line, \flags
         .org 5001b+BUG_ENTRY_SIZE
         .previous
@@ -23,7 +23,7 @@
 #else
 .macro EMIT_BUG_ENTRY addr,file,line,flags
         .section __bug_table,"aw"
-5001:   PPC_LONG \addr
+5001:   .4byte \addr - 5001b
         .short \flags
         .org 5001b+BUG_ENTRY_SIZE
         .previous
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 #define _EMIT_BUG_ENTRY                                \
        ".section __bug_table,\"aw\"\n"         \
-       "2:\t" PPC_LONG "1b, %0\n"              \
+       "2:\t.4byte 1b - 2b, %0 - 2b\n"         \
        "\t.short %1, %2\n"                     \
        ".org 2b+%3\n"                          \
        ".previous\n"
 #else
 #define _EMIT_BUG_ENTRY                                \
        ".section __bug_table,\"aw\"\n"         \
-       "2:\t" PPC_LONG "1b\n"                  \
+       "2:\t.4byte 1b - 2b\n"                  \
        "\t.short %2\n"                         \
        ".org 2b+%3\n"                          \
        ".previous\n"
index 5559edf36756c429cae207f58312ca85feced26b..dcd817ca2edfdc321fc15d54895a31de149999d6 100644 (file)
@@ -1747,9 +1747,9 @@ static void print_bug_trap(struct pt_regs *regs)
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
        printf("kernel BUG at %s:%u!\n",
-              bug->file, bug->line);
+              (char *)bug + bug->file_disp, bug->line);
 #else
-       printf("kernel BUG at %px!\n", (void *)bug->bug_addr);
+       printf("kernel BUG at %px!\n", (void *)bug + bug->bug_addr_disp);
 #endif
 #endif /* CONFIG_BUG */
 }