diff --git a/Kconfig b/Kconfig index f1fec3a7a4..e14a7387cd 100644 --- a/Kconfig +++ b/Kconfig @@ -741,12 +741,38 @@ config DEBUG_SCHED_INFO endif # DEBUG_SCHED config DEBUG_SYSCALL - bool "SYSCALL Debug Output" + bool "SYSCALL Debug Features" default n depends on LIB_SYSCALL ---help--- - Enable very low level output related to system calls. This gives - you basically a poor man's version of strace. + Enable very low level features related to system calls. If SYSCAL + output is enabled, this gives you basically a poor man's version of + strace. + +if DEBUG_SYSCALL + +config DEBUG_SYSCALL_ERROR + bool "SYSCALL Error Output" + default n + depends on DEBUG_ERROR + ---help--- + Enable OS SYSCALL error output to SYSLOG. + +config DEBUG_SYSCALL_WARN + bool "SYSCALL Warnings Output" + default n + depends on DEBUG_WARN + ---help--- + Enable OS SYSCALL warning output to SYSLOG. + +config DEBUG_SYSCALL_INFO + bool "SYSCALL Informational Output" + default n + depends on DEBUG_INFO + ---help--- + Enable OS SYSCALL informational output to SYSLOG. + +endif # DEBUG_SYSCALL config DEBUG_WIRELESS bool "Wireless Device Debug Output" diff --git a/arch/arm/src/armv6-m/up_svcall.c b/arch/arm/src/armv6-m/up_svcall.c index a24fc12f2f..971b6d2c1e 100644 --- a/arch/arm/src/armv6-m/up_svcall.c +++ b/arch/arm/src/armv6-m/up_svcall.c @@ -55,33 +55,6 @@ #include "exc_return.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ -/* Debug output from this file may interfere with context switching! To get - * debug output you must enabled the following in your NuttX configuration: - * - * - CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_SYSCALL (shows only syscalls) - * - CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_SVCALL (shows everything) - */ - -#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) -# define svcerr(format, ...) llerr(format, ##__VA_ARGS__) -#else -# define svcerr(x...) -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -169,24 +142,24 @@ int up_svcall(int irq, FAR void *context) * and R1..R7 = variable number of arguments depending on the system call. */ -#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) +#ifdef CONFIG_DEBUG_SYSCALL_INFO # ifndef CONFIG_DEBUG_SVCALL if (cmd > SYS_switch_context) # endif { - svcerr("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd); - svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); - svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + svcllinfo("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); # ifdef CONFIG_BUILD_PROTECTED - svcerr(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", - regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]); + svcllinfo(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", + regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]); # else - svcerr(" PSR: %08x PRIMASK: %08x\n", - regs[REG_XPSR], regs[REG_PRIMASK]); + svcllinfo(" PSR: %08x PRIMASK: %08x\n", + regs[REG_XPSR], regs[REG_PRIMASK]); # endif } #endif @@ -471,7 +444,7 @@ int up_svcall(int irq, FAR void *context) regs[REG_R0] -= CONFIG_SYS_RESERVED; #else - sllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); + svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); #endif } break; @@ -479,37 +452,37 @@ int up_svcall(int irq, FAR void *context) /* Report what happened. That might difficult in the case of a context switch */ -#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) +#ifdef CONFIG_DEBUG_SYSCALL_INFO # ifndef CONFIG_DEBUG_SVCALL if (cmd > SYS_switch_context) # else if (regs != CURRENT_REGS) # endif { - svcerr("SVCall Return:\n"); - svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1], - CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3], - CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5], - CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]); - svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9], - CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11], - CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13], - CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]); + svcllinfo("SVCall Return:\n"); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1], + CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3], + CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5], + CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9], + CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11], + CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13], + CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]); #ifdef CONFIG_BUILD_PROTECTED - svcerr(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", - CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK], - CURRENT_REGS[REG_EXC_RETURN]); + svcllinfo(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", + CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK], + CURRENT_REGS[REG_EXC_RETURN]); #else - svcerr(" PSR: %08x PRIMASK: %08x\n", - CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]); + svcllinfo(" PSR: %08x PRIMASK: %08x\n", + CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]); #endif } # ifdef CONFIG_DEBUG_SVCALL else { - svcerr("SVCall Return: %d\n", regs[REG_R0]); + svcllinfo("SVCall Return: %d\n", regs[REG_R0]); } # endif #endif diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c index c9505aaadf..482345c417 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -54,21 +54,6 @@ #include "addrenv.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Debug ********************************************************************/ - -#if defined(CONFIG_DEBUG_SYSCALL) -# define svcerr(format, ...) llerr(format, ##__VA_ARGS__) -# define svcwarn(format, ...) llwarn(format, ##__VA_ARGS__) -# define svcinfo(format, ...) llinfo(format, ##__VA_ARGS__) -#else -# define svcerr(x...) -# define svcwarn(x...) -# define svcinfo(x...) -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -171,16 +156,14 @@ uint32_t *arm_syscall(uint32_t *regs) * and R1..R7 = variable number of arguments depending on the system call. */ -#if defined(CONFIG_DEBUG_SYSCALL) - svcinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd); - svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); - svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); - svcinfo("CPSR: %08x\n", regs[REG_CPSR]); -#endif + svcllinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + svcllinfo("CPSR: %08x\n", regs[REG_CPSR]); /* Handle the SVCall according to the command in R0 */ @@ -473,7 +456,7 @@ uint32_t *arm_syscall(uint32_t *regs) regs[REG_R0] -= CONFIG_SYS_RESERVED; #else - svcerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); + svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); #endif #ifdef CONFIG_ARCH_KERNEL_STACK @@ -494,18 +477,16 @@ uint32_t *arm_syscall(uint32_t *regs) break; } -#if defined(CONFIG_DEBUG_SYSCALL) /* Report what happened */ - svcinfo("SYSCALL Exit: regs: %p\n", regs); - svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); - svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); - svcinfo("CPSR: %08x\n", regs[REG_CPSR]); -#endif + svcllinfo("SYSCALL Exit: regs: %p\n", regs); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + svcllinfo("CPSR: %08x\n", regs[REG_CPSR]); /* Return the last value of curent_regs. This supports context switches * on return from the exception. That capability is only used with the diff --git a/arch/arm/src/armv7-m/up_svcall.c b/arch/arm/src/armv7-m/up_svcall.c index 70eef08054..63f229a048 100644 --- a/arch/arm/src/armv7-m/up_svcall.c +++ b/arch/arm/src/armv7-m/up_svcall.c @@ -56,33 +56,6 @@ #include "exc_return.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ -/* Debug output from this file may interfere with context switching! To get - * debug output you must enabled the following in your NuttX configuration: - * - * - CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_SYSCALL (shows only syscalls) - * - CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_SVCALL (shows everything) - */ - -#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) -# define svcerr(format, ...) llerr(format, ##__VA_ARGS__) -#else -# define svcerr(x...) -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -164,23 +137,23 @@ int up_svcall(int irq, FAR void *context) * and R1..R7 = variable number of arguments depending on the system call. */ -#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) +#ifdef CONFIG_DEBUG_SYSCALL_INFO # ifndef CONFIG_DEBUG_SVCALL if (cmd > SYS_switch_context) # endif { - svcerr("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd); - svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); - svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + svcllinfo("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); # ifdef REG_EXC_RETURN - svcerr(" PSR: %08x EXC_RETURN: %08x\n", - regs[REG_XPSR], regs[REG_EXC_RETURN]); + svcllinfo(" PSR: %08x EXC_RETURN: %08x\n", + regs[REG_XPSR], regs[REG_EXC_RETURN]); # else - svcerr(" PSR: %08x\n", regs[REG_XPSR]); + svcllinfo(" PSR: %08x\n", regs[REG_XPSR]); # endif } #endif @@ -473,7 +446,7 @@ int up_svcall(int irq, FAR void *context) regs[REG_R0] -= CONFIG_SYS_RESERVED; #else - sllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); + svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); #endif } break; @@ -481,35 +454,35 @@ int up_svcall(int irq, FAR void *context) /* Report what happened. That might difficult in the case of a context switch */ -#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) +#ifdef CONFIG_DEBUG_SYSCALL_INFO # ifndef CONFIG_DEBUG_SVCALL if (cmd > SYS_switch_context) # else if (regs != CURRENT_REGS) # endif { - svcerr("SVCall Return:\n"); - svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1], - CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3], - CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5], - CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]); - svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9], - CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11], - CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13], - CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]); + svcllinfo("SVCall Return:\n"); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1], + CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3], + CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5], + CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9], + CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11], + CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13], + CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]); # ifdef REG_EXC_RETURN - svcerr(" PSR: %08x EXC_RETURN: %08x\n", - CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_EXC_RETURN]); + svcllinfo(" PSR: %08x EXC_RETURN: %08x\n", + CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_EXC_RETURN]); # else - svcerr(" PSR: %08x\n", CURRENT_REGS[REG_XPSR]); + svcllinfo(" PSR: %08x\n", CURRENT_REGS[REG_XPSR]); # endif } # ifdef CONFIG_DEBUG_SVCALL else { - svcerr("SVCall Return: %d\n", regs[REG_R0]); + svcllinfo("SVCall Return: %d\n", regs[REG_R0]); } # endif #endif diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c index 28fad77f4e..c8a33f36c3 100644 --- a/arch/arm/src/armv7-r/arm_syscall.c +++ b/arch/arm/src/armv7-r/arm_syscall.c @@ -52,22 +52,6 @@ #include "svcall.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Debug ********************************************************************/ - -#if defined(CONFIG_DEBUG_SYSCALL) -# define svcerr(format, ...) llerr(format, ##__VA_ARGS__) -# define svcwarn(format, ...) llwarn(format, ##__VA_ARGS__) -# define svcinfo(format, ...) llinfo(format, ##__VA_ARGS__) -#else -# define svcerr(x...) -# define svcwarn(x...) -# define svcinfo(x...) -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -170,16 +154,14 @@ uint32_t *arm_syscall(uint32_t *regs) * and R1..R7 = variable number of arguments depending on the system call. */ -#if defined(CONFIG_DEBUG_SYSCALL) - svcinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd); - svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); - svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); - svcinfo("CPSR: %08x\n", regs[REG_CPSR]); -#endif + svcllinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + svcllinfo("CPSR: %08x\n", regs[REG_CPSR]); /* Handle the SVCall according to the command in R0 */ @@ -472,7 +454,7 @@ uint32_t *arm_syscall(uint32_t *regs) regs[REG_R0] -= CONFIG_SYS_RESERVED; #else - svcerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); + svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); #endif #ifdef CONFIG_ARCH_KERNEL_STACK @@ -493,18 +475,16 @@ uint32_t *arm_syscall(uint32_t *regs) break; } -#if defined(CONFIG_DEBUG_SYSCALL) /* Report what happened */ - svcinfo("SYSCALL Exit: regs: %p\n", regs); - svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); - svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); - svcinfo("CPSR: %08x\n", regs[REG_CPSR]); -#endif + svcllinfo("SYSCALL Exit: regs: %p\n", regs); + svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + svcllinfo("CPSR: %08x\n", regs[REG_CPSR]); /* Return the last value of curent_regs. This supports context switches * on return from the exception. That capability is only used with the diff --git a/arch/mips/src/mips32/up_swint0.c b/arch/mips/src/mips32/up_swint0.c index 720aaa3bce..e7e5f21d85 100644 --- a/arch/mips/src/mips32/up_swint0.c +++ b/arch/mips/src/mips32/up_swint0.c @@ -52,28 +52,6 @@ #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ -/* Debug output from this file may interfere with context switching! To get - * debug output you must enabled the following in your NuttX configuration: - * - * CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_SYSCALL - */ - -#ifdef CONFIG_DEBUG_SYSCALL -# define swierr(format, ...) llerr(format, ##__VA_ARGS__) -# define swiwarn(format, ...) llwarn(format, ##__VA_ARGS__) -# define swiinfo(format, ...) llinfo(format, ##__VA_ARGS__) -#else -# define swierr(x...) -# define swiwarn(x...) -# define swiinfo(x...) -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -82,28 +60,28 @@ * Name: up_registerdump ****************************************************************************/ -#ifdef CONFIG_DEBUG_SYSCALL +#ifdef CONFIG_DEBUG_SYSCALL_INFO static void up_registerdump(const uint32_t *regs) { - swiinfo("MFLO:%08x MFHI:%08x EPC:%08x STATUS:%08x\n", - regs[REG_MFLO], regs[REG_MFHI], regs[REG_EPC], regs[REG_STATUS]); - swiinfo("AT:%08x V0:%08x V1:%08x A0:%08x A1:%08x A2:%08x A3:%08x\n", - regs[REG_AT], regs[REG_V0], regs[REG_V1], regs[REG_A0], - regs[REG_A1], regs[REG_A2], regs[REG_A3]); - swiinfo("T0:%08x T1:%08x T2:%08x T3:%08x T4:%08x T5:%08x T6:%08x T7:%08x\n", - regs[REG_T0], regs[REG_T1], regs[REG_T2], regs[REG_T3], - regs[REG_T4], regs[REG_T5], regs[REG_T6], regs[REG_T7]); - swiinfo("S0:%08x S1:%08x S2:%08x S3:%08x S4:%08x S5:%08x S6:%08x S7:%08x\n", - regs[REG_S0], regs[REG_S1], regs[REG_S2], regs[REG_S3], - regs[REG_S4], regs[REG_S5], regs[REG_S6], regs[REG_S7]); + svcllinfo("MFLO:%08x MFHI:%08x EPC:%08x STATUS:%08x\n", + regs[REG_MFLO], regs[REG_MFHI], regs[REG_EPC], regs[REG_STATUS]); + svcllinfo("AT:%08x V0:%08x V1:%08x A0:%08x A1:%08x A2:%08x A3:%08x\n", + regs[REG_AT], regs[REG_V0], regs[REG_V1], regs[REG_A0], + regs[REG_A1], regs[REG_A2], regs[REG_A3]); + svcllinfo("T0:%08x T1:%08x T2:%08x T3:%08x T4:%08x T5:%08x T6:%08x T7:%08x\n", + regs[REG_T0], regs[REG_T1], regs[REG_T2], regs[REG_T3], + regs[REG_T4], regs[REG_T5], regs[REG_T6], regs[REG_T7]); + svcllinfo("S0:%08x S1:%08x S2:%08x S3:%08x S4:%08x S5:%08x S6:%08x S7:%08x\n", + regs[REG_S0], regs[REG_S1], regs[REG_S2], regs[REG_S3], + regs[REG_S4], regs[REG_S5], regs[REG_S6], regs[REG_S7]); #ifdef MIPS32_SAVE_GP - swiinfo("T8:%08x T9:%08x GP:%08x SP:%08x FP:%08x RA:%08x\n", - regs[REG_T8], regs[REG_T9], regs[REG_GP], regs[REG_SP], - regs[REG_FP], regs[REG_RA]); + svcllinfo("T8:%08x T9:%08x GP:%08x SP:%08x FP:%08x RA:%08x\n", + regs[REG_T8], regs[REG_T9], regs[REG_GP], regs[REG_SP], + regs[REG_FP], regs[REG_RA]); #else - swiinfo("T8:%08x T9:%08x SP:%08x FP:%08x RA:%08x\n", - regs[REG_T8], regs[REG_T9], regs[REG_SP], regs[REG_FP], - regs[REG_RA]); + svcllinfo("T8:%08x T9:%08x SP:%08x FP:%08x RA:%08x\n", + regs[REG_T8], regs[REG_T9], regs[REG_SP], regs[REG_FP], + regs[REG_RA]); #endif } #else @@ -163,8 +141,8 @@ int up_swint0(int irq, FAR void *context) * arguments depending on the system call. */ -#ifdef CONFIG_DEBUG_SYSCALL - swiinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_R4]); +#ifdef CONFIG_DEBUG_SYSCALL_INFO + svcllinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_R4]); up_registerdump(regs); #endif @@ -285,7 +263,7 @@ int up_swint0(int irq, FAR void *context) g_current_regs[REG_R0] -= CONFIG_SYS_RESERVED; #else - sllerr("ERROR: Bad SYS call: %d\n", regs[REG_A0]); + svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_A0]); #endif } break; @@ -293,15 +271,15 @@ int up_swint0(int irq, FAR void *context) /* Report what happened. That might difficult in the case of a context switch */ -#ifdef CONFIG_DEBUG_SYSCALL +#ifdef CONFIG_DEBUG_SYSCALL_INFO if (regs != g_current_regs) { - swiinfo("SWInt Return: Context switch!\n"); + svcllinfo("SWInt Return: Context switch!\n"); up_registerdump((const uint32_t *)g_current_regs); } else { - swiinfo("SWInt Return: %d\n", regs[REG_V0]); + svcllinfo("SWInt Return: %d\n", regs[REG_V0]); } #endif diff --git a/include/debug.h b/include/debug.h index 0659179eda..5479cd45e1 100644 --- a/include/debug.h +++ b/include/debug.h @@ -237,6 +237,30 @@ # define sllinfo(x...) #endif +#ifdef CONFIG_DEBUG_SYSCALL_ERROR +# define svcerr(format, ...) err(format, ##__VA_ARGS__) +# define svcllerr(format, ...) llerr(format, ##__VA_ARGS__) +#else +# define svcerr(x...) +# define svcllerr(x...) +#endif + +#ifdef CONFIG_DEBUG_SYSCALL_WARN +# define svcwarn(format, ...) warn(format, ##__VA_ARGS__) +# define svcllwarn(format, ...) llwarn(format, ##__VA_ARGS__) +#else +# define svcwarn(x...) +# define svcllwarn(x...) +#endif + +#ifdef CONFIG_DEBUG_SYSCALL_INFO +# define svcinfo(format, ...) info(format, ##__VA_ARGS__) +# define svcllinfo(format, ...) llinfo(format, ##__VA_ARGS__) +#else +# define svcinfo(x...) +# define svcllinfo(x...) +#endif + #ifdef CONFIG_DEBUG_PAGING_ERROR # define pgerr(format, ...) err(format, ##__VA_ARGS__) # define pgllerr(format, ...) llerr(format, ##__VA_ARGS__) @@ -946,6 +970,30 @@ # define sllinfo (void) #endif +#ifdef CONFIG_DEBUG_SYSCALL_ERROR +# define svcerr err +# define svcllerr llerr +#else +# define svcerr (void) +# define svcllerr (void) +#endif + +#ifdef CONFIG_DEBUG_SYSCALL_WARN +# define svcwarn warn +# define svcllwarn llwarn +#else +# define svcwarn (void) +# define svcllwarn (void) +#endif + +#ifdef CONFIG_DEBUG_SYSCALL_INFO +# define svcinfo info +# define svcllinfo llinfo +#else +# define svcinfo (void) +# define svcllinfo (void) +#endif + #ifdef CONFIG_DEBUG_PAGING_ERROR # define pgerr err # define pgllerr llerr @@ -1604,6 +1652,14 @@ # define sinfodumpbuffer(m,b,n) #endif +#ifdef CONFIG_DEBUG_SYSCALL +# define svcerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) +# define svcinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n) +#else +# define svcerrdumpbuffer(m,b,n) +# define svcinfodumpbuffer(m,b,n) +#endif + #ifdef CONFIG_DEBUG_PAGING # define pgerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) # define pginfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)