Exemplo n.º 1
0
static int __wind_errno_taskget(struct task_struct *curr, struct pt_regs *regs)
{
	xnhandle_t handle = __xn_reg_arg1(regs);
	WIND_TCB *pTcb;
	int errcode;

	if (!__xn_access_ok
	    (curr, VERIFY_WRITE, __xn_reg_arg2(regs), sizeof(errcode)))
		return -EFAULT;

	if (!handle)
		errcode = wind_errnoget();
	else {
		pTcb = (WIND_TCB *)xnregistry_fetch(handle);
		if (!pTcb)
			return S_objLib_OBJ_ID_ERROR;

		errcode = errnoOfTaskGet((TASK_ID) pTcb);
		if (errcode == ERROR)
			return wind_errnoget();
	}

	__xn_copy_to_user(curr, (void __user *)__xn_reg_arg2(regs), &errcode,
			  sizeof(errcode));

	return 0;
}
Exemplo n.º 2
0
static int __wind_errno_taskget(struct pt_regs *regs)
{
	xnhandle_t handle = __xn_reg_arg1(regs);
	WIND_TCB *pTcb;
	int errcode;

 	if (!handle)
 		errcode = wind_errnoget();
 	else {
 		pTcb = __wind_lookup_task(handle);
 		if (!pTcb)
 			return S_objLib_OBJ_ID_ERROR;
 
 		errcode = errnoOfTaskGet((TASK_ID) pTcb);
 		if (errcode == ERROR)
 			return wind_errnoget();
 	}

	return __xn_safe_copy_to_user((void __user *)__xn_reg_arg2(regs), &errcode,
				      sizeof(errcode));
}
Exemplo n.º 3
0
STATUS taskInfoGet
    (
    int         tid,            /* ID of task for which to get info */
    TASK_DESC   *pTaskDesc      /* task descriptor to be filled in */
    )
    {
    int 	    key;
    FAST char	   *pStackHigh;
    FAST TASK_DESC *pTd  = pTaskDesc;
    WIND_TCB 	   *pTcb = taskTcb (tid);

    if (pTcb == NULL)				/* valid task ID? */
	return (ERROR);

    /* gather the information */

#if CPU_FAMILY==I960
    if (tid != taskIdSelf ())	/* showing our current sp is not possible */
	taskRegsStackToTcb (pTcb);
#endif	/* CPU_FAMILY==I960 */

    pTd->td_id		= (int) pTcb;			/* task ID */
    pTd->td_name	= pTcb->name;			/* name of task */
    pTd->td_priority	= (int) pTcb->priority; 	/* priority */
    pTd->td_status	= pTcb->status;			/* task status*/
    pTd->td_options	= pTcb->options;		/* task option bits */
    pTd->td_entry	= pTcb->entry;			/* entry of task */
    pTd->td_sp		= (char *)((int)pTcb->regs.spReg);	/* saved stack ptr */

    pTd->td_pStackLimit	= pTcb->pStackLimit;		/* limit of stack */
    pTd->td_pStackBase	= pTcb->pStackBase;		/* bottom of stack */
    pTd->td_pStackEnd	= pTcb->pStackEnd;		/* end of the stack */

#if (_STACK_DIR==_STACK_GROWS_DOWN)
    if (pTcb->options & VX_NO_STACK_FILL)
	pStackHigh = pTcb->pStackLimit;
    else
	for (pStackHigh = pTcb->pStackLimit;
	     *(UINT8 *)pStackHigh == 0xee; pStackHigh ++)
	    ;
#else 	/* _STACK_GROWS_UP */
    if (pTcb->options & VX_NO_STACK_FILL)
	pStackHigh = pTcb->pStackLimit - 1;
    else
	for (pStackHigh = pTcb->pStackLimit - 1;
	     *(UINT8 *)pStackHigh == 0xee; pStackHigh --)
	    ;
#endif 	/* _STACK_GROWS_UP */


    pTd->td_stackSize   = (int)(pTcb->pStackLimit - pTcb->pStackBase) *
			  _STACK_DIR;
    pTd->td_stackHigh	= (int)(pStackHigh - pTcb->pStackBase) * _STACK_DIR;
    pTd->td_stackMargin	= (int)(pTcb->pStackLimit - pStackHigh) * _STACK_DIR;
    pTd->td_stackCurrent= (int)(pTd->td_sp - pTcb->pStackBase) * _STACK_DIR;

    pTd->td_errorStatus	= errnoOfTaskGet (tid);		/* most recent error */

    /* if task is delayed, get the time to fire out of the task's tick node */

    if (pTcb->status & WIND_DELAY)
	pTd->td_delay = Q_KEY (&tickQHead, &pTcb->tickNode, 1);
    else
	pTd->td_delay = 0;			/* not delayed */

    /* copy the VxWorks events information */

    key = intLock ();
    pTd->td_events = pTcb->events;
    intUnlock (key);

    return (OK);
    }