Corrections needed after further test of stack-based task arguments

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5771 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-03-21 23:37:11 +00:00
parent c496b7aad9
commit e29d6479c9
11 changed files with 97 additions and 22 deletions

View File

@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_internal.h"
@ -136,9 +137,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));
}

View File

@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_internal.h"
@ -109,9 +110,16 @@ 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;
/* Set the initial stack pointer to the "base" of the allocated stack */
tcb->xcp.regs[REG_SPH] = (uint8_t)((uint16_t)tcb->adj_stack_ptr >> 8);
tcb->xcp.regs[REG_SPL] = (uint8_t)((uint16_t)tcb->adj_stack_ptr & 0xff);
/* And return the pointer to the allocated region */
return (FAR void *)(topaddr + sizeof(uint8_t));
}

View File

@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_internal.h"
@ -125,9 +126,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));
}

View File

@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_internal.h"
@ -125,9 +126,16 @@ 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;
return (FAR void *)(topaddr + sizeof(uint32_t));
/* Reset the initial stack pointer */
tcb->xcp.regs[REG_SPH] = (uint16_t)tcb->adj_stack_ptr >> 8;
tcb->xcp.regs[REG_SPL] = (uint16_t)tcb->adj_stack_ptr & 0xff;
/* And return the pointer to the allocated region */
return (FAR void *)(topaddr + sizeof(uint16_t));
}

View File

@ -128,9 +128,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));
}

View File

@ -189,6 +189,12 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
tcb->adj_stack_ptr = (FAR void *)topaddr;
tcb->adj_stack_size -= frame_size;
/* Reset the initial state */
up_initial_state(tcb);
/* And return a pointer to the allocated memory region */
return (FAR void *)(topaddr + sizeof(uint32_t));
}
#endif

View File

@ -128,5 +128,11 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
tcb->adj_stack_ptr = (FAR void *)topaddr;
tcb->adj_stack_size -= frame_size;
/* Reset the initial state */
up_initial_state(tcb);
/* And return a pointer to allocated memory */
return (FAR void *)(topaddr + sizeof(uint32_t));
}

View File

@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_internal.h"
@ -129,5 +130,11 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
tcb->adj_stack_ptr = (FAR void *)topaddr;
tcb->adj_stack_size -= frame_size;
/* Reset the initial state */
tcb->xcp.regs[JB_SP] = (uint32_t)tcb->adj_stack_ptr;
/* And return a pointer to the allocated memory */
return (FAR void *)(topaddr + sizeof(uint32_t));
}

View File

@ -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));
}

View File

@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_internal.h"
@ -124,9 +125,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/2] = (uint32_t)tcb->adj_stack_ptr;
/* And return a pointer to the allocated memory */
return (FAR void *)(topaddr + sizeof(uint32_t));
}

View File

@ -128,5 +128,11 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
tcb->adj_stack_ptr = (FAR void *)topaddr;
tcb->adj_stack_size -= frame_size;
/* Reset the initial state */
up_initial_state(tcb);
/* And return a pointer to the allocated memory */
return (FAR void *)(topaddr + sizeof(uint32_t));
}