[kernel] properly initialize the default thread context very early to avoid crash on pixies

This commit is contained in:
travis geiselbrecht
2008-12-23 21:55:41 +00:00
committed by Travis Geiselbrecht
parent c60a2e65c1
commit 858b1ad125
3 changed files with 9 additions and 1 deletions

View File

@@ -96,6 +96,7 @@ typedef struct thread {
#define DEFAULT_STACK_SIZE 8192
/* functions */
void thread_init_early(void);
void thread_init(void);
void thread_become_idle(void) __NO_RETURN;
void thread_set_name(const char *name);

View File

@@ -58,6 +58,9 @@ static void call_constructors(void)
void kmain(void) __NO_RETURN __EXTERNALLY_VISIBLE;
void kmain(void)
{
// get us into some sort of thread context
thread_init_early();
// early arch stuff
arch_early_init();

View File

@@ -409,7 +409,7 @@ void thread_sleep(time_t delay)
exit_critical_section();
}
void thread_init(void)
void thread_init_early(void)
{
int i;
@@ -432,6 +432,10 @@ void thread_init(void)
current_thread = t;
}
void thread_init(void)
{
}
void thread_set_name(const char *name)
{
strlcpy(current_thread->name, name, sizeof(current_thread->name));