mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
2a0c4fdb66
There were a couple of problems with the way the trace buffer state is saved/restored in assembly. The DEBUG_HWTRACE_SAVE/RESTORE macros save a value to the stack, which is not immediately obvious; the CPLB exception code needed changes to load the correct value of the stack pointer. The other problem is that the SAVE/RESTORE macros weren't pushing and popping the value downwards on the stack, but rather moving it _upwards_, which is of course completely broken. We also need to make sure there's a matching DEBUG_HWTRACE_RESTORE in the error case of the CPLB handler. Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de> Signed-off-by: Bryan Wu <cooloney@kernel.org>
95 lines
2.2 KiB
C
95 lines
2.2 KiB
C
/*
|
|
* Common header file for blackfin family of processors.
|
|
*
|
|
*/
|
|
|
|
#ifndef _BLACKFIN_TRACE_
|
|
#define _BLACKFIN_TRACE_
|
|
|
|
/* Normally, we use ON, but you can't turn on software expansion until
|
|
* interrupts subsystem is ready
|
|
*/
|
|
|
|
#define BFIN_TRACE_INIT ((CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION << 4) | 0x03)
|
|
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
|
|
#define BFIN_TRACE_ON (BFIN_TRACE_INIT | (CONFIG_DEBUG_BFIN_HWTRACE_EXPAND << 2))
|
|
#else
|
|
#define BFIN_TRACE_ON (BFIN_TRACE_INIT)
|
|
#endif
|
|
|
|
#ifndef __ASSEMBLY__
|
|
extern unsigned long trace_buff_offset;
|
|
extern unsigned long software_trace_buff[];
|
|
|
|
/* Trace Macros for C files */
|
|
|
|
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
|
|
|
|
#define trace_buffer_save(x) \
|
|
do { \
|
|
(x) = bfin_read_TBUFCTL(); \
|
|
bfin_write_TBUFCTL((x) & ~TBUFEN); \
|
|
} while (0)
|
|
|
|
#define trace_buffer_restore(x) \
|
|
do { \
|
|
bfin_write_TBUFCTL((x)); \
|
|
} while (0)
|
|
#else /* DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
#define trace_buffer_save(x)
|
|
#define trace_buffer_restore(x)
|
|
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
#else
|
|
/* Trace Macros for Assembly files */
|
|
|
|
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
|
|
|
|
#define trace_buffer_stop(preg, dreg) \
|
|
preg.L = LO(TBUFCTL); \
|
|
preg.H = HI(TBUFCTL); \
|
|
dreg = 0x1; \
|
|
[preg] = dreg;
|
|
|
|
#define trace_buffer_init(preg, dreg) \
|
|
preg.L = LO(TBUFCTL); \
|
|
preg.H = HI(TBUFCTL); \
|
|
dreg = BFIN_TRACE_INIT; \
|
|
[preg] = dreg;
|
|
|
|
#define trace_buffer_save(preg, dreg) \
|
|
preg.L = LO(TBUFCTL); \
|
|
preg.H = HI(TBUFCTL); \
|
|
dreg = [preg]; \
|
|
[--sp] = dreg; \
|
|
dreg = 0x1; \
|
|
[preg] = dreg;
|
|
|
|
#define trace_buffer_restore(preg, dreg) \
|
|
preg.L = LO(TBUFCTL); \
|
|
preg.H = HI(TBUFCTL); \
|
|
dreg = [sp++]; \
|
|
[preg] = dreg;
|
|
|
|
#else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
#define trace_buffer_stop(preg, dreg)
|
|
#define trace_buffer_init(preg, dreg)
|
|
#define trace_buffer_save(preg, dreg)
|
|
#define trace_buffer_restore(preg, dreg)
|
|
|
|
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
#ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
|
|
# define DEBUG_HWTRACE_SAVE(preg, dreg) trace_buffer_save(preg, dreg)
|
|
# define DEBUG_HWTRACE_RESTORE(preg, dreg) trace_buffer_restore(preg, dreg)
|
|
#else
|
|
# define DEBUG_HWTRACE_SAVE(preg, dreg)
|
|
# define DEBUG_HWTRACE_RESTORE(preg, dreg)
|
|
#endif
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* _BLACKFIN_TRACE_ */
|