src/ppe/pk/kernel/pk_thread_core.c
// This routine serves as a container for the PK_START_THREADS_HOOK and
// actually starts threads.  The helper routine __pk_call_pk_start_threads()
// arranges this routine to be called with interrupts disabled while running
// on the kernel stack.
//
// The reason for this roundabout is that we want to be able to run a hook
// routine (transparent to the application) that can hand over every last byte
// of free memory to "malloc()" - including the stack of main().  Since we
// always need to run on some stack, we chose to run the hook on the kernel
// stack. However to do this safely we need to make sure
// that no interrupts will happen during this time. When __pk_thread_resume()
// is finally called all stack-based context is lost but it doesn't matter at
// that point - it's a one-way street into thread execution.
//
// This is considered part of pk_start_threads() and so is also considered a
// 'core' routine.
This routine serves as a container for the PK_START_THREADS_HOOK and
actually starts threads.  The helper routine __pk_call_pk_start_threads()
arranges this routine to be called with interrupts disabled while running
on the kernel stack.

The reason for this roundabout is that we want to be able to run a hook
routine (transparent to the application) that can hand over every last byte
of free memory to "malloc()" - including the stack of main().  Since we
always need to run on some stack, we chose to run the hook on the kernel
stack. However to do this safely we need to make sure
that no interrupts will happen during this time. When __pk_thread_resume()
is finally called all stack-based context is lost but it doesn't matter at
that point - it's a one-way street into thread execution.

This is considered part of pk_start_threads() and so is also considered a
'core' routine.
This routine serves as a container for the PK_START_THREADS_HOOK and actually starts threads . The helper routine __pk_call_pk_start_threads () arranges this routine to be called with interrupts disabled while running on the kernel stack . The reason for this roundabout is that we want to be able to run a hook routine ( transparent to the application ) that can hand over every last byte of free memory to " malloc () " - including the stack of main () . Since we always need to run on some stack we chose to run the hook on the kernel stack . However to do this safely we need to make sure that no interrupts will happen during this time . When __pk_thread_resume () is finally called all stack - based context is lost but it doesn ' t matter at that point - it ' s a one - way street into thread execution . This is considered part of pk_start_threads () and so is also considered a ' core ' routine .
void
__pk_start_threads(void)
{
    PK_START_THREADS_HOOK;
    __pk_next_thread_resume();
    PK_PANIC(PK_START_THREADS_RETURNED);
}
void __pk_start_threads ( void ) { PK_START_THREADS_HOOK ; __pk_next_thread_resume ( ) ; PK_PANIC ( PK_START_THREADS_RETURNED ) ; }
This routine serves as a container for the PK_START_THREADS_HOOK and
actually starts threads.
This routine serves as a container for the PK_START_THREADS_HOOK and actually starts threads .