]> xenbits.xensource.com Git - seabios.git/commitdiff
Clear thread info on each boot.
authorKevin O'Connor <kevin@koconnor.net>
Thu, 10 Dec 2009 01:04:54 +0000 (20:04 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 10 Dec 2009 01:04:54 +0000 (20:04 -0500)
Fix potential issue of threads being incorrect if ctrl+alt+del is
    pressed during POST.

src/post.c
src/util.c
src/util.h

index b37a37dfb600b4989bedba63d54d60dc1e0ef227..085fb91d81df772150e67a0fab50df26596c6aa6 100644 (file)
@@ -165,6 +165,7 @@ post()
     memmap_setup();
     ram_probe();
     malloc_setup();
+    thread_setup();
 
     // Init base pc hardware.
     pic_setup();
index ec2054ca6fc4c416e3c3ca6ade1f08100d748165..b1c116b044cee91eb9c6547da4978ebcfecb706a 100644 (file)
@@ -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()
index 3ab791edaeb3b94d91a03a5b0c1bf3bff9ae5d23..cf98857f69d0d354d70bb40b33781842e67781c6 100644 (file)
@@ -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();