Skip to content

Commit fe76a13

Browse files
committed
parisc: Use natural CPU alignment for bug_table
Make sure that the __bug_table section gets 32- or 64-bit aligned, depending if a 32- or 64-bit kernel is being built. Mark it non-writeable and use .blockz instead of the .org assembler directive to pad the struct. Signed-off-by: Helge Deller <[email protected]> Cc: [email protected] # v6.0+
1 parent c9fcb2b commit fe76a13

File tree

1 file changed

+18
-12
lines changed
  • arch/parisc/include/asm

1 file changed

+18
-12
lines changed

arch/parisc/include/asm/bug.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
do { \
2929
asm volatile("\n" \
3030
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
31-
"\t.pushsection __bug_table,\"aw\"\n" \
31+
"\t.pushsection __bug_table,\"a\"\n" \
32+
"\t.align %4\n" \
3233
"2:\t" ASM_WORD_INSN "1b, %c0\n" \
33-
"\t.short %c1, %c2\n" \
34-
"\t.org 2b+%c3\n" \
34+
"\t.short %1, %2\n" \
35+
"\t.blockz %3-2*%4-2*2\n" \
3536
"\t.popsection" \
3637
: : "i" (__FILE__), "i" (__LINE__), \
37-
"i" (0), "i" (sizeof(struct bug_entry)) ); \
38+
"i" (0), "i" (sizeof(struct bug_entry)), \
39+
"i" (sizeof(long)) ); \
3840
unreachable(); \
3941
} while(0)
4042

@@ -51,27 +53,31 @@
5153
do { \
5254
asm volatile("\n" \
5355
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
54-
"\t.pushsection __bug_table,\"aw\"\n" \
56+
"\t.pushsection __bug_table,\"a\"\n" \
57+
"\t.align %4\n" \
5558
"2:\t" ASM_WORD_INSN "1b, %c0\n" \
56-
"\t.short %c1, %c2\n" \
57-
"\t.org 2b+%c3\n" \
59+
"\t.short %1, %2\n" \
60+
"\t.blockz %3-2*%4-2*2\n" \
5861
"\t.popsection" \
5962
: : "i" (__FILE__), "i" (__LINE__), \
6063
"i" (BUGFLAG_WARNING|(flags)), \
61-
"i" (sizeof(struct bug_entry)) ); \
64+
"i" (sizeof(struct bug_entry)), \
65+
"i" (sizeof(long)) ); \
6266
} while(0)
6367
#else
6468
#define __WARN_FLAGS(flags) \
6569
do { \
6670
asm volatile("\n" \
6771
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
68-
"\t.pushsection __bug_table,\"aw\"\n" \
72+
"\t.pushsection __bug_table,\"a\"\n" \
73+
"\t.align %2\n" \
6974
"2:\t" ASM_WORD_INSN "1b\n" \
70-
"\t.short %c0\n" \
71-
"\t.org 2b+%c1\n" \
75+
"\t.short %0\n" \
76+
"\t.blockz %1-%2-2\n" \
7277
"\t.popsection" \
7378
: : "i" (BUGFLAG_WARNING|(flags)), \
74-
"i" (sizeof(struct bug_entry)) ); \
79+
"i" (sizeof(struct bug_entry)), \
80+
"i" (sizeof(long)) ); \
7581
} while(0)
7682
#endif
7783

0 commit comments

Comments
 (0)