Some fixes needed for STM32 build after recent scheduler changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5620 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
2996aaa874
commit
1d6f0cbbd3
@ -127,7 +127,7 @@
|
||||
pid_t up_vfork(const struct vfork_s *context)
|
||||
{
|
||||
struct tcb_s *parent = (FAR struct tcb_s *)g_readytorun.head;
|
||||
struct tcb_s *child;
|
||||
struct task_tcb_s *child;
|
||||
size_t stacksize;
|
||||
uint32_t newsp;
|
||||
uint32_t newfp;
|
||||
@ -161,7 +161,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
|
||||
/* Allocate the stack for the TCB */
|
||||
|
||||
ret = up_create_stack(child, stacksize);
|
||||
ret = up_create_stack((FAR struct tcb_s *)child, stacksize);
|
||||
if (ret != OK)
|
||||
{
|
||||
sdbg("up_create_stack failed: %d\n", ret);
|
||||
@ -187,7 +187,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
* effort is overkill.
|
||||
*/
|
||||
|
||||
newsp = (uint32_t)child->adj_stack_ptr - stackutil;
|
||||
newsp = (uint32_t)child->cmn.adj_stack_ptr - stackutil;
|
||||
memcpy((void *)newsp, (const void *)context->sp, stackutil);
|
||||
|
||||
/* Was there a frame pointer in place before? */
|
||||
@ -196,7 +196,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
context->fp >= (uint32_t)parent->adj_stack_ptr - stacksize)
|
||||
{
|
||||
uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - context->fp;
|
||||
newfp = (uint32_t)child->adj_stack_ptr - frameutil;
|
||||
newfp = (uint32_t)child->cmn.adj_stack_ptr - frameutil;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -206,7 +206,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
svdbg("Old stack base:%08x SP:%08x FP:%08x\n",
|
||||
parent->adj_stack_ptr, context->sp, context->fp);
|
||||
svdbg("New stack base:%08x SP:%08x FP:%08x\n",
|
||||
child->adj_stack_ptr, newsp, newfp);
|
||||
child->cmn.adj_stack_ptr, newsp, newfp);
|
||||
|
||||
/* Update the stack pointer, frame pointer, and volatile registers. When
|
||||
* the child TCB was initialized, all of the values were set to zero.
|
||||
@ -215,15 +215,15 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
* child thread.
|
||||
*/
|
||||
|
||||
child->xcp.regs[REG_R4] = context->r4; /* Volatile register r4 */
|
||||
child->xcp.regs[REG_R5] = context->r5; /* Volatile register r5 */
|
||||
child->xcp.regs[REG_R6] = context->r6; /* Volatile register r6 */
|
||||
child->xcp.regs[REG_R7] = context->r7; /* Volatile register r7 */
|
||||
child->xcp.regs[REG_R8] = context->r8; /* Volatile register r8 */
|
||||
child->xcp.regs[REG_R9] = context->r9; /* Volatile register r9 */
|
||||
child->xcp.regs[REG_R10] = context->r10; /* Volatile register r10 */
|
||||
child->xcp.regs[REG_FP] = newfp; /* Frame pointer */
|
||||
child->xcp.regs[REG_SP] = newsp; /* Stack pointer */
|
||||
child->cmn.xcp.regs[REG_R4] = context->r4; /* Volatile register r4 */
|
||||
child->cmn.xcp.regs[REG_R5] = context->r5; /* Volatile register r5 */
|
||||
child->cmn.xcp.regs[REG_R6] = context->r6; /* Volatile register r6 */
|
||||
child->cmn.xcp.regs[REG_R7] = context->r7; /* Volatile register r7 */
|
||||
child->cmn.xcp.regs[REG_R8] = context->r8; /* Volatile register r8 */
|
||||
child->cmn.xcp.regs[REG_R9] = context->r9; /* Volatile register r9 */
|
||||
child->cmn.xcp.regs[REG_R10] = context->r10; /* Volatile register r10 */
|
||||
child->cmn.xcp.regs[REG_FP] = newfp; /* Frame pointer */
|
||||
child->cmn.xcp.regs[REG_SP] = newsp; /* Stack pointer */
|
||||
|
||||
/* And, finally, start the child task. On a failure, task_vforkstart()
|
||||
* will discard the TCB by calling task_vforkabort().
|
||||
|
@ -114,7 +114,7 @@
|
||||
pid_t up_vfork(const struct vfork_s *context)
|
||||
{
|
||||
struct tcb_s *parent = (FAR struct tcb_s *)g_readytorun.head;
|
||||
struct tcb_s *child;
|
||||
struct task_tcb_s *child;
|
||||
size_t stacksize;
|
||||
uint32_t newsp;
|
||||
#if CONFIG_MIPS32_FRAMEPOINTER
|
||||
@ -167,7 +167,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
|
||||
/* Allocate the stack for the TCB */
|
||||
|
||||
ret = up_create_stack(child, stacksize);
|
||||
ret = up_create_stack((FAR struct tcb_s *)child, stacksize);
|
||||
if (ret != OK)
|
||||
{
|
||||
sdbg("up_create_stack failed: %d\n", ret);
|
||||
@ -193,7 +193,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
* effort is overkill.
|
||||
*/
|
||||
|
||||
newsp = (uint32_t)child->adj_stack_ptr - stackutil;
|
||||
newsp = (uint32_t)child->cmn.adj_stack_ptr - stackutil;
|
||||
memcpy((void *)newsp, (const void *)context->sp, stackutil);
|
||||
|
||||
/* Was there a frame pointer in place before? */
|
||||
@ -203,7 +203,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
context->fp >= (uint32_t)parent->adj_stack_ptr - stacksize)
|
||||
{
|
||||
uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - context->fp;
|
||||
newfp = (uint32_t)child->adj_stack_ptr - frameutil;
|
||||
newfp = (uint32_t)child->cmn.adj_stack_ptr - frameutil;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -213,12 +213,12 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
svdbg("Old stack base:%08x SP:%08x FP:%08x\n",
|
||||
parent->adj_stack_ptr, context->sp, context->fp);
|
||||
svdbg("New stack base:%08x SP:%08x FP:%08x\n",
|
||||
child->adj_stack_ptr, newsp, newfp);
|
||||
child->cmn.adj_stack_ptr, newsp, newfp);
|
||||
#else
|
||||
svdbg("Old stack base:%08x SP:%08x\n",
|
||||
parent->adj_stack_ptr, context->sp);
|
||||
svdbg("New stack base:%08x SP:%08x\n",
|
||||
child->adj_stack_ptr, newsp);
|
||||
child->cmn.adj_stack_ptr, newsp);
|
||||
#endif
|
||||
|
||||
/* Update the stack pointer, frame pointer, global pointer and saved
|
||||
@ -228,22 +228,22 @@ pid_t up_vfork(const struct vfork_s *context)
|
||||
* indication to the newly started child thread.
|
||||
*/
|
||||
|
||||
child->xcp.regs[REG_S0] = context->s0; /* Saved register s0 */
|
||||
child->xcp.regs[REG_S1] = context->s1; /* Saved register s1 */
|
||||
child->xcp.regs[REG_S2] = context->s2; /* Saved register s2 */
|
||||
child->xcp.regs[REG_S3] = context->s3; /* Volatile register s3 */
|
||||
child->xcp.regs[REG_S4] = context->s4; /* Volatile register s4 */
|
||||
child->xcp.regs[REG_S5] = context->s5; /* Volatile register s5 */
|
||||
child->xcp.regs[REG_S6] = context->s6; /* Volatile register s6 */
|
||||
child->xcp.regs[REG_S7] = context->s7; /* Volatile register s7 */
|
||||
child->cmn.xcp.regs[REG_S0] = context->s0; /* Saved register s0 */
|
||||
child->cmn.xcp.regs[REG_S1] = context->s1; /* Saved register s1 */
|
||||
child->cmn.xcp.regs[REG_S2] = context->s2; /* Saved register s2 */
|
||||
child->cmn.xcp.regs[REG_S3] = context->s3; /* Volatile register s3 */
|
||||
child->cmn.xcp.regs[REG_S4] = context->s4; /* Volatile register s4 */
|
||||
child->cmn.xcp.regs[REG_S5] = context->s5; /* Volatile register s5 */
|
||||
child->cmn.xcp.regs[REG_S6] = context->s6; /* Volatile register s6 */
|
||||
child->cmn.xcp.regs[REG_S7] = context->s7; /* Volatile register s7 */
|
||||
#if CONFIG_MIPS32_FRAMEPOINTER
|
||||
child->xcp.regs[REG_FP] = newfp; /* Frame pointer */
|
||||
child->cmn.xcp.regs[REG_FP] = newfp; /* Frame pointer */
|
||||
#else
|
||||
child->xcp.regs[REG_S8] = context->s8; /* Volatile register s8 */
|
||||
child->cmn.xcp.regs[REG_S8] = context->s8; /* Volatile register s8 */
|
||||
#endif
|
||||
child->xcp.regs[REG_SP] = newsp; /* Stack pointer */
|
||||
child->cmn.xcp.regs[REG_SP] = newsp; /* Stack pointer */
|
||||
#if MIPS32_SAVE_GP
|
||||
child->xcp.regs[REG_GP] = newsp; /* Global pointer */
|
||||
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
|
||||
#endif
|
||||
|
||||
/* And, finally, start the child task. On a failure, task_vforkstart()
|
||||
|
@ -637,9 +637,9 @@ void task_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook, FAR void
|
||||
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
|
||||
*/
|
||||
|
||||
FAR struct tcb_s *task_vforksetup(start_t retaddr);
|
||||
pid_t task_vforkstart(FAR struct tcb_s *child);
|
||||
void task_vforkabort(FAR struct tcb_s *child, int errcode);
|
||||
FAR struct task_tcb_s *task_vforksetup(start_t retaddr);
|
||||
pid_t task_vforkstart(FAR struct task_tcb_s *child);
|
||||
void task_vforkabort(FAR struct task_tcb_s *child, int errcode);
|
||||
|
||||
/* sched_foreach will enumerate over each task and provide the
|
||||
* TCB of each task to a user callback functions. Interrupts
|
||||
|
@ -373,8 +373,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
if (policy == SCHED_RR)
|
||||
{
|
||||
ptcb->flags |= TCB_FLAG_ROUND_ROBIN;
|
||||
ptcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK;
|
||||
ptcb->cmn.flags |= TCB_FLAG_ROUND_ROBIN;
|
||||
ptcb->cmn.timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct tcb_s *task_vforksetup(start_t retaddr)
|
||||
FAR struct task_tcb_s *task_vforksetup(start_t retaddr)
|
||||
{
|
||||
struct tcb_s *parent = (FAR struct tcb_s *)g_readytorun.head;
|
||||
struct task_tcb_s *child;
|
||||
@ -152,7 +152,7 @@ FAR struct tcb_s *task_vforksetup(start_t retaddr)
|
||||
}
|
||||
|
||||
svdbg("parent=%p, returning child=%p\n", parent, child);
|
||||
return (FAR struct tcb_s *)child;
|
||||
return child;
|
||||
|
||||
errout_with_tcb:
|
||||
sched_releasetcb((FAR struct tcb_s *)child);
|
||||
@ -203,7 +203,7 @@ errout_with_tcb:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
pid_t task_vforkstart(FAR struct tcb_s *child)
|
||||
pid_t task_vforkstart(FAR struct task_tcb_s *child)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
struct tcb_s *parent = (FAR struct tcb_s *)g_readytorun.head;
|
||||
@ -226,15 +226,15 @@ pid_t task_vforkstart(FAR struct tcb_s *child)
|
||||
name = NULL;
|
||||
#endif
|
||||
|
||||
(void)task_argsetup(child, name, (const char **)NULL);
|
||||
(void)task_argsetup(child, name, (FAR char * const *)NULL);
|
||||
|
||||
/* Get the assigned pid before we start the task */
|
||||
|
||||
pid = (int)child->pid;
|
||||
pid = (int)child->cmn.pid;
|
||||
|
||||
/* Activate the task */
|
||||
|
||||
ret = task_activate(child);
|
||||
ret = task_activate((FAR struct tcb_s *)child);
|
||||
if (ret != OK)
|
||||
{
|
||||
task_vforkabort(child, -ret);
|
||||
@ -317,7 +317,7 @@ pid_t task_vforkstart(FAR struct tcb_s *child)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void task_vforkabort(FAR struct tcb_s *child, int errcode)
|
||||
void task_vforkabort(FAR struct task_tcb_s *child, int errcode)
|
||||
{
|
||||
/* The TCB was added to the active task list by task_schedsetup() */
|
||||
|
||||
@ -325,6 +325,6 @@ void task_vforkabort(FAR struct tcb_s *child, int errcode)
|
||||
|
||||
/* Release the TCB */
|
||||
|
||||
sched_releasetcb(child);
|
||||
sched_releasetcb((FAR struct tcb_s *)child);
|
||||
set_errno(errcode);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user