aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/sched.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-01-19 15:09:39 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-01-19 15:09:39 +0000
commit4e8586dfa35bf5114c0f620bdfcd2e0466e952a8 (patch)
treeadb15d5096bd1b899433760ce705a01dd38d8315 /extras/mini-os/sched.c
parent2b68aee8293cf43f29dc5cf7ac1f23ff612c4a61 (diff)
downloadxen-4e8586dfa35bf5114c0f620bdfcd2e0466e952a8.tar.gz
xen-4e8586dfa35bf5114c0f620bdfcd2e0466e952a8.tar.bz2
xen-4e8586dfa35bf5114c0f620bdfcd2e0466e952a8.zip
[MINIOS] More cleanups for the ia64 port.
Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
Diffstat (limited to 'extras/mini-os/sched.c')
-rw-r--r--extras/mini-os/sched.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/extras/mini-os/sched.c b/extras/mini-os/sched.c
index 9b111c28e5..69f398ed13 100644
--- a/extras/mini-os/sched.c
+++ b/extras/mini-os/sched.c
@@ -155,11 +155,27 @@ void schedule(void)
if(prev != next) switch_threads(prev, next);
}
-
-/* Gets run when a new thread is scheduled the first time ever,
- defined in x86_[32/64].S */
-extern void thread_starter(void);
-
+struct thread* create_thread(char *name, void (*function)(void *), void *data)
+{
+ struct thread *thread;
+ unsigned long flags;
+ /* Call architecture specific setup. */
+ thread = arch_create_thread(name, function, data);
+ /* Not runable, not exited, not sleeping */
+ thread->flags = 0;
+ thread->wakeup_time = 0LL;
+ set_runnable(thread);
+ local_irq_save(flags);
+ if(idle_thread != NULL) {
+ list_add_tail(&thread->thread_list, &idle_thread->thread_list);
+ } else if(function != idle_thread_fn)
+ {
+ printk("BUG: Not allowed to create thread before initialising scheduler.\n");
+ BUG();
+ }
+ local_irq_restore(flags);
+ return thread;
+}
void exit_thread(void)
{