| 428 | ****************************************************************************/ |
| 429 | |
| 430 | static void idle_group_initialize(void) |
| 431 | { |
| 432 | FAR struct tcb_s *tcb; |
| 433 | int hashndx; |
| 434 | int i; |
| 435 | |
| 436 | /* Assign the process ID(s) of ZERO to the idle task(s) */ |
| 437 | |
| 438 | for (i = 0; i < CONFIG_SMP_NCPUS; i++) |
| 439 | { |
| 440 | tcb = &g_idletcb[i]; |
| 441 | |
| 442 | hashndx = PIDHASH(i); |
| 443 | g_pidhash[hashndx] = tcb; |
| 444 | |
| 445 | /* Allocate the IDLE group */ |
| 446 | |
| 447 | DEBUGVERIFY( |
| 448 | group_allocate(tcb, tcb->flags)); |
| 449 | |
| 450 | /* Initialize the task join */ |
| 451 | |
| 452 | nxtask_joininit(tcb); |
| 453 | |
| 454 | #ifdef CONFIG_SMP |
| 455 | /* Create a stack for all CPU IDLE threads (except CPU0 which already |
| 456 | * has a stack). |
| 457 | */ |
| 458 | |
| 459 | if (i > 0) |
| 460 | { |
| 461 | DEBUGVERIFY(up_cpu_idlestack(i, tcb, CONFIG_IDLETHREAD_STACKSIZE)); |
| 462 | } |
| 463 | #endif |
| 464 | |
| 465 | /* Initialize the processor-specific portion of the TCB */ |
| 466 | |
| 467 | up_initial_state(tcb); |
| 468 | |
| 469 | /* Initialize the thread local storage */ |
| 470 | |
| 471 | tls_init_info(tcb); |
| 472 | |
| 473 | /* Complete initialization of the IDLE group. Suppress retention |
| 474 | * of child status in the IDLE group. |
| 475 | */ |
| 476 | |
| 477 | group_initialize(tcb); |
| 478 | tcb->group->tg_flags = GROUP_FLAG_NOCLDWAIT | GROUP_FLAG_PRIVILEGED; |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | /**************************************************************************** |
| 483 | * Public Functions |
no test coverage detected