Centralize definitions associated with CONFIG_DEBUG_SYSCALL

This commit is contained in:
Gregory Nutt
2016-06-16 08:12:38 -06:00
parent 7a9f1814a2
commit 6f08216621
7 changed files with 202 additions and 235 deletions
+29 -3
View File
@@ -741,12 +741,38 @@ config DEBUG_SCHED_INFO
endif # DEBUG_SCHED endif # DEBUG_SCHED
config DEBUG_SYSCALL config DEBUG_SYSCALL
bool "SYSCALL Debug Output" bool "SYSCALL Debug Features"
default n default n
depends on LIB_SYSCALL depends on LIB_SYSCALL
---help--- ---help---
Enable very low level output related to system calls. This gives Enable very low level features related to system calls. If SYSCAL
you basically a poor man's version of strace. 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 config DEBUG_WIRELESS
bool "Wireless Device Debug Output" bool "Wireless Device Debug Output"
+31 -58
View File
@@ -55,33 +55,6 @@
#include "exc_return.h" #include "exc_return.h"
#include "up_internal.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 * 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. * 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 # ifndef CONFIG_DEBUG_SVCALL
if (cmd > SYS_switch_context) if (cmd > SYS_switch_context)
# endif # endif
{ {
svcerr("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd); svcllinfo("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd);
svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
# ifdef CONFIG_BUILD_PROTECTED # ifdef CONFIG_BUILD_PROTECTED
svcerr(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", svcllinfo(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n",
regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]); regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]);
# else # else
svcerr(" PSR: %08x PRIMASK: %08x\n", svcllinfo(" PSR: %08x PRIMASK: %08x\n",
regs[REG_XPSR], regs[REG_PRIMASK]); regs[REG_XPSR], regs[REG_PRIMASK]);
# endif # endif
} }
#endif #endif
@@ -471,7 +444,7 @@ int up_svcall(int irq, FAR void *context)
regs[REG_R0] -= CONFIG_SYS_RESERVED; regs[REG_R0] -= CONFIG_SYS_RESERVED;
#else #else
sllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]);
#endif #endif
} }
break; 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 */ /* 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 # ifndef CONFIG_DEBUG_SVCALL
if (cmd > SYS_switch_context) if (cmd > SYS_switch_context)
# else # else
if (regs != CURRENT_REGS) if (regs != CURRENT_REGS)
# endif # endif
{ {
svcerr("SVCall Return:\n"); svcllinfo("SVCall Return:\n");
svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1], CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1],
CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3], CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3],
CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5], CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5],
CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]); CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]);
svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9], CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9],
CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11], CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11],
CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13], CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13],
CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]); CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]);
#ifdef CONFIG_BUILD_PROTECTED #ifdef CONFIG_BUILD_PROTECTED
svcerr(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", svcllinfo(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n",
CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK], CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK],
CURRENT_REGS[REG_EXC_RETURN]); CURRENT_REGS[REG_EXC_RETURN]);
#else #else
svcerr(" PSR: %08x PRIMASK: %08x\n", svcllinfo(" PSR: %08x PRIMASK: %08x\n",
CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]); CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]);
#endif #endif
} }
# ifdef CONFIG_DEBUG_SVCALL # ifdef CONFIG_DEBUG_SVCALL
else else
{ {
svcerr("SVCall Return: %d\n", regs[REG_R0]); svcllinfo("SVCall Return: %d\n", regs[REG_R0]);
} }
# endif # endif
#endif #endif
+17 -36
View File
@@ -54,21 +54,6 @@
#include "addrenv.h" #include "addrenv.h"
#include "up_internal.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 * 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. * and R1..R7 = variable number of arguments depending on the system call.
*/ */
#if defined(CONFIG_DEBUG_SYSCALL) svcllinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd);
svcinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd); svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
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_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
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_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); svcllinfo("CPSR: %08x\n", regs[REG_CPSR]);
svcinfo("CPSR: %08x\n", regs[REG_CPSR]);
#endif
/* Handle the SVCall according to the command in R0 */ /* 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; regs[REG_R0] -= CONFIG_SYS_RESERVED;
#else #else
svcerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]);
#endif #endif
#ifdef CONFIG_ARCH_KERNEL_STACK #ifdef CONFIG_ARCH_KERNEL_STACK
@@ -494,18 +477,16 @@ uint32_t *arm_syscall(uint32_t *regs)
break; break;
} }
#if defined(CONFIG_DEBUG_SYSCALL)
/* Report what happened */ /* Report what happened */
svcinfo("SYSCALL Exit: regs: %p\n", regs); svcllinfo("SYSCALL Exit: regs: %p\n", regs);
svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
svcinfo("CPSR: %08x\n", regs[REG_CPSR]); svcllinfo("CPSR: %08x\n", regs[REG_CPSR]);
#endif
/* Return the last value of curent_regs. This supports context switches /* Return the last value of curent_regs. This supports context switches
* on return from the exception. That capability is only used with the * on return from the exception. That capability is only used with the
+28 -55
View File
@@ -56,33 +56,6 @@
#include "exc_return.h" #include "exc_return.h"
#include "up_internal.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 * 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. * 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 # ifndef CONFIG_DEBUG_SVCALL
if (cmd > SYS_switch_context) if (cmd > SYS_switch_context)
# endif # endif
{ {
svcerr("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd); svcllinfo("SVCALL Entry: regs: %p cmd: %d\n", regs, cmd);
svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
# ifdef REG_EXC_RETURN # ifdef REG_EXC_RETURN
svcerr(" PSR: %08x EXC_RETURN: %08x\n", svcllinfo(" PSR: %08x EXC_RETURN: %08x\n",
regs[REG_XPSR], regs[REG_EXC_RETURN]); regs[REG_XPSR], regs[REG_EXC_RETURN]);
# else # else
svcerr(" PSR: %08x\n", regs[REG_XPSR]); svcllinfo(" PSR: %08x\n", regs[REG_XPSR]);
# endif # endif
} }
#endif #endif
@@ -473,7 +446,7 @@ int up_svcall(int irq, FAR void *context)
regs[REG_R0] -= CONFIG_SYS_RESERVED; regs[REG_R0] -= CONFIG_SYS_RESERVED;
#else #else
sllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]);
#endif #endif
} }
break; 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 */ /* 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 # ifndef CONFIG_DEBUG_SVCALL
if (cmd > SYS_switch_context) if (cmd > SYS_switch_context)
# else # else
if (regs != CURRENT_REGS) if (regs != CURRENT_REGS)
# endif # endif
{ {
svcerr("SVCall Return:\n"); svcllinfo("SVCall Return:\n");
svcerr(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1], CURRENT_REGS[REG_R0], CURRENT_REGS[REG_R1],
CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3], CURRENT_REGS[REG_R2], CURRENT_REGS[REG_R3],
CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5], CURRENT_REGS[REG_R4], CURRENT_REGS[REG_R5],
CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]); CURRENT_REGS[REG_R6], CURRENT_REGS[REG_R7]);
svcerr(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9], CURRENT_REGS[REG_R8], CURRENT_REGS[REG_R9],
CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11], CURRENT_REGS[REG_R10], CURRENT_REGS[REG_R11],
CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13], CURRENT_REGS[REG_R12], CURRENT_REGS[REG_R13],
CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]); CURRENT_REGS[REG_R14], CURRENT_REGS[REG_R15]);
# ifdef REG_EXC_RETURN # ifdef REG_EXC_RETURN
svcerr(" PSR: %08x EXC_RETURN: %08x\n", svcllinfo(" PSR: %08x EXC_RETURN: %08x\n",
CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_EXC_RETURN]); CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_EXC_RETURN]);
# else # else
svcerr(" PSR: %08x\n", CURRENT_REGS[REG_XPSR]); svcllinfo(" PSR: %08x\n", CURRENT_REGS[REG_XPSR]);
# endif # endif
} }
# ifdef CONFIG_DEBUG_SVCALL # ifdef CONFIG_DEBUG_SVCALL
else else
{ {
svcerr("SVCall Return: %d\n", regs[REG_R0]); svcllinfo("SVCall Return: %d\n", regs[REG_R0]);
} }
# endif # endif
#endif #endif
+17 -37
View File
@@ -52,22 +52,6 @@
#include "svcall.h" #include "svcall.h"
#include "up_internal.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 * 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. * and R1..R7 = variable number of arguments depending on the system call.
*/ */
#if defined(CONFIG_DEBUG_SYSCALL) svcllinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd);
svcinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd); svcllinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
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_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); svcllinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
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_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); svcllinfo("CPSR: %08x\n", regs[REG_CPSR]);
svcinfo("CPSR: %08x\n", regs[REG_CPSR]);
#endif
/* Handle the SVCall according to the command in R0 */ /* 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; regs[REG_R0] -= CONFIG_SYS_RESERVED;
#else #else
svcerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]); svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_R0]);
#endif #endif
#ifdef CONFIG_ARCH_KERNEL_STACK #ifdef CONFIG_ARCH_KERNEL_STACK
@@ -493,18 +475,16 @@ uint32_t *arm_syscall(uint32_t *regs)
break; break;
} }
#if defined(CONFIG_DEBUG_SYSCALL)
/* Report what happened */ /* Report what happened */
svcinfo("SYSCALL Exit: regs: %p\n", regs); svcllinfo("SYSCALL Exit: regs: %p\n", regs);
svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", 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_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
svcinfo("CPSR: %08x\n", regs[REG_CPSR]); svcllinfo("CPSR: %08x\n", regs[REG_CPSR]);
#endif
/* Return the last value of curent_regs. This supports context switches /* Return the last value of curent_regs. This supports context switches
* on return from the exception. That capability is only used with the * on return from the exception. That capability is only used with the
+24 -46
View File
@@ -52,28 +52,6 @@
#include "up_internal.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
*/
#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 * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -82,28 +60,28 @@
* Name: up_registerdump * Name: up_registerdump
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_DEBUG_SYSCALL #ifdef CONFIG_DEBUG_SYSCALL_INFO
static void up_registerdump(const uint32_t *regs) static void up_registerdump(const uint32_t *regs)
{ {
swiinfo("MFLO:%08x MFHI:%08x EPC:%08x STATUS:%08x\n", svcllinfo("MFLO:%08x MFHI:%08x EPC:%08x STATUS:%08x\n",
regs[REG_MFLO], regs[REG_MFHI], regs[REG_EPC], regs[REG_STATUS]); 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", 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_AT], regs[REG_V0], regs[REG_V1], regs[REG_A0],
regs[REG_A1], regs[REG_A2], regs[REG_A3]); 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", 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_T0], regs[REG_T1], regs[REG_T2], regs[REG_T3],
regs[REG_T4], regs[REG_T5], regs[REG_T6], regs[REG_T7]); 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", 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_S0], regs[REG_S1], regs[REG_S2], regs[REG_S3],
regs[REG_S4], regs[REG_S5], regs[REG_S6], regs[REG_S7]); regs[REG_S4], regs[REG_S5], regs[REG_S6], regs[REG_S7]);
#ifdef MIPS32_SAVE_GP #ifdef MIPS32_SAVE_GP
swiinfo("T8:%08x T9:%08x GP:%08x SP:%08x FP:%08x RA:%08x\n", 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_T8], regs[REG_T9], regs[REG_GP], regs[REG_SP],
regs[REG_FP], regs[REG_RA]); regs[REG_FP], regs[REG_RA]);
#else #else
swiinfo("T8:%08x T9:%08x SP:%08x FP:%08x RA:%08x\n", 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_T8], regs[REG_T9], regs[REG_SP], regs[REG_FP],
regs[REG_RA]); regs[REG_RA]);
#endif #endif
} }
#else #else
@@ -163,8 +141,8 @@ int up_swint0(int irq, FAR void *context)
* arguments depending on the system call. * arguments depending on the system call.
*/ */
#ifdef CONFIG_DEBUG_SYSCALL #ifdef CONFIG_DEBUG_SYSCALL_INFO
swiinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_R4]); svcllinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_R4]);
up_registerdump(regs); up_registerdump(regs);
#endif #endif
@@ -285,7 +263,7 @@ int up_swint0(int irq, FAR void *context)
g_current_regs[REG_R0] -= CONFIG_SYS_RESERVED; g_current_regs[REG_R0] -= CONFIG_SYS_RESERVED;
#else #else
sllerr("ERROR: Bad SYS call: %d\n", regs[REG_A0]); svcllerr("ERROR: Bad SYS call: %d\n", regs[REG_A0]);
#endif #endif
} }
break; 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 */ /* 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) 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); up_registerdump((const uint32_t *)g_current_regs);
} }
else else
{ {
swiinfo("SWInt Return: %d\n", regs[REG_V0]); svcllinfo("SWInt Return: %d\n", regs[REG_V0]);
} }
#endif #endif
+56
View File
@@ -237,6 +237,30 @@
# define sllinfo(x...) # define sllinfo(x...)
#endif #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 #ifdef CONFIG_DEBUG_PAGING_ERROR
# define pgerr(format, ...) err(format, ##__VA_ARGS__) # define pgerr(format, ...) err(format, ##__VA_ARGS__)
# define pgllerr(format, ...) llerr(format, ##__VA_ARGS__) # define pgllerr(format, ...) llerr(format, ##__VA_ARGS__)
@@ -946,6 +970,30 @@
# define sllinfo (void) # define sllinfo (void)
#endif #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 #ifdef CONFIG_DEBUG_PAGING_ERROR
# define pgerr err # define pgerr err
# define pgllerr llerr # define pgllerr llerr
@@ -1604,6 +1652,14 @@
# define sinfodumpbuffer(m,b,n) # define sinfodumpbuffer(m,b,n)
#endif #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 #ifdef CONFIG_DEBUG_PAGING
# define pgerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) # define pgerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define pginfodumpbuffer(m,b,n) infodumpbuffer(m,b,n) # define pginfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)