ia64/xen-unstable

changeset 4034:b27fb6c2ea52

bitkeeper revision 1.1236.12.16 (422ebb7aYVp_Td4UP5dSmJUG7oOtyA)

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>
author kaf24@firebug.cl.cam.ac.uk
date Wed Mar 09 09:01:46 2005 +0000 (2005-03-09)
parents 77fbd1da5611
children 9d3594cbf610
files xen/arch/x86/domain.c xen/common/schedule.c xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Wed Mar 09 02:07:37 2005 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Wed Mar 09 09:01:46 2005 +0000
     1.3 @@ -714,7 +714,7 @@ long do_switch_to_user(void)
     1.4  			: /* no output */ \
     1.5  			:"r" ((_ed)->debugreg[_reg]))
     1.6  
     1.7 -void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p)
     1.8 +void context_switch(struct exec_domain *prev_p, struct exec_domain *next_p)
     1.9  {
    1.10      struct tss_struct *tss = init_tss + smp_processor_id();
    1.11      execution_context_t *stack_ec = get_execution_context();
    1.12 @@ -805,6 +805,18 @@ void switch_to(struct exec_domain *prev_
    1.13      __sti();
    1.14  
    1.15      switch_segments(stack_ec, prev_p, next_p);
    1.16 +
    1.17 +    /*
    1.18 +     * We do this late on because it doesn't need to be protected by the
    1.19 +     * schedule_lock, and because we want this to be the very last use of
    1.20 +     * 'prev' (after this point, a dying domain's info structure may be freed
    1.21 +     * without warning). 
    1.22 +     */
    1.23 +    clear_bit(EDF_RUNNING, &prev_p->ed_flags);
    1.24 +
    1.25 +    schedule_tail(next_p);
    1.26 +
    1.27 +    BUG();
    1.28  }
    1.29  
    1.30  
    1.31 @@ -968,16 +980,15 @@ void domain_relinquish_memory(struct dom
    1.32      {
    1.33          if ( pagetable_val(ed->arch.guest_table) != 0 )
    1.34          {
    1.35 -            put_page_and_type(
    1.36 -                &frame_table[pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]);
    1.37 +            put_page_and_type(&frame_table[
    1.38 +                pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]);
    1.39              ed->arch.guest_table = mk_pagetable(0);
    1.40          }
    1.41  
    1.42          if ( pagetable_val(ed->arch.guest_table_user) != 0 )
    1.43          {
    1.44 -            put_page_and_type(
    1.45 -                &frame_table[pagetable_val(ed->arch.guest_table_user) >>
    1.46 -                            PAGE_SHIFT]);
    1.47 +            put_page_and_type(&frame_table[
    1.48 +                pagetable_val(ed->arch.guest_table_user) >> PAGE_SHIFT]);
    1.49              ed->arch.guest_table_user = mk_pagetable(0);
    1.50          }
    1.51      }
     2.1 --- a/xen/common/schedule.c	Wed Mar 09 02:07:37 2005 +0000
     2.2 +++ b/xen/common/schedule.c	Wed Mar 09 09:01:46 2005 +0000
     2.3 @@ -446,23 +446,11 @@ void __enter_scheduler(void)
     2.4  
     2.5      TRACE_2D(TRC_SCHED_SWITCH, next->domain->id, next);
     2.6  
     2.7 -    switch_to(prev, next);
     2.8 -
     2.9 -    /*
    2.10 -     * We do this late on because it doesn't need to be protected by the
    2.11 -     * schedule_lock, and because we want this to be the very last use of
    2.12 -     * 'prev' (after this point, a dying domain's info structure may be freed
    2.13 -     * without warning). 
    2.14 -     */
    2.15 -    clear_bit(EDF_RUNNING, &prev->ed_flags);
    2.16 -
    2.17      /* Ensure that the domain has an up-to-date time base. */
    2.18      if ( !is_idle_task(next->domain) && update_dom_time(next) )
    2.19          send_guest_virq(next, VIRQ_TIMER);
    2.20  
    2.21 -    schedule_tail(next);
    2.22 -
    2.23 -    BUG();
    2.24 +    context_switch(prev, next);
    2.25  }
    2.26  
    2.27  /* No locking needed -- pointer comparison is safe :-) */
     3.1 --- a/xen/include/xen/sched.h	Wed Mar 09 02:07:37 2005 +0000
     3.2 +++ b/xen/include/xen/sched.h	Wed Mar 09 09:01:46 2005 +0000
     3.3 @@ -251,8 +251,9 @@ void domain_sleep(struct exec_domain *d)
     3.4  
     3.5  void __enter_scheduler(void);
     3.6  
     3.7 -extern void switch_to(struct exec_domain *prev, 
     3.8 -                      struct exec_domain *next);
     3.9 +extern void context_switch(
    3.10 +    struct exec_domain *prev, 
    3.11 +    struct exec_domain *next);
    3.12  
    3.13  void domain_init(void);
    3.14