Skip to content

Commit

Permalink
arch: Remove xxx_intstack_top and xxx_intstack_alloc
Browse files Browse the repository at this point in the history
Change-Id: I27a552fbd9e3853be7f33c21ba340bf0d6cb1f8b
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed Apr 6, 2024
1 parent e92047b commit 4539ad7
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 353 deletions.
6 changes: 1 addition & 5 deletions arch/arm/src/armv6-m/arm_initialstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,7 @@ void up_initial_state(struct tcb_s *tcb)

noinline_function void arm_initialize_stack(void)
{
#ifdef CONFIG_SMP
uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index());
#else
uint32_t stack = (uint32_t)g_intstacktop;
#endif
uint32_t stack = up_get_intstackbase(up_cpu_index()) + INTSTACK_SIZE;
uint32_t tempa = 0;
uint32_t tempb = 2;

Expand Down
6 changes: 1 addition & 5 deletions arch/arm/src/armv7-m/arm_initialstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,7 @@ void up_initial_state(struct tcb_s *tcb)

noinline_function void arm_initialize_stack(void)
{
#ifdef CONFIG_SMP
uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index());
#else
uint32_t stack = (uint32_t)g_intstacktop;
#endif
uint32_t stack = up_get_intstackbase(up_cpu_index()) + INTSTACK_SIZE;
uint32_t temp = 0;

__asm__ __volatile__
Expand Down
13 changes: 2 additions & 11 deletions arch/arm/src/armv8-m/arm_initialstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,8 @@ void up_initial_state(struct tcb_s *tcb)

noinline_function void arm_initialize_stack(void)
{
#ifdef CONFIG_SMP
uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index());
#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE
uint32_t stacklim = (uint32_t)arm_intstack_alloc(up_cpu_index());
#endif
#else
uint32_t stack = (uint32_t)g_intstacktop;
#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE
uint32_t stacklim = (uint32_t)g_intstackalloc;
#endif
#endif
uint32_t stacklim = up_get_intstackbase(up_cpu_index());
uint32_t stack = stacklim + INTSTACK_SIZE;
uint32_t temp = 0;

__asm__ __volatile__
Expand Down
14 changes: 4 additions & 10 deletions arch/arm/src/common/arm_backtrace_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ int up_backtrace(struct tcb_s *tcb,
void **buffer, int size, int skip)
{
struct tcb_s *rtcb = running_task();
#if CONFIG_ARCH_INTERRUPTSTACK > 7
void *istacklimit;
#endif
irqstate_t flags;
int ret;

Expand All @@ -121,13 +118,10 @@ int up_backtrace(struct tcb_s *tcb,
if (up_interrupt_context())
{
#if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP
istacklimit = (void *)arm_intstack_top(up_cpu_index());
# else
istacklimit = g_intstacktop;
# endif /* CONFIG_SMP */
ret = backtrace(istacklimit - (CONFIG_ARCH_INTERRUPTSTACK & ~7),
istacklimit,
void *istackbase = (void *)up_get_intstackbase(up_cpu_index());

ret = backtrace(istackbase,
istackbase + INTSTACK_SIZE,
(void *)__builtin_frame_address(0),
NULL, buffer, size, &skip);
#else
Expand Down
12 changes: 4 additions & 8 deletions arch/arm/src/common/arm_backtrace_sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,12 @@ int up_backtrace(struct tcb_s *tcb,

if (up_interrupt_context())
{
unsigned long top;
unsigned long top =
#if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP
top = arm_intstack_top(up_cpu_index());
# else
top = (unsigned long)g_intstacktop;
# endif /* CONFIG_SMP */
up_get_intstackbase(up_cpu_index()) + INTSTACK_SIZE;
#else
top = (unsigned long)rtcb->stack_base_ptr +
rtcb->adj_stack_size;
(unsigned long)rtcb->stack_base_ptr +
rtcb->adj_stack_size;
#endif
ret = backtrace_branch(top, sp, buffer, size, &skip);
if (ret < size)
Expand Down
7 changes: 2 additions & 5 deletions arch/arm/src/common/arm_backtrace_unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,8 @@ int up_backtrace(struct tcb_s *tcb,
if (up_interrupt_context())
{
#if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP
frame.stack_top = arm_intstack_top(up_cpu_index());
# else
frame.stack_top = (unsigned long)&g_intstacktop;
# endif /* CONFIG_SMP */
frame.stack_top = up_get_intstackbase(up_cpu_index()) +
INTSTACK_SIZE;
#endif /* CONFIG_ARCH_INTERRUPTSTACK > 7 */

ret = backtrace_unwind(&frame, buffer, size, &skip);
Expand Down
9 changes: 1 addition & 8 deletions arch/arm/src/common/arm_getintstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#include <nuttx/config.h>

#include <stdint.h>

#include "arm_internal.h"

/****************************************************************************
Expand All @@ -36,14 +34,9 @@
* Name: up_get_intstackbase
****************************************************************************/

#if CONFIG_ARCH_INTERRUPTSTACK > 3
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(int cpu)
{
#ifdef CONFIG_SMP
return arm_intstack_alloc(cpu);
#else
return (uintptr_t)g_intstackalloc;
#endif
}
#endif

2 changes: 1 addition & 1 deletion arch/arm/src/common/arm_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static inline void arm_color_intstack(void)

for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm_stack_color((void *)arm_intstack_alloc(cpu), INTSTACK_SIZE);
arm_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm_stack_color((void *)g_intstackalloc, INTSTACK_SIZE);
Expand Down
7 changes: 1 addition & 6 deletions arch/arm/src/common/arm_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,8 @@ void arm_pminitialize(void);

/* Interrupt handling *******************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu);
uintptr_t arm_intstack_top(int cpu);
#endif

#if CONFIG_ARCH_INTERRUPTSTACK > 7
void weak_function arm_initialize_stack(void);
void arm_initialize_stack(void);
#endif

/* Interrupt acknowledge and dispatch */
Expand Down
20 changes: 2 additions & 18 deletions arch/arm/src/cxd56xx/cxd56_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,23 +573,7 @@ int up_prioritize_irq(int irq, int priority)
#endif

/****************************************************************************
* Name: arm_intstack_top
*
* Description:
* Return a pointer to the top the correct interrupt stack allocation
* for the current CPU.
*
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(int cpu)
{
return g_intstacktop[cpu];
}
#endif

/****************************************************************************
* Name: arm_intstack_alloc
* Name: up_get_intstackbase
*
* Description:
* Return a pointer to the "alloc" the correct interrupt stack allocation
Expand All @@ -598,7 +582,7 @@ uintptr_t arm_intstack_top(int cpu)
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu)
uintptr_t up_get_intstackbase(int cpu)
{
return g_intstacktop[cpu] - INTSTACK_SIZE;
}
Expand Down
21 changes: 2 additions & 19 deletions arch/arm/src/goldfish/goldfish_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,7 @@ void up_irqinitialize(void)
}

/****************************************************************************
* Name: arm_intstack_top
*
* Description:
* Return a pointer to the top the correct interrupt stack allocation
* for the current CPU.
*
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(int cpu)
{
return g_irqstacktop[cpu];
}

#endif

/****************************************************************************
* Name: arm_intstack_alloc
* Name: up_get_intstackbase
*
* Description:
* Return a pointer to the "alloc" the correct interrupt stack allocation
Expand All @@ -153,7 +136,7 @@ uintptr_t arm_intstack_top(int cpu)
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu)
uintptr_t up_get_intstackbase(int cpu)
{
return g_irqstacktop[cpu] - INTSTACK_SIZE;
}
Expand Down
20 changes: 2 additions & 18 deletions arch/arm/src/imx6/imx_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,7 @@ void up_irqinitialize(void)
}

/****************************************************************************
* Name: arm_intstack_top
*
* Description:
* Return a pointer to the top the correct interrupt stack allocation
* for the current CPU.
*
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(int cpu)
{
return g_irqstacktop[cpu];
}
#endif

/****************************************************************************
* Name: arm_intstack_alloc
* Name: up_get_intstackbase
*
* Description:
* Return a pointer to the "alloc" the correct interrupt stack allocation
Expand All @@ -177,7 +161,7 @@ uintptr_t arm_intstack_top(int cpu)
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu)
uintptr_t up_get_intstackbase(int cpu)
{
return g_irqstacktop[cpu] - INTSTACK_SIZE;
}
Expand Down
20 changes: 2 additions & 18 deletions arch/arm/src/lc823450/lc823450_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,23 +820,7 @@ int lc823450_irq_register(int irq, struct lc823450_irq_ops *ops)
#endif /* CONFIG_LC823450_VIRQ */

/****************************************************************************
* Name: arm_intstack_top
*
* Description:
* Return a pointer to the top the correct interrupt stack allocation
* for the current CPU.
*
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(int cpu)
{
return g_intstacktop[cpu];
}
#endif

/****************************************************************************
* Name: arm_intstack_alloc
* Name: up_get_intstackbase
*
* Description:
* Return a pointer to the "alloc" the correct interrupt stack allocation
Expand All @@ -845,7 +829,7 @@ uintptr_t arm_intstack_top(int cpu)
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu)
uintptr_t up_get_intstackbase(int cpu)
{
return g_intstacktop[cpu] - INTSTACK_SIZE;
}
Expand Down
20 changes: 2 additions & 18 deletions arch/arm/src/qemu/qemu_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,7 @@ void up_irqinitialize(void)
}

/****************************************************************************
* Name: arm_intstack_top
*
* Description:
* Return a pointer to the top the correct interrupt stack allocation
* for the current CPU.
*
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(int cpu)
{
return g_irqstacktop[cpu];
}
#endif

/****************************************************************************
* Name: arm_intstack_alloc
* Name: up_get_intstackbase
*
* Description:
* Return a pointer to the "alloc" the correct interrupt stack allocation
Expand All @@ -152,7 +136,7 @@ uintptr_t arm_intstack_top(int cpu)
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu)
uintptr_t up_get_intstackbase(int cpu)
{
return g_irqstacktop[cpu] - INTSTACK_SIZE;
}
Expand Down
20 changes: 2 additions & 18 deletions arch/arm/src/rp2040/rp2040_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,23 +438,7 @@ int up_prioritize_irq(int irq, int priority)
#endif

/****************************************************************************
* Name: arm_intstack_top
*
* Description:
* Return a pointer to the top the correct interrupt stack allocation
* for the current CPU.
*
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(int cpu)
{
return g_intstacktop[cpu];
}
#endif

/****************************************************************************
* Name: arm_intstack_alloc
* Name: up_get_intstackbase
*
* Description:
* Return a pointer to the "alloc" the correct interrupt stack allocation
Expand All @@ -463,7 +447,7 @@ uintptr_t arm_intstack_top(int cpu)
****************************************************************************/

#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(int cpu)
uintptr_t up_get_intstackbase(int cpu)
{
return g_intstacktop[cpu] - INTSTACK_SIZE;
}
Expand Down
12 changes: 3 additions & 9 deletions arch/arm/src/tlsr82/tc32/tc32_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
struct tcb_s *rtcb = running_task();
irqstate_t flags;
void *sp;
int ret;
int ret = 0;

if (size <= 0 || !buffer)
{
Expand All @@ -475,12 +475,8 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
if (up_interrupt_context())
{
#if CONFIG_ARCH_INTERRUPTSTACK > 7
ret = backtrace_push(
# ifdef CONFIG_SMP
arm_intstack_top(up_cpu_index()),
# else
g_intstacktop,
# endif /* CONFIG_SMP */
ret = backtrace_push((void *)(INTSTACK_SIZE +
up_get_intstackbase(up_cpu_index())),
&sp, (void *)up_backtrace + 16,
buffer, size, &skip);
#else
Expand Down Expand Up @@ -515,8 +511,6 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
}
else
{
ret = 0;

flags = enter_critical_section();

if (skip-- <= 0)
Expand Down
Loading

0 comments on commit 4539ad7

Please sign in to comment.