]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
make cpu_sched.c common for both x86 cpus
authorAntti Kantee <pooka@iki.fi>
Mon, 20 Apr 2015 20:49:17 +0000 (20:49 +0000)
committerAntti Kantee <pooka@iki.fi>
Mon, 20 Apr 2015 20:49:17 +0000 (20:49 +0000)
lib/librumprun_core/arch/amd64/Makefile.inc
lib/librumprun_core/arch/i386/Makefile.inc
lib/librumprun_core/arch/i386/cpu_sched.c [deleted file]
lib/librumprun_core/arch/x86/Makefile.inc [new file with mode: 0644]
lib/librumprun_core/arch/x86/cpu_sched.c [new file with mode: 0644]

index 7bc171342d1ee876cc81df9c82c8436a0aabf9b0..80b2d560273a40487e3cf5ec242d1300dc462c0c 100644 (file)
@@ -2,3 +2,5 @@ MYDIR:= ${.PARSEDIR}
 .PATH: ${MYDIR}
 
 SRCS+= cpu_sched_switch.S
+
+.include "${MYDIR}/../x86/Makefile.inc"
index 1ed2c41d8cba08a1ac2c7103b591852ea9ee9606..80b2d560273a40487e3cf5ec242d1300dc462c0c 100644 (file)
@@ -2,4 +2,5 @@ MYDIR:= ${.PARSEDIR}
 .PATH: ${MYDIR}
 
 SRCS+= cpu_sched_switch.S
-SRCS+= cpu_sched.c
+
+.include "${MYDIR}/../x86/Makefile.inc"
diff --git a/lib/librumprun_core/arch/i386/cpu_sched.c b/lib/librumprun_core/arch/i386/cpu_sched.c
deleted file mode 100644 (file)
index f9c945d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- ****************************************************************************
- * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
- ****************************************************************************
- *
- *        File: sched.c
- *      Author: Grzegorz Milos
- *     Changes: Robert Kaiser
- *
- *        Date: Aug 2005
- *
- * Environment: Xen Minimal OS
- * Description: simple scheduler for Mini-Os
- *
- * The scheduler is non-preemptive (cooperative), and schedules according
- * to Round Robin algorithm.
- *
- ****************************************************************************
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <bmk-core/core.h>
-#include <bmk-core/sched.h>
-
-static void
-stack_push(void **stackp, unsigned long value)
-{
-       unsigned long *stack = *stackp;
-
-       stack--;
-       *stack = value;
-       *stackp = stack;
-}
-
-void
-bmk_cpu_sched_create(struct bmk_thread *thread, struct bmk_tcb *tcb,
-       void (*f)(void *), void *arg,
-       void *stack_base, unsigned long stack_size)
-{
-       void *stack_top = (char *)stack_base + stack_size;
-
-       /* Save pointer to the thread on the stack, used by current macro */
-       *(unsigned long *)stack_base = (unsigned long)thread;
-
-       /* these values are used by bmk_cpu_sched_bouncer() */
-       stack_push(&stack_top, (unsigned long)f);
-       stack_push(&stack_top, (unsigned long)arg);
-
-       tcb->btcb_sp = (unsigned long)stack_top;
-       tcb->btcb_ip = (unsigned long)bmk_cpu_sched_bouncer;
-}
-
-struct bmk_thread *
-bmk_cpu_sched_current(void)
-{
-       struct bmk_thread **current;
-
-       current = (void *)((unsigned long)&current & ~(bmk_stacksize-1));
-       return *current;
-};
diff --git a/lib/librumprun_core/arch/x86/Makefile.inc b/lib/librumprun_core/arch/x86/Makefile.inc
new file mode 100644 (file)
index 0000000..757c137
--- /dev/null
@@ -0,0 +1,4 @@
+X86DIR:=${.PARSEDIR}
+.PATH: ${X86DIR}
+
+SRCS+= cpu_sched.c
diff --git a/lib/librumprun_core/arch/x86/cpu_sched.c b/lib/librumprun_core/arch/x86/cpu_sched.c
new file mode 100644 (file)
index 0000000..f9c945d
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ ****************************************************************************
+ * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
+ ****************************************************************************
+ *
+ *        File: sched.c
+ *      Author: Grzegorz Milos
+ *     Changes: Robert Kaiser
+ *
+ *        Date: Aug 2005
+ *
+ * Environment: Xen Minimal OS
+ * Description: simple scheduler for Mini-Os
+ *
+ * The scheduler is non-preemptive (cooperative), and schedules according
+ * to Round Robin algorithm.
+ *
+ ****************************************************************************
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <bmk-core/core.h>
+#include <bmk-core/sched.h>
+
+static void
+stack_push(void **stackp, unsigned long value)
+{
+       unsigned long *stack = *stackp;
+
+       stack--;
+       *stack = value;
+       *stackp = stack;
+}
+
+void
+bmk_cpu_sched_create(struct bmk_thread *thread, struct bmk_tcb *tcb,
+       void (*f)(void *), void *arg,
+       void *stack_base, unsigned long stack_size)
+{
+       void *stack_top = (char *)stack_base + stack_size;
+
+       /* Save pointer to the thread on the stack, used by current macro */
+       *(unsigned long *)stack_base = (unsigned long)thread;
+
+       /* these values are used by bmk_cpu_sched_bouncer() */
+       stack_push(&stack_top, (unsigned long)f);
+       stack_push(&stack_top, (unsigned long)arg);
+
+       tcb->btcb_sp = (unsigned long)stack_top;
+       tcb->btcb_ip = (unsigned long)bmk_cpu_sched_bouncer;
+}
+
+struct bmk_thread *
+bmk_cpu_sched_current(void)
+{
+       struct bmk_thread **current;
+
+       current = (void *)((unsigned long)&current & ~(bmk_stacksize-1));
+       return *current;
+};