Skip to contentSkip to conversation

Refactoring of mm and sched files

PATCH New Grzegorz Milos 1 participant 1 message Nov 21, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Refactoring of mm and sched files

Refactored mm.c and sched.c. x86 arch specific code got moved to arch/x86/mm.c and arch/x86/sched.c. Header files were also refactored: arch specific code got moved to include/x86/arch_mm.h and include/x86/sched_mm.h.

Keir could you apply please?

Cheers
Gregor

extras/mini-os/Makefile +4 -3
diff -r ae47b592ae32 extras/mini-os/Makefile
@@ -55,9 +55,10 @@
 endif
 
 ifeq ($(TARGET_ARCH),ia64)
-CFLAGS += -mfixed-range=f12-f15,f32-f127
-ASFLAGS += -x assembler-with-cpp -ansi -Wall
-ASFLAGS += -mfixed-range=f12-f15,f32-f127
+CFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127 -mconstant-gp
+ASFLAGS += -x assembler-with-cpp -Wall
+ASFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127 -fomit-frame-pointer
+ASFLAGS += -fno-builtin -fno-common -fno-strict-aliasing -mconstant-gp
 ARCH_LINKS = IA64_LINKS		# Special link on ia64 needed
 define arch_links
 [ -e include/ia64/asm-xsi-offsets.h ] || ln -sf ../../../../xen/include/asm-ia64/asm-xsi-offsets.h include/ia64/asm-xsi-offsets.h
extras/mini-os/include/mm.h +5 -170

193 lines not on this page · raw message

extras/mini-os/include/sched.h +15 -11
diff -r ae47b592ae32 extras/mini-os/include/sched.h
@@ -3,36 +3,40 @@
 
 #include <list.h>
 #include <time.h>
+#include <arch_sched.h>
 
 struct thread
 {
     char *name;
     char *stack;
+#if !defined(__ia64__)
     unsigned long sp;  /* Stack pointer */
     unsigned long ip;  /* Instruction pointer */
+#else /* !defined(__ia64__) */
+    thread_regs_t regs;
+#endif /* !defined(__ia64__) */
     struct list_head thread_list;
     u32 flags;
     s_time_t wakeup_time;
 };
 
+extern struct thread *idle_thread;
+void idle_thread_fn(void *unused);
 
+#define RUNNABLE_FLAG   0x00000001
+
+#define is_runnable(_thread)    (_thread->flags & RUNNABLE_FLAG)
+#define set_runnable(_thread)   (_thread->flags |= RUNNABLE_FLAG)
+#define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
+
+#define switch_threads(prev, next) arch_switch_threads(prev, next)
+ 
 
 void init_sched(void);
 void run_idle_thread(void);
 struct thread* create_thread(char *name, void (*function)(void *), void *data);
 void schedule(void);
 
-static inline struct thread* get_current(void)
-{
-    struct thread **current;
-#ifdef __i386__    
-    __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
-#else
-    __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
-#endif 
-    return *current;
-}
-          
 #define current get_current()
 
 
extras/mini-os/mm.c +6 -370

414 lines not on this page · raw message

extras/mini-os/sched.c +0 -137

157 lines not on this page · raw message

extras/mini-os/arch/x86/mm.c new file +428 -0

428 lines not on this page · raw message

extras/mini-os/arch/x86/sched.c new file +150 -0

150 lines not on this page · raw message

extras/mini-os/include/x86/arch_mm.h new file +209 -0

209 lines not on this page · raw message

extras/mini-os/include/x86/arch_sched.h new file +58 -0

58 lines not on this page · raw message

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