arch: Initialize idle thread stack information

and remove the special handling in the stack dump

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia1ef9a427bd4c7f6cee9838d0445f29cfaca3998
This commit is contained in:
Xiang Xiao 2020-07-05 13:37:48 +08:00 committed by David Sidrane
parent 5fec6191c3
commit bf7399a982
91 changed files with 747 additions and 828 deletions

55
TODO
View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated July 2, 2020)
NuttX TODO List (Last updated July 19, 2020)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@ -295,49 +295,10 @@ o Task/Scheduler (sched/)
Task: IDLE THREAD TCB SETUP
Description: There are issues with setting IDLE thread stacks:
1. One problem is stack-related data in the IDLE threads TCB.
A solution might be to standardize the use of g_idle_topstack.
That you could add initialization like this in nx_start:
@@ -344,6 +347,11 @@ void nx_start(void)
g_idleargv[1] = NULL;
g_idletcb.argv = g_idleargv;
+ /* Set the IDLE task stack size */
+
+ g_idletcb.cmn.adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
+ g_idletcb.cmn.stack_alloc_ptr = (void *)(g_idle_topstack - CONFIG_IDLETHREAD_STACKSIZE);
+
/* Then add the idle task's TCB to the head of the ready to run list */
dq_addfirst((FAR dq_entry_t *)&g_idletcb, (FAR dq_queue_t *)&g_readytorun);
The g_idle_topstack variable is available for almost all architectures:
$ find . -name *.h | xargs grep g_idle_top
./arm/src/common/up_internal.h:EXTERN const uint32_t g_idle_topstack;
./avr/src/avr/avr.h:extern uint16_t g_idle_topstack;
./avr/src/avr32/avr32.h:extern uint32_t g_idle_topstack;
./hc/src/common/up_internal.h:extern uint16_t g_idle_topstack;
./mips/src/common/up_internal.h:extern uint32_t g_idle_topstack;
./misoc/src/lm32/lm32.h:extern uint32_t g_idle_topstack;
./renesas/src/common/up_internal.h:extern uint32_t g_idle_topstack;
./renesas/src/m16c/chip.h:extern uint32_t g_idle_topstack; /* Start of the heap */
./risc-v/src/common/up_internal.h:EXTERN uint32_t g_idle_topstack;
./x86/src/common/up_internal.h:extern uint32_t g_idle_topstack;
That omits these architectures: sh1, sim, xtensa, z16, z80,
ez80, and z8. All would have to support this common
global variable.
Also, the stack itself may be 8-, 16-, or 32-bits wide,
depending upon the architecture and do have differing
alignment requirements.
2. Another problem is colorizing that stack to use with
stack usage monitoring logic. There is logic in some
start functions to do this in a function called go_nx_start.
It is available in these architectures:
The problem is colorizing that stack to use with stack usage
monitoring logic. There is logic in some start functions to
do this in a function called go_nx_start.
It is available in these architectures:
./arm/src/efm32/efm32_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
./arm/src/kinetis/kinetis_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
@ -349,9 +310,9 @@ o Task/Scheduler (sched/)
./arm/src/tms570/tms570_boot.c:static void go_nx_start(void *pv, unsigned int nbytes)
./arm/src/xmc4/xmc4_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
But no others.
Status: Open
Priority: Low, only needed for more complete debug.
But no others.
Status: Open
Priority: Low, only needed for more complete debug.
Title: PRIORITY INHERITANCE WITH SPORADIC SCHEDULER
Description: The sporadic scheduler manages CPU utilization by a task by

View File

@ -187,16 +187,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -48,18 +48,6 @@
#include "arm_internal.h"
#include "arm_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -83,6 +71,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint32_t cpsr;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -224,16 +224,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -51,18 +51,6 @@
#include "psr.h"
#include "exc_return.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -85,6 +73,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -212,16 +212,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
_alert("Current sp: %08x\n", sp);

View File

@ -71,6 +71,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint32_t cpsr;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -217,16 +217,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Get the limits on the interrupt stack memory */

View File

@ -59,6 +59,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -209,16 +209,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
_alert("Current sp: %08x\n", sp);

View File

@ -48,18 +48,6 @@
#include "arm_internal.h"
#include "arm_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -83,6 +71,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint32_t cpsr;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -217,16 +217,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Get the limits on the interrupt stack memory */

View File

@ -59,6 +59,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -146,8 +146,11 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
* water marks.
*/
arm_stack_color((FAR void *)((uintptr_t)tcb->adj_stack_ptr -
tcb->adj_stack_size), tcb->adj_stack_size);
if (tcb->pid != 0)
{
arm_stack_color((FAR void *)((uintptr_t)tcb->adj_stack_ptr -
tcb->adj_stack_size), tcb->adj_stack_size);
}
#endif /* CONFIG_STACK_COLORATION */
return OK;

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -77,17 +77,6 @@ extern "C"
#define EXTERN extern
#endif
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
EXTERN const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Data
************************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Data
************************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Data
************************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -50,23 +50,8 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -50,23 +50,8 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -50,23 +50,8 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -56,17 +56,6 @@
#ifndef __ASSEMBLY__
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
extern const uintptr_t g_idle_topstack;
/* Each S32K1xx board must provide the following initialized structure. This is
* needed to establish the initial board clocking.
*/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Data
************************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Data
************************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -50,24 +50,8 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Inline Functions
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Public Data
************************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
@ -77,17 +61,6 @@ extern "C"
#define EXTERN extern
#endif
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
EXTERN const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Data
************************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -50,10 +50,6 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
@ -65,17 +61,6 @@ extern "C"
#define EXTERN extern
#endif
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
EXTERN const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -50,10 +50,6 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
@ -65,17 +61,6 @@ extern "C"
#define EXTERN extern
#endif
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
EXTERN const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -42,22 +42,6 @@
#include <nuttx/config.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
* linker script. _ebss lies at the end of the BSS region. The idle task
* stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE.
* The IDLE thread is the thread that the system boots on and, eventually,
* becomes the IDLE, do nothing task that runs only when there is nothing
* else to run. The heap continues from there until the end of memory.
* g_idle_topstack is a read-only variable the provides this computed
* address.
*/
extern const uintptr_t g_idle_topstack;
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -50,24 +50,8 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Inline Functions
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Public Data
************************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
@ -77,17 +61,6 @@ extern "C"
#define EXTERN extern
#endif
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the linker
* script. _ebss lies at the end of the BSS region. The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is
* the thread that the system boots on and, eventually, becomes the IDLE, do
* nothing task that runs only when there is nothing else to run. The heap
* continues from there until the end of memory. g_idle_topstack is a read-only
* variable the provides this computed address.
*/
EXTERN const uintptr_t g_idle_topstack;
/************************************************************************************
* Public Function Prototypes
************************************************************************************/

View File

@ -154,16 +154,8 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 1;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint16_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
}
ustackbase = (uint16_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -71,6 +71,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure. Zeroing
* all registers is a good debug helper, but should not be necessary.
*/

View File

@ -51,14 +51,6 @@
#include "up_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -119,7 +111,10 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
*/
#ifdef CONFIG_STACK_COLORATION
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
}
#endif
/* The AVR uses a push-down stack: the stack grows toward loweraddresses

View File

@ -124,16 +124,8 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -48,18 +48,6 @@
#include "up_internal.h"
#include "up_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -81,6 +69,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure. Zeroing
* all registers is a good debug helper, but should not be necessary.
*/

View File

@ -50,14 +50,6 @@
#include "up_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -119,7 +111,10 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
*/
#ifdef CONFIG_STACK_COLORATION
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
}
#endif
/* The AVR32 uses a push-down stack: the stack grows

View File

@ -49,14 +49,6 @@
#include "up_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -113,6 +105,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The CPU12 uses a push-down stack: the stack grows
* toward lower addresses in memory. Because the CPU12 stack
* operates as a decrement then store stack, the value assigned

View File

@ -199,16 +199,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint16_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
}
ustackbase = (uint16_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -46,18 +46,6 @@
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -80,6 +68,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -70,14 +70,6 @@
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -134,6 +126,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* MIPS uses a push-down stack: the stack grows toward loweraddresses in
* memory. The stack pointer register, points to the lowest, valid work
* address (the "top" of the stack). Items on the stack are referenced

View File

@ -144,16 +144,8 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -73,6 +73,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint32_t regval;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -50,4 +50,4 @@ CHIP_CSRCS += lm32_initialize.c lm32_initialstate.c lm32_interruptcontext.c
CHIP_CSRCS += lm32_irq.c lm32_releasepending.c lm32_releasestack.c
CHIP_CSRCS += lm32_stackframe.c lm32_swint.c lm32_unblocktask.c
CHIP_CSRCS += lm32_reprioritizertr.c lm32_schedulesigaction.c lm32_sigdeliver.c
CHIP_CSRCS += lm32_flushcache.c
CHIP_CSRCS += lm32_flushcache.c lm32_usetack.c

View File

@ -141,16 +141,8 @@ void lm32_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -49,18 +49,6 @@
#include "lm32.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -83,6 +71,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -0,0 +1,128 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_usestack.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 <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/tls.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_use_stack
*
* Description:
* Setup up stack-related information in the TCB using pre-allocated stack
* memory. This function is called only from nxtask_init() when a task or
* kernel thread is started (never for pthreads).
*
* The following TCB fields must be initialized:
*
* - adj_stack_size: Stack size after adjustment for hardware,
* processor, etc. This value is retained only for debug
* purposes.
* - stack_alloc_ptr: Pointer to allocated stack
* - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
* initial value of the stack pointer.
*
* Input Parameters:
* - tcb: The TCB of new task
* - stack_size: The allocated stack size.
*
* NOTE: Unlike up_stack_create() and up_stack_release, this function
* does not require the task type (ttype) parameter. The TCB flags will
* always be set to provide the task type to up_use_stack() if it needs
* that information.
*
****************************************************************************/
int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
{
size_t top_of_stack;
size_t size_of_stack;
#ifdef CONFIG_TLS_ALIGNED
/* Make certain that the user provided stack is properly aligned */
DEBUGASSERT(((uintptr_t)stack & TLS_STACK_MASK) == 0);
#endif
/* Is there already a stack allocated? */
if (tcb->stack_alloc_ptr)
{
/* Yes.. Release the old stack allocation */
up_release_stack(tcb, tcb->flags & TCB_FLAG_TTYPE_MASK);
}
/* Save the new stack allocation */
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The i486 uses a push-down stack: the stack grows toward loweraddresses
* in memory. The stack pointer register, points to the lowest, valid work
* address (the "top" of the stack). Items on the stack are referenced as
* positive word offsets from sp.
*/
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The i486 stack must be aligned at word (4 byte) boundaries. If necessary
* top_of_stack must be rounded down to the next boundary
*/
top_of_stack &= ~3;
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
/* Save the adjusted stack values in the struct tcb_s */
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
return OK;
}

View File

@ -50,4 +50,4 @@ CHIP_CSRCS += minerva_initialize.c minerva_initialstate.c minerva_interruptconte
CHIP_CSRCS += minerva_irq.c minerva_releasepending.c minerva_releasestack.c
CHIP_CSRCS += minerva_stackframe.c minerva_swint.c minerva_unblocktask.c
CHIP_CSRCS += minerva_reprioritizertr.c minerva_schedulesigaction.c minerva_sigdeliver.c
CHIP_CSRCS += minerva_flushcache.c minerva_doexceptions.c
CHIP_CSRCS += minerva_flushcache.c minerva_doexceptions.c minerva_usetack.c

View File

@ -148,16 +148,8 @@ void minerva_dumpstate(void)
* == NULL)
*/
if (rtcb->flink == NULL)
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t) rtcb->adj_stack_ptr;
ustacksize = (uint32_t) rtcb->adj_stack_size;
}
ustackbase = (uint32_t) rtcb->adj_stack_ptr;
ustacksize = (uint32_t) rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -75,6 +75,14 @@ void up_initial_state(struct tcb_s *tcb)
uint32_t regval;
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -0,0 +1,128 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_usestack.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 <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/tls.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_use_stack
*
* Description:
* Setup up stack-related information in the TCB using pre-allocated stack
* memory. This function is called only from nxtask_init() when a task or
* kernel thread is started (never for pthreads).
*
* The following TCB fields must be initialized:
*
* - adj_stack_size: Stack size after adjustment for hardware,
* processor, etc. This value is retained only for debug
* purposes.
* - stack_alloc_ptr: Pointer to allocated stack
* - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
* initial value of the stack pointer.
*
* Input Parameters:
* - tcb: The TCB of new task
* - stack_size: The allocated stack size.
*
* NOTE: Unlike up_stack_create() and up_stack_release, this function
* does not require the task type (ttype) parameter. The TCB flags will
* always be set to provide the task type to up_use_stack() if it needs
* that information.
*
****************************************************************************/
int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
{
size_t top_of_stack;
size_t size_of_stack;
#ifdef CONFIG_TLS_ALIGNED
/* Make certain that the user provided stack is properly aligned */
DEBUGASSERT(((uintptr_t)stack & TLS_STACK_MASK) == 0);
#endif
/* Is there already a stack allocated? */
if (tcb->stack_alloc_ptr)
{
/* Yes.. Release the old stack allocation */
up_release_stack(tcb, tcb->flags & TCB_FLAG_TTYPE_MASK);
}
/* Save the new stack allocation */
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The i486 uses a push-down stack: the stack grows toward loweraddresses
* in memory. The stack pointer register, points to the lowest, valid work
* address (the "top" of the stack). Items on the stack are referenced as
* positive word offsets from sp.
*/
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The i486 stack must be aligned at word (4 byte) boundaries. If necessary
* top_of_stack must be rounded down to the next boundary
*/
top_of_stack &= ~3;
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
/* Save the adjusted stack values in the struct tcb_s */
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
return OK;
}

View File

@ -224,16 +224,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -73,6 +73,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint32_t sr;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -0,0 +1,128 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_usestack.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 <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/tls.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_use_stack
*
* Description:
* Setup up stack-related information in the TCB using pre-allocated stack
* memory. This function is called only from nxtask_init() when a task or
* kernel thread is started (never for pthreads).
*
* The following TCB fields must be initialized:
*
* - adj_stack_size: Stack size after adjustment for hardware,
* processor, etc. This value is retained only for debug
* purposes.
* - stack_alloc_ptr: Pointer to allocated stack
* - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
* initial value of the stack pointer.
*
* Input Parameters:
* - tcb: The TCB of new task
* - stack_size: The allocated stack size.
*
* NOTE: Unlike up_stack_create() and up_stack_release, this function
* does not require the task type (ttype) parameter. The TCB flags will
* always be set to provide the task type to up_use_stack() if it needs
* that information.
*
****************************************************************************/
int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
{
size_t top_of_stack;
size_t size_of_stack;
#ifdef CONFIG_TLS_ALIGNED
/* Make certain that the user provided stack is properly aligned */
DEBUGASSERT(((uintptr_t)stack & TLS_STACK_MASK) == 0);
#endif
/* Is there already a stack allocated? */
if (tcb->stack_alloc_ptr)
{
/* Yes.. Release the old stack allocation */
up_release_stack(tcb, tcb->flags & TCB_FLAG_TTYPE_MASK);
}
/* Save the new stack allocation */
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The i486 uses a push-down stack: the stack grows toward loweraddresses
* in memory. The stack pointer register, points to the lowest, valid work
* address (the "top" of the stack). Items on the stack are referenced as
* positive word offsets from sp.
*/
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The i486 stack must be aligned at word (4 byte) boundaries. If necessary
* top_of_stack must be rounded down to the next boundary
*/
top_of_stack &= ~3;
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
/* Save the adjusted stack values in the struct tcb_s */
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
return OK;
}

View File

@ -41,6 +41,7 @@ CMN_CSRCS = up_initialize.c \
up_interruptcontext.c \
up_allocateheap.c \
up_createstack.c \
up_usestack.c \
up_releasestack.c \
up_stackframe.c \
up_initialstate.c \

View File

@ -50,14 +50,6 @@
#include "up_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -114,6 +106,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The SH family uses a push-down stack: the stack grows toward lower
* addresses in memory. The stack pointer register, points to the
* lowest, valid work address (the "top" of the stack). Items on the

View File

@ -266,7 +266,6 @@ extern uint32_t g_enronly; /* Start of relocated read-only data in FLASH *
extern uint32_t g_efronly; /* Start of relocated read-only data in FLASH */
#endif
extern uint32_t g_svarvect; /* Start of variable vectors */
extern uint32_t g_idle_topstack; /* Start of the heap */
/* Address of the saved user stack pointer */

View File

@ -151,16 +151,8 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 1;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint16_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
}
ustackbase = (uint16_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory.
* The near RAM memory map is as follows:

View File

@ -70,6 +70,14 @@ void up_initial_state(FAR struct tcb_s *tcb)
FAR struct xcptcontext *xcp = &tcb->xcp;
FAR uint8_t *regs = xcp->regs;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (FAR void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -142,16 +142,8 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 1;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint16_t)rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
istackbase = ebss; /* check how to declare ebss, as of now declared in chip.h */

View File

@ -61,6 +61,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -138,16 +138,8 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -44,14 +44,6 @@
#include "up_internal.h"
#include "up_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@ -96,6 +88,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -108,8 +108,6 @@ static inline void up_color_intstack(void)
void up_initialize(void)
{
FAR struct tcb_s *idle;
/* Colorize the interrupt stack */
up_color_intstack();
@ -118,13 +116,6 @@ void up_initialize(void)
up_addregion();
/* Initialize the idle task stack info */
idle = this_task(); /* It should be idle task */
idle->stack_alloc_ptr = _END_BSS;
idle->adj_stack_ptr = (FAR void *)g_idle_topstack;
idle->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
#ifdef CONFIG_PM
/* Initialize the power management subsystem. This MCU-specific function
* must be called *very* early in the initialization sequence *before* any

View File

@ -70,14 +70,6 @@
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -165,9 +157,12 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
* water marks.
*/
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
tcb->adj_stack_size - sizeof(struct tls_info_s));
if (tcb->pid != 0)
{
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
size_of_stack - sizeof(struct tls_info_s));
}
#endif
return OK;

View File

@ -199,16 +199,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -72,6 +72,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint32_t regval;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -210,16 +210,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 8;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uintptr_t)rtcb->adj_stack_ptr;
ustacksize = (uintptr_t)rtcb->adj_stack_size;
}
ustackbase = (uintptr_t)rtcb->adj_stack_ptr;
ustacksize = (uintptr_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -72,6 +72,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
uint64_t regval;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -66,6 +66,12 @@
void up_initial_state(struct tcb_s *tcb)
{
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(sim_getsp() -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t);
tcb->xcp.regs[JB_PC] = (xcpt_reg_t)tcb->start;

View File

@ -136,9 +136,12 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size)
* water marks.
*/
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
tcb->adj_stack_size - sizeof(struct tls_info_s));
if (tcb->pid != 0)
{
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
adj_stack_size - sizeof(struct tls_info_s));
}
#endif
return OK;

View File

@ -160,16 +160,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -48,18 +48,6 @@
#include "up_internal.h"
#include "up_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -81,6 +69,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -50,14 +50,6 @@
#include "up_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -114,6 +106,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The i486 uses a push-down stack: the stack grows toward loweraddresses
* in memory. The stack pointer register, points to the lowest, valid work
* address (the "top" of the stack). Items on the stack are referenced as

View File

@ -123,16 +123,8 @@ static void up_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0)
{
ustackbase = g_idle_topstack - 8;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint64_t)rtcb->adj_stack_ptr;
ustacksize = (uint64_t)rtcb->adj_stack_size;
}
ustackbase = (uint64_t)rtcb->adj_stack_ptr;
ustacksize = (uint64_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */
@ -216,7 +208,7 @@ static void _up_assert(void)
{
/* Are we in an interrupt handler or the idle task? */
if (g_current_regs || (this_task())->pid == 0)
if (g_current_regs || (running_task())->flink == NULL)
{
(void)up_irq_save();
for (; ; )

View File

@ -101,12 +101,6 @@ static void up_calibratedelay(void)
void up_initialize(void)
{
struct tcb_s *rtcb = this_task();
rtcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
rtcb->stack_alloc_ptr =
(void *)(g_idle_topstack - CONFIG_IDLETHREAD_STACKSIZE);
/* Initialize global variables */
g_current_regs = NULL;

View File

@ -34,18 +34,6 @@
#include "up_arch.h"
#include "sched/sched.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -70,6 +58,14 @@ void up_initial_state(struct tcb_s *tcb)
struct xcptcontext *xcp = &tcb->xcp;
struct tcb_s *rtcb;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -35,14 +35,6 @@
#include "up_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -99,6 +91,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The intel64 uses a push-down stack: the stack grows toward lower
* addresses in memory. The stack pointer register, points to the lowest,
* valid work address (the "top" of the stack). Items on the stack are

View File

@ -180,16 +180,8 @@ void xtensa_dumpstate(void)
/* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */
{
ustackbase = (uint32_t)&g_idlestack[IDLETHREAD_STACKWORDS - 1];
ustacksize = IDLETHREAD_STACKSIZE;
}
else
{
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
}
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
/* Get the limits on the interrupt stack memory */

View File

@ -73,6 +73,13 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb, g_idlestack, IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -157,9 +157,12 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
* water marks.
*/
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
tcb->adj_stack_size - sizeof(struct tls_info_s));
if (tcb->pid != 0)
{
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
size_of_stack - sizeof(struct tls_info_s));
}
#endif
return OK;

View File

@ -35,14 +35,6 @@
#include "z16_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -99,6 +91,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The ZNEO uses a push-down stack: the stack grows toward lower
* addresses in memory. The stack pointer register, points to the
* lowest, valid work address (the "top" of the stack). Items on

View File

@ -103,9 +103,9 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size;
tcb->adj_stack_size -= frame_size;
/* Reset the initial state */
/* Reset the initial stack pointer */
up_initial_state(tcb);
tcb->xcp.regs[REG_RSP] = (chipreg_t)tcb->adj_stack_ptr;
/* And return a pointer to the allocated memory */

View File

@ -34,14 +34,6 @@
#include "z80_internal.h"
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -98,6 +90,17 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#ifdef CONFIG_STACK_COLORATION
if (tcb->pid != 0)
{
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
}
#endif
/* The Z80 uses a push-down stack: the stack grows toward lower
* addresses in memory. The stack pointer register, points to the
* lowest, valid work address (the "top" of the stack). Items on

View File

@ -31,18 +31,6 @@
#include "z80_internal.h"
#include "z80_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -65,6 +53,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb,
(void *)CONFIG_STACK_BASE, CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -31,18 +31,6 @@
#include "z80_internal.h"
#include "z80_arch.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -65,6 +53,14 @@ void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
/* Initialize the idle thread stack */
if (tcb->pid == 0)
{
up_use_stack(tcb,
(void *)CONFIG_STACK_BASE, CONFIG_IDLETHREAD_STACKSIZE);
}
/* Initialize the initial exception register context structure */
memset(xcp, 0, sizeof(struct xcptcontext));

View File

@ -197,16 +197,8 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
pdump->info.stacks.user.sp = currentsp;
}
if (pdump->info.pid == 0)
{
pdump->info.stacks.user.top = g_idle_topstack - 4;
pdump->info.stacks.user.size = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
pdump->info.stacks.user.top = (uint32_t)rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size;
}
pdump->info.stacks.user.top = (uint32_t)rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */

View File

@ -449,16 +449,8 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
pdump->info.stacks.user.sp = currentsp;
}
if (pdump->info.pid == 0)
{
pdump->info.stacks.user.top = g_idle_topstack - 4;
pdump->info.stacks.user.size = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
}
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */

View File

@ -464,16 +464,8 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
pdump->info.stacks.user.sp = currentsp;
}
if (pdump->info.pid == 0)
{
pdump->info.stacks.user.top = g_idle_topstack - 4;
pdump->info.stacks.user.size = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
}
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */

View File

@ -403,16 +403,8 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
pdump->info.stacks.user.sp = currentsp;
}
if (pdump->info.pid == 0)
{
pdump->info.stacks.user.top = g_idle_topstack - 4;
pdump->info.stacks.user.size = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
}
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */

View File

@ -401,16 +401,8 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
pdump->info.stacks.user.sp = currentsp;
}
if (pdump->info.pid == 0)
{
pdump->info.stacks.user.top = g_idle_topstack - 4;
pdump->info.stacks.user.size = CONFIG_IDLETHREAD_STACKSIZE;
}
else
{
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
}
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */