[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about rtl_sched.c in 3.0pre6e.



Hi all,

I'm trying to understand how some of the new code in RTL 3.0 works -
specifically with the get_linux_current(...) code introduced in pre6d. 
This is called from the psc.o module to implement the user space calls
via the rtl_sigaction functionality.

I know it's probably bleeding obvious, but I can't figure out where 

	rtl_sched[cpu_id].rtlinux_task.stack

gets initialised so that this works (from rtl_sched.c):

	int *sp = rtl_get_linux_thread(rtl_getcpuid())->stack;
	return (struct task_struct *)((ulong)sp & (ulong)~8191UL);

I was expecting to see a rtl_init_stack(...) or something to set this up
in the rtl_sched init_module().  Can someone help?

This is my first attempt at understanding heavy duty magic like this, so
sorry about the gumby question.

regards to all,

Stuart Warren

code snippets from rtl_sched.c...

static inline pthread_t rtl_get_linux_thread(int cpu_id){
	return &(rtl_sched[cpu_id].rtl_linux_task);
}

struct task_struct *get_linux_current(void)
{
#if !defined(__i386__)
	return current;
#else
	if ( RTL_CURRENT == rtl_get_linux_thread(rtl_getcpuid()) )
	{
		return current;
	}
	else
	{
		int *sp = rtl_get_linux_thread(rtl_getcpuid())->stack;
		return (struct task_struct *)((ulong)sp & (ulong)~8191UL);
	}
#endif	
}