Skip to contentSkip to conversation

mini-os: last changes for ia64 port

PATCH In review Dietmar Hahn 3 participants 3 messages Jan 19, 2007 – Jan 24, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mini-os: last changes for ia64 port

Hi,

this is my last patch to mini-os (hopefully;-)), to get my ia64 port compiled. Please have a look and give comments!
Thanks.

Dietmar.

# HG changeset patch
# User [email protected]
# Date 1169209366 -3600
# Node ID cc8d0c4d999b0cc1363539a3d5cd71d04ee8b687 # Parent e9c7d2ed782fca937aa15131d42e69cbca32db02 Last changes for the ia64 port of mini-os.

extras/mini-os/arch/x86/sched.c +3 -17
diff -r e9c7d2ed782f -r cc8d0c4d999b extras/mini-os/arch/x86/sched.c
@@ -91,10 +91,11 @@ static void stack_push(struct thread *th
     *((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,23 +111,8 @@ struct thread* create_thread(char *name,
     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)
 {
extras/mini-os/include/sched.h +3 -0
diff -r e9c7d2ed782f -r cc8d0c4d999b 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);
extras/mini-os/lib/math.c +5 -0
diff -r e9c7d2ed782f -r cc8d0c4d999b extras/mini-os/lib/math.c
@@ -56,6 +56,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
@@ -380,3 +384,4 @@ __umoddi3(u_quad_t a, u_quad_t b)
         return (r);
 }
 
+#endif /* !defined(__ia64__) */
extras/mini-os/lib/xmalloc.c +6 -0
diff -r e9c7d2ed782f -r cc8d0c4d999b 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)
extras/mini-os/sched.c +21 -5
diff -r e9c7d2ed782f -r cc8d0c4d999b 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)
 {
extras/mini-os/arch/x86/time.c new file +225 -0

225 lines not on this page · raw message

extras/mini-os/time.c deleted +0 -225

225 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Already done.

Quoted 26 lines · Grzegorz Milos

Keir, thanks for applying this patch. Could you also apply Dietmar's previous patch:
http://lists.xensource.com/archives/html/xen-devel/2007-01/msg00786.html

(I'll deal with code cleanups later)

Thanks
Gregor

Quoted 9 lines · Dietmar Hahn

Hi,

this is my last patch to mini-os (hopefully;-)), to get my ia64 port compiled.
Please have a look and give comments!
Thanks.

Dietmar.
<mini-os.patch>

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel