From 1323bed60a62b01b5f30c57b098bd21ee88dd527 Mon Sep 17 00:00:00 2001 From: Antti Kantee Date: Mon, 20 Apr 2015 20:39:01 +0000 Subject: [PATCH] Push cpu-specific thread creation into core. Convert -baremetal. --- lib/librumprun_core/arch/i386/Makefile.inc | 1 + .../librumprun_core}/arch/i386/cpu_sched.c | 33 ++++++++----------- platform/baremetal/arch/i386/Makefile.inc | 2 +- 3 files changed, 15 insertions(+), 21 deletions(-) rename {platform/baremetal => lib/librumprun_core}/arch/i386/cpu_sched.c (89%) diff --git a/lib/librumprun_core/arch/i386/Makefile.inc b/lib/librumprun_core/arch/i386/Makefile.inc index 7bc1713..1ed2c41 100644 --- a/lib/librumprun_core/arch/i386/Makefile.inc +++ b/lib/librumprun_core/arch/i386/Makefile.inc @@ -2,3 +2,4 @@ MYDIR:= ${.PARSEDIR} .PATH: ${MYDIR} SRCS+= cpu_sched_switch.S +SRCS+= cpu_sched.c diff --git a/platform/baremetal/arch/i386/cpu_sched.c b/lib/librumprun_core/arch/i386/cpu_sched.c similarity index 89% rename from platform/baremetal/arch/i386/cpu_sched.c rename to lib/librumprun_core/arch/i386/cpu_sched.c index 245cca3..f9c945d 100644 --- a/platform/baremetal/arch/i386/cpu_sched.c +++ b/lib/librumprun_core/arch/i386/cpu_sched.c @@ -1,6 +1,4 @@ -/* from Xen MiniOS, with following copyright */ - -/* +/* **************************************************************************** * (C) 2005 - Grzegorz Milos - Intel Research Cambridge **************************************************************************** @@ -8,13 +6,13 @@ * 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 + * The scheduler is non-preemptive (cooperative), and schedules according * to Round Robin algorithm. * **************************************************************************** @@ -24,24 +22,21 @@ * 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 + * + * 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 -#include -#include - #include +#include static void stack_push(void **stackp, unsigned long value) @@ -60,8 +55,6 @@ bmk_cpu_sched_create(struct bmk_thread *thread, struct bmk_tcb *tcb, { void *stack_top = (char *)stack_base + stack_size; - bmk_assert(stack_size == BMK_THREAD_STACKSIZE); - /* Save pointer to the thread on the stack, used by current macro */ *(unsigned long *)stack_base = (unsigned long)thread; diff --git a/platform/baremetal/arch/i386/Makefile.inc b/platform/baremetal/arch/i386/Makefile.inc index c069353..9cee7b0 100644 --- a/platform/baremetal/arch/i386/Makefile.inc +++ b/platform/baremetal/arch/i386/Makefile.inc @@ -1,4 +1,4 @@ -OBJS_BMK+= arch/i386/locore32.o arch/i386/cpu_sched.o arch/i386/machdep.o +OBJS_BMK+= arch/i386/locore32.o arch/i386/machdep.o LDSCRIPT= arch/i386/kern.ldscript CFLAGS+= -mno-sse -mno-mmx -march=i686 -- 2.39.5