arch: Remove xxx_intstack_top and xxx_intstack_alloc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
4e725ecd44
commit
4ea2aeff6b
33 changed files with 56 additions and 352 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -349,11 +349,6 @@ 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);
|
||||
#endif
|
||||
|
|
|
@ -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_cpu_intstack_top[cpu];
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -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_cpu_intstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -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_irqstack_top[cpu];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -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_irqstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -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_irqstack_top[cpu];
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -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_irqstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -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_cpu_intstack_top[cpu];
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -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_cpu_intstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -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_irqstack_top[cpu];
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -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_irqstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -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_cpu_intstack_top[cpu];
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -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_cpu_intstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
|
|
@ -109,10 +109,6 @@ int up_backtrace(struct tcb_s *tcb,
|
|||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s *)arch_get_current_tcb();
|
||||
struct regs_context * p_regs;
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
void *istacklimit;
|
||||
#endif
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
|
@ -131,13 +127,9 @@ int up_backtrace(struct tcb_s *tcb,
|
|||
if (up_interrupt_context())
|
||||
{
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
# ifdef CONFIG_SMP
|
||||
istacklimit = (void *)arm64_intstack_top(up_cpu_index());
|
||||
# else
|
||||
istacklimit = g_interrupt_stack + INTSTACK_SIZE;
|
||||
# endif /* CONFIG_SMP */
|
||||
ret = backtrace(istacklimit - (CONFIG_ARCH_INTERRUPTSTACK & ~15),
|
||||
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
|
||||
|
|
|
@ -36,13 +36,9 @@
|
|||
* Name: up_get_intstackbase
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
uintptr_t up_get_intstackbase(int cpu)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
return arm64_intstack_alloc(cpu);
|
||||
#else
|
||||
return (uintptr_t)g_interrupt_stack;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -94,7 +94,7 @@ INIT_STACK_DEFINE(g_interrupt_fiq_stack, INTSTACK_SIZE);
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm64_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -103,25 +103,10 @@ INIT_STACK_DEFINE(g_interrupt_fiq_stack, INTSTACK_SIZE);
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
uintptr_t arm64_intstack_alloc(int cpu)
|
||||
uintptr_t up_get_intstackbase(int cpu)
|
||||
{
|
||||
return (uintptr_t)(g_interrupt_stacks[cpu]);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm64_intstack_top
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the top the correct interrupt stack allocation
|
||||
* for the current CPU.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uintptr_t arm64_intstack_top(int cpu)
|
||||
{
|
||||
return (uintptr_t)(g_interrupt_stacks[cpu] + INTSTACK_SIZE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -141,7 +126,7 @@ static void up_color_intstack(void)
|
|||
|
||||
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
|
||||
{
|
||||
arm64_stack_color((void *)arm64_intstack_alloc(cpu), INTSTACK_SIZE);
|
||||
arm64_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
|
||||
}
|
||||
#else
|
||||
arm64_stack_color((void *)g_interrupt_stack, INTSTACK_SIZE);
|
||||
|
|
|
@ -167,9 +167,6 @@ INIT_STACK_ARRAY_DEFINE_EXTERN(g_interrupt_stacks, CONFIG_SMP_NCPUS,
|
|||
INIT_STACK_ARRAY_DEFINE_EXTERN(g_interrupt_fiq_stacks, CONFIG_SMP_NCPUS,
|
||||
INTSTACK_SIZE);
|
||||
#endif
|
||||
|
||||
uintptr_t arm64_intstack_alloc(int cpu);
|
||||
uintptr_t arm64_intstack_top(int cpu);
|
||||
#else
|
||||
/* idle thread stack for primary core */
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# Common Sparc files (arch/sparc/src/common)
|
||||
|
||||
CMN_CSRCS += sparc_allocateheap.c sparc_createstack.c sparc_exit.c
|
||||
CMN_CSRCS += sparc_getintstack.c sparc_idle.c sparc_initialize.c
|
||||
CMN_CSRCS += sparc_idle.c sparc_initialize.c
|
||||
CMN_CSRCS += sparc_lowputs.c sparc_mdelay.c sparc_modifyreg8.c
|
||||
CMN_CSRCS += sparc_modifyreg16.c sparc_modifyreg32.c sparc_nputs.c
|
||||
CMN_CSRCS += sparc_releasestack.c sparc_stackframe.c
|
||||
|
|
|
@ -206,7 +206,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
|
|||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
size_t up_check_intstack(int cpu)
|
||||
{
|
||||
return sparc_stack_check((void *)sparc_intstack_alloc(cpu),
|
||||
return sparc_stack_check((void *)up_get_intstackbase(cpu),
|
||||
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/sparc/src/common/sparc_getintstack.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "sparc_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_get_intstackbase
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
uintptr_t up_get_intstackbase(int cpu)
|
||||
{
|
||||
return (uintptr_t)sparc_intstack_alloc(cpu);
|
||||
}
|
||||
#endif
|
|
@ -107,7 +107,7 @@ static inline void up_color_intstack(void)
|
|||
|
||||
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
|
||||
{
|
||||
sparc_stack_color((void *)sparc_intstack_alloc(cpu), INTSTACK_SIZE);
|
||||
sparc_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -195,13 +195,6 @@ int sparc_swint1(int irq, void *context, void *arg);
|
|||
|
||||
void sparc_sigdeliver(void);
|
||||
|
||||
/* Interrupt handling *******************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
uintptr_t sparc_intstack_alloc(int cpu);
|
||||
uintptr_t sparc_intstack_top(int cpu);
|
||||
#endif
|
||||
|
||||
/* Chip-specific functions **************************************************/
|
||||
|
||||
/* Chip specific functions defined in arch/sparc/src/<chip> */
|
||||
|
|
|
@ -499,27 +499,7 @@ int up_prioritize_irq(int irq, int priority)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sparc_intstack_top
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the top the correct interrupt stack allocation
|
||||
* for the current CPU.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
uintptr_t sparc_intstack_top(int cpu)
|
||||
{
|
||||
#if defined(CONFIG_SMP)
|
||||
return g_cpu_intstack_top[cpu];
|
||||
#else
|
||||
return g_cpu_intstack_top[0];
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sparc_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -528,7 +508,7 @@ uintptr_t sparc_intstack_top(int cpu)
|
|||
****************************************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
uintptr_t sparc_intstack_alloc(int cpu)
|
||||
uintptr_t up_get_intstackbase(int cpu)
|
||||
{
|
||||
#if defined(CONFIG_SMP)
|
||||
return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
|
||||
|
|
|
@ -229,11 +229,6 @@ void xtensa_window_spill(void);
|
|||
|
||||
/* IRQs */
|
||||
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
uintptr_t xtensa_intstack_alloc(int cpu);
|
||||
uintptr_t xtensa_intstack_top(int cpu);
|
||||
#endif
|
||||
|
||||
uint32_t *xtensa_int_decode(uint32_t cpuints, uint32_t *regs);
|
||||
uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs);
|
||||
uint32_t xtensa_enable_cpuint(uint32_t *shadow, uint32_t intmask);
|
||||
|
|
|
@ -235,16 +235,11 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
|
|||
if (up_interrupt_context())
|
||||
{
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
void *istackbase;
|
||||
#ifdef CONFIG_SMP
|
||||
istackbase = xtensa_intstack_alloc(up_cpu_index());
|
||||
#else
|
||||
istackbase = g_intstackalloc;
|
||||
#endif
|
||||
xtensa_window_spill();
|
||||
void *istackbase = (void *)up_get_intstackbase(up_cpu_index());
|
||||
|
||||
xtensa_window_spill();
|
||||
ret = backtrace_stack(istackbase,
|
||||
(istackbase + CONFIG_ARCH_INTERRUPTSTACK),
|
||||
istackbase + CONFIG_ARCH_INTERRUPTSTACK,
|
||||
(void *)up_getsp(), NULL,
|
||||
buffer, size, &skip);
|
||||
#else
|
||||
|
|
|
@ -36,13 +36,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 (uintptr_t)xtensa_intstack_alloc(cpu);
|
||||
#else
|
||||
return (uintptr_t)g_intstackalloc;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,16 +60,12 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
|
|||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
static inline void xtensa_color_intstack(void)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
int cpu;
|
||||
|
||||
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
|
||||
{
|
||||
xtensa_stack_color((void *)xtensa_intstack_alloc(cpu), INTSTACK_SIZE);
|
||||
xtensa_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
|
||||
}
|
||||
#else
|
||||
xtensa_stack_color((void *)g_intstackalloc, INTSTACK_SIZE);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
# define xtensa_color_intstack()
|
||||
|
|
|
@ -740,22 +740,7 @@ void up_enable_irq(int irq)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_intstack_top
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the top of the correct interrupt stack for the
|
||||
* given CPU.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
uintptr_t xtensa_intstack_top(int cpu)
|
||||
{
|
||||
return g_cpu_intstack_top[cpu];
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -763,7 +748,8 @@ uintptr_t xtensa_intstack_top(int cpu)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
uintptr_t xtensa_intstack_alloc(int cpu)
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
uintptr_t up_get_intstackbase(int cpu)
|
||||
{
|
||||
return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -687,22 +687,7 @@ void up_enable_irq(int irq)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_intstack_top
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the top of the correct interrupt stack for the
|
||||
* given CPU.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
uintptr_t xtensa_intstack_top(int cpu)
|
||||
{
|
||||
return g_cpu_intstack_top[cpu];
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_intstack_alloc
|
||||
* Name: up_get_intstackbase
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the "alloc" the correct interrupt stack allocation
|
||||
|
@ -710,7 +695,8 @@ uintptr_t xtensa_intstack_top(int cpu)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
uintptr_t xtensa_intstack_alloc(int cpu)
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
uintptr_t up_get_intstackbase(int cpu)
|
||||
{
|
||||
return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
|
||||
}
|
||||
|
|
|
@ -186,13 +186,9 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,
|
|||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
pdump->info.stacks.interrupt.top =
|
||||
(uint32_t)arm_intstack_top(up_cpu_index());
|
||||
#else
|
||||
pdump->info.stacks.interrupt.top = (uint32_t)g_intstacktop;
|
||||
#endif
|
||||
pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
up_get_intstackbase(up_cpu_index()) + INTSTACK_SIZE;
|
||||
pdump->info.stacks.interrupt.size = INTSTACK_SIZE;
|
||||
|
||||
/* If In interrupt Context save the interrupt stack data centered
|
||||
* about the interrupt stack pointer
|
||||
|
|
Loading…
Reference in a new issue