summaryrefslogtreecommitdiff
path: root/nuttx/arch/x86/src/i486/up_stackframe.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/x86/src/i486/up_stackframe.c')
-rw-r--r--nuttx/arch/x86/src/i486/up_stackframe.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/nuttx/arch/x86/src/i486/up_stackframe.c b/nuttx/arch/x86/src/i486/up_stackframe.c
index f2ab91f95..d8884b790 100644
--- a/nuttx/arch/x86/src/i486/up_stackframe.c
+++ b/nuttx/arch/x86/src/i486/up_stackframe.c
@@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
+#include <arch/irq.h>
#include "up_internal.h"
@@ -126,9 +127,15 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
/* Save the adjusted stack values in the struct tcb_s */
- topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size;
- tcb->adj_stack_ptr = (FAR void *)topaddr;
- tcb->adj_stack_size -= frame_size;
+ topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size;
+ tcb->adj_stack_ptr = (FAR void *)topaddr;
+ tcb->adj_stack_size -= frame_size;
+
+ /* Reset the initial stack pointer */
+
+ tcb->xcp.regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr;
+
+ /* And return the pointer to the allocated region */
return (FAR void *)(topaddr + sizeof(uint32_t));
}