diff options
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 13 | ||||
-rw-r--r-- | include/asm-powerpc/bug.h | 27 |
3 files changed, 32 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index e96521530d21..030d300cd71c 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -303,5 +303,8 @@ int main(void) | |||
303 | DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); | 303 | DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); |
304 | DEFINE(CLOCK_REALTIME_RES, TICK_NSEC); | 304 | DEFINE(CLOCK_REALTIME_RES, TICK_NSEC); |
305 | 305 | ||
306 | #ifdef CONFIG_BUG | ||
307 | DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); | ||
308 | #endif | ||
306 | return 0; | 309 | return 0; |
307 | } | 310 | } |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 1a3d4de197d2..2551c0884afc 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/asm-offsets.h> | 28 | #include <asm/asm-offsets.h> |
29 | #include <asm/cputable.h> | 29 | #include <asm/cputable.h> |
30 | #include <asm/firmware.h> | 30 | #include <asm/firmware.h> |
31 | #include <asm/bug.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * System calls. | 34 | * System calls. |
@@ -634,19 +635,15 @@ _GLOBAL(enter_rtas) | |||
634 | li r0,0 | 635 | li r0,0 |
635 | mtcr r0 | 636 | mtcr r0 |
636 | 637 | ||
638 | #ifdef CONFIG_BUG | ||
637 | /* There is no way it is acceptable to get here with interrupts enabled, | 639 | /* There is no way it is acceptable to get here with interrupts enabled, |
638 | * check it with the asm equivalent of WARN_ON | 640 | * check it with the asm equivalent of WARN_ON |
639 | */ | 641 | */ |
640 | lbz r0,PACASOFTIRQEN(r13) | 642 | lbz r0,PACASOFTIRQEN(r13) |
641 | 1: tdnei r0,0 | 643 | 1: tdnei r0,0 |
642 | .section __bug_table,"a" | 644 | EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING |
643 | .llong 1b,__LINE__ + 0x1000000, 1f, 2f | 645 | #endif |
644 | .previous | 646 | |
645 | .section .rodata,"a" | ||
646 | 1: .asciz __FILE__ | ||
647 | 2: .asciz "enter_rtas" | ||
648 | .previous | ||
649 | |||
650 | /* Hard-disable interrupts */ | 647 | /* Hard-disable interrupts */ |
651 | mfmsr r6 | 648 | mfmsr r6 |
652 | rldicl r7,r6,48,1 | 649 | rldicl r7,r6,48,1 |
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index 709568879f73..f6fa39474846 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h | |||
@@ -11,10 +11,31 @@ | |||
11 | #define BUG_OPCODE .long 0x00b00b00 /* For asm */ | 11 | #define BUG_OPCODE .long 0x00b00b00 /* For asm */ |
12 | #define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */ | 12 | #define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */ |
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | #ifdef CONFIG_BUG | 14 | #ifdef CONFIG_BUG |
17 | 15 | ||
16 | #ifdef __ASSEMBLY__ | ||
17 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
18 | .macro EMIT_BUG_ENTRY addr,file,line,flags | ||
19 | .section __bug_table,"a" | ||
20 | 5001: PPC_LONG \addr, 5002f | ||
21 | .short \line, \flags | ||
22 | .org 5001b+BUG_ENTRY_SIZE | ||
23 | .previous | ||
24 | .section .rodata,"a" | ||
25 | 5002: .asciz "\file" | ||
26 | .previous | ||
27 | .endm | ||
28 | #else | ||
29 | .macro EMIT_BUG_ENTRY addr,file,line,flags | ||
30 | .section __bug_table,"a" | ||
31 | 5001: PPC_LONG \addr | ||
32 | .short \flags | ||
33 | .org 5001b+BUG_ENTRY_SIZE | ||
34 | .previous | ||
35 | .endm | ||
36 | #endif /* verbose */ | ||
37 | |||
38 | #else /* !__ASSEMBLY__ */ | ||
18 | /* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and | 39 | /* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and |
19 | sizeof(struct bug_entry), respectively */ | 40 | sizeof(struct bug_entry), respectively */ |
20 | #ifdef CONFIG_DEBUG_BUGVERBOSE | 41 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
@@ -91,8 +112,8 @@ | |||
91 | #define HAVE_ARCH_BUG | 112 | #define HAVE_ARCH_BUG |
92 | #define HAVE_ARCH_BUG_ON | 113 | #define HAVE_ARCH_BUG_ON |
93 | #define HAVE_ARCH_WARN_ON | 114 | #define HAVE_ARCH_WARN_ON |
94 | #endif /* CONFIG_BUG */ | ||
95 | #endif /* __ASSEMBLY __ */ | 115 | #endif /* __ASSEMBLY __ */ |
116 | #endif /* CONFIG_BUG */ | ||
96 | 117 | ||
97 | #include <asm-generic/bug.h> | 118 | #include <asm-generic/bug.h> |
98 | 119 | ||