This is an automated email from the ASF dual-hosted git repository.
ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 49b9aa0f33 arm/riscv: remove redundant judgment
49b9aa0f33 is described below
commit 49b9aa0f33b20a2417d55242284e0f4bda7a4d33
Author: hujun5 <[email protected]>
AuthorDate: Tue Oct 15 09:35:41 2024 +0800
arm/riscv: remove redundant judgment
Signed-off-by: hujun5 <[email protected]>
---
arch/arm/src/armv6-m/arm_svcall.c | 17 +++++------------
arch/arm/src/armv7-m/arm_svcall.c | 17 +++++------------
arch/arm/src/armv8-m/arm_svcall.c | 17 +++++------------
arch/risc-v/src/common/riscv_swint.c | 11 +++++------
4 files changed, 20 insertions(+), 42 deletions(-)
diff --git a/arch/arm/src/armv6-m/arm_svcall.c
b/arch/arm/src/armv6-m/arm_svcall.c
index 820a18ff83..f78f3a8a2e 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 d00c394c82..3560a2ef26 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 3af74d1ac0..b6b1af67b8 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 ab6fc22428..ead2e9ed42 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;