[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 05/38] arm: restore stack on return from trap.



On Fri, 1 Jun 2012, Ian Campbell wrote:
> We align the stack before calling into C code but we weren't undoing this on
> return.
> 
> Collapse continue_(non)idle_domain into continue_new_vcpu.
> 
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>


Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

>  xen/arch/arm/domain.c |   16 +++-------------
>  xen/arch/arm/entry.S  |    5 ++++-
>  2 files changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 4b38790..9339a11 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -16,17 +16,6 @@
>  
>  DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
>  
> -static void continue_idle_domain(struct vcpu *v)
> -{
> -    reset_stack_and_jump(idle_loop);
> -}
> -
> -static void continue_nonidle_domain(struct vcpu *v)
> -{
> -    /* check_wakeup_from_wait(); */
> -    reset_stack_and_jump(return_from_trap);
> -}
> -
>  void idle_loop(void)
>  {
>      for ( ; ; )
> @@ -72,9 +61,10 @@ static void continue_new_vcpu(struct vcpu *prev)
>      schedule_tail(prev);
>  
>      if ( is_idle_vcpu(current) )
> -        continue_idle_domain(current);
> +        reset_stack_and_jump(idle_loop);
>      else
> -        continue_nonidle_domain(current);
> +        /* check_wakeup_from_wait(); */
> +        reset_stack_and_jump(return_to_new_vcpu);
>  }
>  
>  void context_switch(struct vcpu *prev, struct vcpu *next)
> diff --git a/xen/arch/arm/entry.S b/xen/arch/arm/entry.S
> index f261a9f..7a22e2d 100644
> --- a/xen/arch/arm/entry.S
> +++ b/xen/arch/arm/entry.S
> @@ -72,7 +72,9 @@ DEFINE_TRAP_ENTRY(hypervisor)
>  DEFINE_TRAP_ENTRY(irq)
>  DEFINE_TRAP_ENTRY(fiq)
>  
> -ENTRY(return_from_trap)
> +return_from_trap:
> +     mov sp, r11
> +ENTRY(return_to_new_vcpu)
>       ldr r11, [sp, #UREGS_cpsr]
>       and r11, #PSR_MODE_MASK
>       cmp r11, #PSR_MODE_HYP
> @@ -82,6 +84,7 @@ ENTRY(return_to_guest)
>       mov r11, sp
>       bic sp, #7 /* Align the stack pointer */
>       bl leave_hypervisor_tail
> +     mov sp, r11
>       RESTORE_ONE_BANKED(SP_usr)
>       /* LR_usr is the same physical register as lr and is restored below */
>       RESTORE_BANKED(svc)
> -- 
> 1.7.9.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.