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
+2 -2
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 */
+11 -8
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
+8 -12
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));
+8 -12
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));