Skip to content

Commit

Permalink
[kernel] properly initialize the default thread context very early to…
Browse files Browse the repository at this point in the history
… avoid crash on pixies
  • Loading branch information
travis geiselbrecht authored and travisg committed Dec 31, 2008
1 parent c60a2e6 commit 858b1ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/kernel/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 5 additions & 1 deletion kernel/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void thread_sleep(time_t delay)
exit_critical_section();
}

void thread_init(void)
void thread_init_early(void)
{
int i;

Expand All @@ -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));
Expand Down

0 comments on commit 858b1ad

Please sign in to comment.