diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-19 15:09:39 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-19 15:09:39 +0000 |
commit | 4e8586dfa35bf5114c0f620bdfcd2e0466e952a8 (patch) | |
tree | adb15d5096bd1b899433760ce705a01dd38d8315 /extras/mini-os | |
parent | 2b68aee8293cf43f29dc5cf7ac1f23ff612c4a61 (diff) | |
download | xen-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')
-rw-r--r-- | extras/mini-os/arch/x86/sched.c | 20 | ||||
-rw-r--r-- | extras/mini-os/arch/x86/time.c (renamed from extras/mini-os/time.c) | 0 | ||||
-rw-r--r-- | extras/mini-os/include/sched.h | 3 | ||||
-rw-r--r-- | extras/mini-os/lib/math.c | 5 | ||||
-rw-r--r-- | extras/mini-os/lib/xmalloc.c | 6 | ||||
-rw-r--r-- | extras/mini-os/sched.c | 26 |
6 files changed, 38 insertions, 22 deletions
diff --git a/extras/mini-os/arch/x86/sched.c b/extras/mini-os/arch/x86/sched.c index e56479b90f..204980a564 100644 --- a/extras/mini-os/arch/x86/sched.c +++ b/extras/mini-os/arch/x86/sched.c @@ -91,10 +91,11 @@ static void stack_push(struct thread *thread, unsigned long value) *((unsigned long *)thread->sp) = value; } -struct thread* create_thread(char *name, void (*function)(void *), void *data) +/* Architecture specific setup of thread creation */ +struct thread* arch_create_thread(char *name, void (*function)(void *), + void *data) { struct thread *thread; - unsigned long flags; thread = xmalloc(struct thread); /* Allocate 2 pages for stack, stack will be 2pages aligned */ @@ -110,24 +111,9 @@ struct thread* create_thread(char *name, void (*function)(void *), void *data) stack_push(thread, (unsigned long) function); stack_push(thread, (unsigned long) data); thread->ip = (unsigned long) thread_starter; - - /* 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 run_idle_thread(void) { /* Switch stacks and run the thread */ diff --git a/extras/mini-os/time.c b/extras/mini-os/arch/x86/time.c index 0fad40f6de..0fad40f6de 100644 --- a/extras/mini-os/time.c +++ b/extras/mini-os/arch/x86/time.c diff --git a/extras/mini-os/include/sched.h b/extras/mini-os/include/sched.h index f162062c45..1425d0943c 100644 --- a/extras/mini-os/include/sched.h +++ b/extras/mini-os/include/sched.h @@ -31,6 +31,9 @@ void idle_thread_fn(void *unused); #define switch_threads(prev, next) arch_switch_threads(prev, next) + /* Architecture specific setup of thread creation. */ +struct thread* arch_create_thread(char *name, void (*function)(void *), + void *data); void init_sched(void); void run_idle_thread(void); diff --git a/extras/mini-os/lib/math.c b/extras/mini-os/lib/math.c index 8e97be6d18..5f5ed55ec2 100644 --- a/extras/mini-os/lib/math.c +++ b/extras/mini-os/lib/math.c @@ -57,6 +57,10 @@ #include <types.h> + /* On ia64 these functions lead to crashes. These are replaced by + * assembler functions. */ +#if !defined(__ia64__) + /* * Depending on the desired operation, we view a `long long' (aka quad_t) in * one or more of the following formats. @@ -380,3 +384,4 @@ __umoddi3(u_quad_t a, u_quad_t b) return (r); } +#endif /* !defined(__ia64__) */ diff --git a/extras/mini-os/lib/xmalloc.c b/extras/mini-os/lib/xmalloc.c index 32864dede4..3246d57b32 100644 --- a/extras/mini-os/lib/xmalloc.c +++ b/extras/mini-os/lib/xmalloc.c @@ -48,6 +48,12 @@ struct xmalloc_hdr /* Total including this hdr. */ size_t size; struct list_head freelist; +#if defined(__ia64__) + // Needed for ia64 as long as the align parameter in _xmalloc() + // is not supported. + uint64_t pad; +#endif + } __cacheline_aligned; static void maybe_split(struct xmalloc_hdr *hdr, size_t size, size_t block) 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) { |