bitkeeper revision 1.1236.12.16 (422ebb7aYVp_Td4UP5dSmJUG7oOtyA)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 9 Mar 2005 09:01:46 +0000 (09:01 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 9 Mar 2005 09:01:46 +0000 (09:01 +0000)
New arch-specific function context_switch() subsumes switch_to() and
schedule_tail() which are now not at all visible to common code.
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
xen/arch/x86/domain.c
xen/common/schedule.c
xen/include/xen/sched.h

index e9ed5835074fd735e129bbb376493ae3412134a9..4be8043bef3c494ab5367de8fda0c29c7f5a5bde 100644 (file)
@@ -714,7 +714,7 @@ long do_switch_to_user(void)
                        : /* no output */ \
                        :"r" ((_ed)->debugreg[_reg]))
 
-void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p)
+void context_switch(struct exec_domain *prev_p, struct exec_domain *next_p)
 {
     struct tss_struct *tss = init_tss + smp_processor_id();
     execution_context_t *stack_ec = get_execution_context();
@@ -805,6 +805,18 @@ void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p)
     __sti();
 
     switch_segments(stack_ec, prev_p, next_p);
+
+    /*
+     * We do this late on because it doesn't need to be protected by the
+     * schedule_lock, and because we want this to be the very last use of
+     * 'prev' (after this point, a dying domain's info structure may be freed
+     * without warning). 
+     */
+    clear_bit(EDF_RUNNING, &prev_p->ed_flags);
+
+    schedule_tail(next_p);
+
+    BUG();
 }
 
 
@@ -968,16 +980,15 @@ void domain_relinquish_memory(struct domain *d)
     {
         if ( pagetable_val(ed->arch.guest_table) != 0 )
         {
-            put_page_and_type(
-                &frame_table[pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]);
+            put_page_and_type(&frame_table[
+                pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]);
             ed->arch.guest_table = mk_pagetable(0);
         }
 
         if ( pagetable_val(ed->arch.guest_table_user) != 0 )
         {
-            put_page_and_type(
-                &frame_table[pagetable_val(ed->arch.guest_table_user) >>
-                            PAGE_SHIFT]);
+            put_page_and_type(&frame_table[
+                pagetable_val(ed->arch.guest_table_user) >> PAGE_SHIFT]);
             ed->arch.guest_table_user = mk_pagetable(0);
         }
     }
index be85ec9a8985a016e20ddf6c80a0fde0099d8cd5..177a322d75c5763013a58e409adfbcf51a02fd15 100644 (file)
@@ -446,23 +446,11 @@ void __enter_scheduler(void)
 
     TRACE_2D(TRC_SCHED_SWITCH, next->domain->id, next);
 
-    switch_to(prev, next);
-
-    /*
-     * We do this late on because it doesn't need to be protected by the
-     * schedule_lock, and because we want this to be the very last use of
-     * 'prev' (after this point, a dying domain's info structure may be freed
-     * without warning). 
-     */
-    clear_bit(EDF_RUNNING, &prev->ed_flags);
-
     /* Ensure that the domain has an up-to-date time base. */
     if ( !is_idle_task(next->domain) && update_dom_time(next) )
         send_guest_virq(next, VIRQ_TIMER);
 
-    schedule_tail(next);
-
-    BUG();
+    context_switch(prev, next);
 }
 
 /* No locking needed -- pointer comparison is safe :-) */
index 83925b46f59337007e303d9e5fcd45b17ab145b0..68fa4e90d4591eacbb745ae6e4b8cedfaa02a6c9 100644 (file)
@@ -251,8 +251,9 @@ void domain_sleep(struct exec_domain *d);
 
 void __enter_scheduler(void);
 
-extern void switch_to(struct exec_domain *prev, 
-                      struct exec_domain *next);
+extern void context_switch(
+    struct exec_domain *prev, 
+    struct exec_domain *next);
 
 void domain_init(void);