From: Antti Kantee Date: Tue, 21 Apr 2015 11:35:34 +0000 (+0000) Subject: Common name for thread switch routine: bmk_platform_cpu_sched_switch(). X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ba97d55ded7f2590f2c138ae6e11ae505be8bec4;p=people%2Fliuw%2Frumprun.git Common name for thread switch routine: bmk_platform_cpu_sched_switch(). Not sure if it can be unified, since it needs to handle the TLS context switch, which is apparently slightly different in a virtualized env and on bare metal, so keep the implementations separate for now. --- diff --git a/include/bmk-core/sched.h b/include/bmk-core/sched.h index d406e30..948719e 100644 --- a/include/bmk-core/sched.h +++ b/include/bmk-core/sched.h @@ -64,7 +64,6 @@ void bmk_sched_settls(struct bmk_thread *, unsigned int, void *); void bmk_cpu_sched_create(struct bmk_thread *, struct bmk_tcb *, void (*)(void *), void *, void *, unsigned long); -void bmk_cpu_sched_switch(struct bmk_tcb *, struct bmk_tcb *); void bmk_sched_set_hook(void (*)(void *, void *)); struct bmk_thread *bmk_sched_init_mainlwp(void *); @@ -79,7 +78,8 @@ bmk_time_t bmk_clock_epochoffset(void); /* XXX: coming up with better names considered useful */ void bmk_cpu_sched_bouncer(void); -void bmk_cpu_switch(struct bmk_tcb *, struct bmk_tcb *); void bmk__cpu_switch(void *, void *); +void bmk_platform_cpu_sched_switch(struct bmk_tcb *, struct bmk_tcb *); + #endif /* _BMK_CORE_SCHED_H_ */ diff --git a/platform/baremetal/arch/i386/machdep.c b/platform/baremetal/arch/i386/machdep.c index 90c6cd6..c25e3ba 100644 --- a/platform/baremetal/arch/i386/machdep.c +++ b/platform/baremetal/arch/i386/machdep.c @@ -258,7 +258,7 @@ bmk_cpu_nanohlt(void) } void -bmk_cpu_sched_switch(struct bmk_tcb *prev, struct bmk_tcb *next) +bmk_platform_cpu_sched_switch(struct bmk_tcb *prev, struct bmk_tcb *next) { adjustgs(next->btcb_tp, next->btcb_tpsize); diff --git a/platform/baremetal/sched.c b/platform/baremetal/sched.c index c9466c6..22105b4 100644 --- a/platform/baremetal/sched.c +++ b/platform/baremetal/sched.c @@ -158,7 +158,7 @@ sched_switch(struct bmk_thread *prev, struct bmk_thread *next) if (scheduler_hook) scheduler_hook(prev->bt_cookie, next->bt_cookie); - bmk_cpu_sched_switch(&prev->bt_tcb, &next->bt_tcb); + bmk_platform_cpu_sched_switch(&prev->bt_tcb, &next->bt_tcb); } struct bmk_thread * diff --git a/platform/xen/xen/arch/x86/sched.c b/platform/xen/xen/arch/x86/sched.c index 739c41d..15bab54 100644 --- a/platform/xen/xen/arch/x86/sched.c +++ b/platform/xen/xen/arch/x86/sched.c @@ -79,7 +79,7 @@ void dump_stack(struct thread *thread_md) extern void _minios_entry_thread_starter(void); void -bmk_cpu_switch(struct bmk_tcb *prev, struct bmk_tcb *next) +bmk_platform_cpu_sched_switch(struct bmk_tcb *prev, struct bmk_tcb *next) { /* XXX: TLS is available only on x86_64 currently */ diff --git a/platform/xen/xen/sched.c b/platform/xen/xen/sched.c index 5aa83b0..174d3a1 100644 --- a/platform/xen/xen/sched.c +++ b/platform/xen/xen/sched.c @@ -162,7 +162,7 @@ sched_switch(struct bmk_thread *prev, struct bmk_thread *next) if (scheduler_hook) scheduler_hook(prev->bt_cookie, next->bt_cookie); - bmk_cpu_switch(&prev->bt_tcb, &next->bt_tcb); + bmk_platform_cpu_sched_switch(&prev->bt_tcb, &next->bt_tcb); } struct bmk_thread *