arch/arm/versatilepb/board_initialize.c
/*
 * cpu_inittask - creates the initial state for a task
 *
 */
creates the initial state for a task
creates the initial state for a task
int cpu_inittask(struct tcb_s *tcb, int argc, char **argv)
{
  void **mcu_context = calloc(REG_NUMS, sizeof(void *));
  if (mcu_context == NULL)
  {
    return -ENOMEM;
  }
  void *bottom_sp =
    (void *)((unsigned int)tcb->stack_ptr_top - 8 * sizeof(void *));
  mcu_context[REG_R0]   = (void *)argc;
  mcu_context[REG_R1]   = (void *)argv;
  mcu_context[REG_LR]   = (void *)sched_default_task_exit_point;
  mcu_context[REG_PC]   = (void *)task_entry_point;
  mcu_context[REG_XPSR] = (void *)0x1000000;
  mcu_context[REG_SP]   = bottom_sp;
  tcb->mcu_context = mcu_context;
  return 0;
}
int cpu_inittask ( struct tcb_s * tcb , int argc , char * * argv ) { void * * mcu_context = calloc ( REG_NUMS , sizeof ( void * ) ) ; if ( mcu_context == NULL ) { return - ENOMEM ; } void * bottom_sp = ( void * ) ( ( unsigned int ) tcb -> stack_ptr_top - 8 * sizeof ( void * ) ) ; mcu_context [ REG_R0 ] = ( void * ) argc ; mcu_context [ REG_R1 ] = ( void * ) argv ; mcu_context [ REG_LR ] = ( void * ) sched_default_task_exit_point ; mcu_context [ REG_PC ] = ( void * ) task_entry_point ; mcu_context [ REG_XPSR ] = ( void * ) 0x1000000 ; mcu_context [ REG_SP ] = bottom_sp ; tcb -> mcu_context = mcu_context ; return 0 ; }
cpu_inittask - creates the initial state for a task
cpu_inittask - creates the initial state for a task
/* Initial MCU context */