The basic idea is the same as that of x86. However in case of trimedia, the return addresse is stored in register 2 and the arguments are passed through registers 5 & 6.
void CPU_Context_Initialize(struct reg_context *the_context,void *stack_base,
oskit_u32_t stack_size,
void *(*entry_point)(void *,void *),
void *(*thread_fun)(void *),
void *thread_arg)
{
oskit_u32_t stack;
stack=((int)stack_base)+stack_size;
the_context->reg[2]=(oskit_u32_t)entry_point;
the_context->reg[3]=(oskit_u32_t)stack;
the_context->reg[4]=(oskit_u32_t)stack;
the_context->reg[5]=(oskit_u32_t)thread_fun;
the_context->reg[6]=(oskit_u32_t)thread_arg;
the_context->pcsw=0;
the_context->dpc=0;
the_context->spc=0;
}