Beispiel #1
0
/*
 *  ======== TaskSupport_start ========
 *  Create a task's initial stack image
 */
Ptr TaskSupport_start(Ptr currTsk, ITaskSupport_FuncPtr enter,
                      ITaskSupport_FuncPtr exit, Error_Block *eb)
{
    Ptr sp;
    UInt size;
    Char *sptr;
    Task_Object *tsk = (Task_Object *)(currTsk);

    /*
     *  The SP register is only 16 bits on 28x. Ensure that the last address
     *  in the new stack is less than 0xffff
     */
    if (((ULong)tsk->stack) + (tsk->stackSize) >= MAX_SP_ADDR) {
        Error_raise(eb, TaskSupport_E_invalidStack, tsk->stack, 0);
        return (NULL);
    }

    /* Initialize every word in the stack to STACK_INIT_VAL */
    if (Task_initStackFlag) {
        size = tsk->stackSize;
        sptr = (Char *)tsk->stack;
        while (size--) {
            *sptr++ = STACK_INIT_VAL;
        }
    }

    sp = TaskSupport_buildTaskStack((Ptr)tsk->stack,
                                    tsk->fxn,
                                    exit,
                                    enter,
                                    tsk->arg0,
                                    tsk->arg1);

    return (sp);
}
Beispiel #2
0
/*
 *  ======== TaskSupport_start ========
 *  Create a task's initial stack image
 */
Ptr TaskSupport_start(Ptr currTsk, ITaskSupport_FuncPtr enter, ITaskSupport_FuncPtr exit, Error_Block *eb)
{
    Ptr sp;
    UInt size;
    Char *sptr;
    Task_Object *tsk = (Task_Object *)(currTsk);
    
    if (Task_initStackFlag) {
        size = tsk->stackSize;
        sptr = (Char *)tsk->stack;
        while (size--) {
            *sptr++ = 0xbe;     /* fill stack with known cookie */
        }
    }

    sp = TaskSupport_buildTaskStack((Ptr)((SizeT)tsk->stack + tsk->stackSize-8), tsk->fxn, exit, enter, tsk->arg0, tsk->arg1);

    return (sp);
}
Beispiel #3
0
/*
 *  ======== TaskSupport_start ========
 *  Create a task's initial stack image
 */
Ptr TaskSupport_start(Ptr currTsk, ITaskSupport_FuncPtr enter, ITaskSupport_FuncPtr exit, Error_Block *eb)
{
    Ptr sp;
    UInt size;
    Char *sptr;
    Task_Object *tsk = (Task_Object *)(currTsk);
    
    if (Task_initStackFlag) {
        size = tsk->stackSize;
        sptr = (Char *)tsk->stack;
        while (size--) {
            *sptr++ = 0xbe;     /* fill stack with known cookie */
        }
    }

    /* 
     * The stack buffer is already aligned on 8 bytes.
     * buildTaskStack creates a stack image that results in 8 byte alignment
     * on Task func entry only if passed a 4 byte aligned stack ptr
     */
    sp = TaskSupport_buildTaskStack((Ptr)((SizeT)tsk->stack + tsk->stackSize-4), tsk->fxn, exit, enter, tsk->arg0, tsk->arg1);

    return (sp);
}