Rev 73 | Rev 81 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 73 | Rev 76 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include <time/clock.h> |
46 | #include <time/clock.h> |
47 | #include <list.h> |
47 | #include <list.h> |
48 | #include <config.h> |
48 | #include <config.h> |
49 | #include <arch/interrupt.h> |
49 | #include <arch/interrupt.h> |
50 | #include <smp/ipi.h> |
50 | #include <smp/ipi.h> |
- | 51 | #include <arch/faddr.h> |
|
51 | 52 | ||
52 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; |
53 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; |
53 | 54 | ||
54 | spinlock_t threads_lock; |
55 | spinlock_t threads_lock; |
55 | link_t threads_head; |
56 | link_t threads_head; |
Line 162... | Line 163... | ||
162 | t->kstack = (__u8 *) frame_ks; |
163 | t->kstack = (__u8 *) frame_ks; |
163 | t->ustack = (__u8 *) frame_us; |
164 | t->ustack = (__u8 *) frame_us; |
164 | 165 | ||
165 | 166 | ||
166 | context_save(&t->saved_context); |
167 | context_save(&t->saved_context); |
167 | t->saved_context.pc = (__address) cushion; |
168 | t->saved_context.pc = FADDR(cushion); |
168 | t->saved_context.sp = (__address) &t->kstack[THREAD_STACK_SIZE-8]; |
169 | t->saved_context.sp = (__address) &t->kstack[THREAD_STACK_SIZE-8]; |
169 | 170 | ||
170 | pri = cpu_priority_high(); |
171 | pri = cpu_priority_high(); |
171 | t->saved_context.pri = cpu_priority_read(); |
172 | t->saved_context.pri = cpu_priority_read(); |
172 | cpu_priority_restore(pri); |
173 | cpu_priority_restore(pri); |