summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/mach-common/entry.S7
-rw-r--r--include/asm-blackfin/trace.h4
2 files changed, 8 insertions, 3 deletions
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index cee54cebbc65..a504c65d9990 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -121,10 +121,14 @@ ENTRY(_ex_icplb_miss)
(R7:6,P5:4) = [sp++];
ASTAT = [sp++];
SAVE_ALL_SYS
- DEBUG_HWTRACE_SAVE(p5, r7)
#ifdef CONFIG_MPU
+ /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
+ * will change the stack pointer. */
R0 = SEQSTAT;
R1 = SP;
+#endif
+ DEBUG_HWTRACE_SAVE(p5, r7)
+#ifdef CONFIG_MPU
sp += -12;
call _cplb_hdr;
sp += 12;
@@ -191,6 +195,7 @@ ENTRY(_bfin_return_from_exception)
ENDPROC(_bfin_return_from_exception)
ENTRY(_handle_bad_cplb)
+ DEBUG_HWTRACE_RESTORE(p5, r7)
/* To get here, we just tried and failed to change a CPLB
* so, handle things in trap_c (C code), by lowering to
* IRQ5, just like we normally do. Since this is not a
diff --git a/include/asm-blackfin/trace.h b/include/asm-blackfin/trace.h
index ef18afbc2101..312b596b9731 100644
--- a/include/asm-blackfin/trace.h
+++ b/include/asm-blackfin/trace.h
@@ -62,14 +62,14 @@ extern unsigned long software_trace_buff[];
preg.L = LO(TBUFCTL); \
preg.H = HI(TBUFCTL); \
dreg = [preg]; \
- [sp++] = dreg; \
+ [--sp] = dreg; \
dreg = 0x1; \
[preg] = dreg;
#define trace_buffer_restore(preg, dreg) \
preg.L = LO(TBUFCTL); \
preg.H = HI(TBUFCTL); \
- dreg = [sp--]; \
+ dreg = [sp++]; \
[preg] = dreg;
#else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
OpenPOWER on IntegriCloud