[syslinux:lwip] thread: make kill_thread() actually do its job

syslinux-bot for H. Peter Anvin hpa at zytor.com
Wed Apr 27 09:31:00 PDT 2011


Commit-ID:  e0d9a80bd9690cdd4fc6c13c7eebe11cb26bf53e
Gitweb:     http://syslinux.zytor.com/commit/e0d9a80bd9690cdd4fc6c13c7eebe11cb26bf53e
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 27 Apr 2011 09:27:10 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 27 Apr 2011 09:27:10 -0700

thread: make kill_thread() actually do its job

kill_thread() had been modifying errno(!) as if it had been the return
value... in other words, it really did absolutely nothing.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/include/thread.h      |   12 +++++++++++-
 core/thread/kill_thread.c  |    2 +-
 core/thread/start_thread.c |   10 ----------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/core/include/thread.h b/core/include/thread.h
index be3844a..44084ff 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -19,6 +19,16 @@ struct thread_list {
     struct thread_list *next, *prev;
 };
 
+/*
+ * Stack frame used by __switch_to, see thread_asm.S
+ */
+struct thread_stack {
+    int errno;
+    uint16_t rmsp, rmss;
+    uint32_t edi, esi, ebp, ebx;
+    void (*eip)(void);
+};
+
 struct thread_block {
     struct thread_list list;
     struct thread *thread;
@@ -29,7 +39,7 @@ struct thread_block {
 };
 
 struct thread {
-    void *esp;			/* Must be first; stack pointer */
+    struct thread_stack *esp;	/* Must be first; stack pointer */
     const char *name;		/* Name (for debugging) */
     struct thread_list  list;
     struct thread_block *blocked;
diff --git a/core/thread/kill_thread.c b/core/thread/kill_thread.c
index 83accee..c22517c 100644
--- a/core/thread/kill_thread.c
+++ b/core/thread/kill_thread.c
@@ -18,7 +18,7 @@ void kill_thread(struct thread *thread)
      * Muck with the stack so that the next time the thread is run then
      * we end up going to __exit_thread.
      */
-    *(func_ptr *)thread->esp = __exit_thread;
+    thread->esp->eip = __exit_thread;
     thread->prio = INT_MIN;
 
     block = thread->blocked;
diff --git a/core/thread/start_thread.c b/core/thread/start_thread.c
index dd2a4de..328d6e7 100644
--- a/core/thread/start_thread.c
+++ b/core/thread/start_thread.c
@@ -8,16 +8,6 @@
 
 extern void __start_thread(void);
 
-/*
- * Stack frame used by __switch_to, see thread_asm.S
- */
-struct thread_stack {
-    int errno;
-    uint16_t rmsp, rmss;
-    uint32_t edi, esi, ebp, ebx;
-    void (*eip)(void);
-};
-
 struct thread *start_thread(const char *name, size_t stack_size, int prio,
 			    void (*start_func)(void *), void *func_arg)
 {



More information about the Syslinux-commits mailing list