diff --git a/arch/arm/src/armv6-m/arm_svcall.c b/arch/arm/src/armv6-m/arm_svcall.c index 820a18ff8361a..f78f3a8a2e016 100644 --- a/arch/arm/src/armv6-m/arm_svcall.c +++ b/arch/arm/src/armv6-m/arm_svcall.c @@ -446,13 +446,11 @@ int arm_svcall(int irq, void *context, void *arg) * switch. */ -#ifdef CONFIG_DEBUG_SYSCALL_INFO -# ifndef CONFIG_DEBUG_SVCALL - if (cmd > SYS_switch_context) -# else if (regs != tcb->xcp.regs) -# endif { + restore_critical_section(tcb, this_cpu()); + +#ifdef CONFIG_DEBUG_SYSCALL_INFO regs = (uint32_t *)tcb->xcp.regs; svcinfo("SVCall Return:\n"); @@ -464,19 +462,14 @@ int arm_svcall(int irq, void *context, void *arg) regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); svcinfo(" PSR: %08x EXC_RETURN: %08x CONTROL: %08x\n", regs[REG_XPSR], regs[REG_EXC_RETURN], regs[REG_CONTROL]); +#endif } -# ifdef CONFIG_DEBUG_SVCALL +#ifdef CONFIG_DEBUG_SYSCALL_INFO else { svcinfo("SVCall Return: %d\n", regs[REG_R0]); } -# endif #endif - if (regs != tcb->xcp.regs) - { - restore_critical_section(this_task(), this_cpu()); - } - return OK; } diff --git a/arch/arm/src/armv7-m/arm_svcall.c b/arch/arm/src/armv7-m/arm_svcall.c index d00c394c825c2..3560a2ef26ab9 100644 --- a/arch/arm/src/armv7-m/arm_svcall.c +++ b/arch/arm/src/armv7-m/arm_svcall.c @@ -456,13 +456,11 @@ int arm_svcall(int irq, void *context, void *arg) * switch. */ -#ifdef CONFIG_DEBUG_SYSCALL_INFO -# ifndef CONFIG_DEBUG_SVCALL - if (cmd > SYS_switch_context) -# else if (regs != tcb->xcp.regs) -# endif { + restore_critical_section(tcb, this_cpu()); + +#ifdef CONFIG_DEBUG_SYSCALL_INFO regs = (uint32_t *)tcb->xcp.regs; svcinfo("SVCall Return:\n"); @@ -474,19 +472,14 @@ int arm_svcall(int irq, void *context, void *arg) regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); svcinfo(" PSR: %08x EXC_RETURN: %08x CONTROL: %08x\n", regs[REG_XPSR], regs[REG_EXC_RETURN], regs[REG_CONTROL]); +#endif } -# ifdef CONFIG_DEBUG_SVCALL +#ifdef CONFIG_DEBUG_SYSCALL_INFO else { svcinfo("SVCall Return: %d\n", regs[REG_R0]); } -# endif #endif - if (regs != tcb->xcp.regs) - { - restore_critical_section(this_task(), this_cpu()); - } - return OK; } diff --git a/arch/arm/src/armv8-m/arm_svcall.c b/arch/arm/src/armv8-m/arm_svcall.c index 3af74d1ac0c20..b6b1af67b8661 100644 --- a/arch/arm/src/armv8-m/arm_svcall.c +++ b/arch/arm/src/armv8-m/arm_svcall.c @@ -456,13 +456,11 @@ int arm_svcall(int irq, void *context, void *arg) * switch. */ -#ifdef CONFIG_DEBUG_SYSCALL_INFO -# ifndef CONFIG_DEBUG_SVCALL - if (cmd > SYS_switch_context) -# else if (regs != tcb->xcp.regs) -# endif { + restore_critical_section(tcb, this_cpu()); + +#ifdef CONFIG_DEBUG_SYSCALL_INFO regs = (uint32_t *)tcb->xcp.regs; svcinfo("SVCall Return:\n"); @@ -474,19 +472,14 @@ int arm_svcall(int irq, void *context, void *arg) regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); svcinfo(" PSR: %08x EXC_RETURN: %08x CONTROL: %08x\n", regs[REG_XPSR], regs[REG_EXC_RETURN], regs[REG_CONTROL]); +#endif } -# ifdef CONFIG_DEBUG_SVCALL +#ifdef CONFIG_DEBUG_SYSCALL_INFO else { svcinfo("SVCall Return: %d\n", regs[REG_R0]); } -# endif #endif - if (regs != tcb->xcp.regs) - { - restore_critical_section(this_task(), this_cpu()); - } - return OK; } diff --git a/arch/risc-v/src/common/riscv_swint.c b/arch/risc-v/src/common/riscv_swint.c index ab6fc22428a99..ead2e9ed4294f 100644 --- a/arch/risc-v/src/common/riscv_swint.c +++ b/arch/risc-v/src/common/riscv_swint.c @@ -342,21 +342,20 @@ int riscv_swint(int irq, void *context, void *arg) * switch */ -#ifdef CONFIG_DEBUG_SYSCALL_INFO if (regs != new_regs) { + restore_critical_section(this_task(), this_cpu()); + +#ifdef CONFIG_DEBUG_SYSCALL_INFO svcinfo("SWInt Return: Context switch!\n"); up_dump_register(new_regs); +#endif } else { +#ifdef CONFIG_DEBUG_SYSCALL_INFO svcinfo("SWInt Return: %" PRIxPTR "\n", regs[REG_A0]); - } #endif - - if (regs != new_regs) - { - restore_critical_section(this_task(), this_cpu()); } return OK;