From: Kevin O'Connor Date: Thu, 10 Dec 2009 01:04:54 +0000 (-0500) Subject: Clear thread info on each boot. X-Git-Tag: rel-0.5.0~18 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e9a67bf3871f232324107e8a5390a4e769ba42fc;p=seabios.git Clear thread info on each boot. Fix potential issue of threads being incorrect if ctrl+alt+del is pressed during POST. --- diff --git a/src/post.c b/src/post.c index b37a37d..085fb91 100644 --- a/src/post.c +++ b/src/post.c @@ -165,6 +165,7 @@ post() memmap_setup(); ram_probe(); malloc_setup(); + thread_setup(); // Init base pc hardware. pic_setup(); diff --git a/src/util.c b/src/util.c index ec2054c..b1c116b 100644 --- a/src/util.c +++ b/src/util.c @@ -134,7 +134,14 @@ struct thread_info { void *stackpos; }; -struct thread_info MainThread = {&MainThread, NULL}; +struct thread_info MainThread; + +void +thread_setup() +{ + MainThread.next = &MainThread; + MainThread.stackpos = NULL; +} struct thread_info * getCurThread() diff --git a/src/util.h b/src/util.h index 3ab791e..cf98857 100644 --- a/src/util.h +++ b/src/util.h @@ -147,6 +147,7 @@ static inline u8 readb(const void *addr) { // util.c inline u32 stack_hop(u32 eax, u32 edx, u32 ecx, void *func); extern struct thread_info MainThread; +void thread_setup(); struct thread_info *getCurThread(); void run_thread(void (*func)(void*), void *data); void wait_threads();