All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Julien Grall <julien.grall@linaro.org>
Cc: sstabellini@kernel.org, andre.przywara@linaro.org,
	xen-devel@lists.xen.org
Subject: Re: [PATCH 7/7] xen/arm32: entry: Document the purpose of r11 in the traps handler
Date: Wed, 24 Jan 2018 17:08:31 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1801241708250.6440@sstabellini-ThinkPad-X260> (raw)
In-Reply-To: <20180119134103.3390-8-julien.grall@linaro.org>

On Fri, 19 Jan 2018, Julien Grall wrote:
> It took me a bit of time to understand why __DEFINE_TRAP_ENTRY is
> storing the original stack pointer in r11. It is working in pair with
> return_traps_entry where sp will be restored from r11.
> 
> This is fine because per the AAPCS r11 must be preserved by the
> subroutine. So in return_from_trap, r11 will still contain the original
> stack pointer.
> 
> Add some documentation in the code to point the 2 sides to each other.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/arm32/entry.S | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
> index c529592d20..7f323de484 100644
> --- a/xen/arch/arm/arm32/entry.S
> +++ b/xen/arch/arm/arm32/entry.S
> @@ -136,6 +136,10 @@ trap_##trap:                                                            \
>          cpsie iflags;                                                   \
>          adr lr, return_from_trap;                                       \
>          mov r0, sp;                                                     \
> +        /*                                                              \
> +         * Save the stack pointer in r11. It will be restored after the \
> +         * trap has been handled (see return_from_trap).                \
> +         */                                                             \
>          mov r11, sp;                                                    \
>          bic sp, #7; /* Align the stack pointer (noop on guest trap) */  \
>          b do_trap_##trap
> @@ -246,6 +250,10 @@ DEFINE_TRAP_ENTRY_NOIRQ(fiq)
>  DEFINE_TRAP_ENTRY_NOABORT(data_abort)
>  
>  return_from_trap:
> +        /*
> +         * Restore the stack pointer from r11. It was saved on exception
> +         * entry (see __DEFINE_TRAP_ENTRY).
> +         */
>          mov sp, r11
>  ENTRY(return_to_new_vcpu32)
>          ldr r11, [sp, #UREGS_cpsr]
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      reply	other threads:[~2018-01-25  1:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 13:40 [PATCH 0/7] xen/arm32: Branch predictor hardening (XSA-254 variant 2) Julien Grall
2018-01-19 13:40 ` [PATCH 1/7] xen/arm32: entry: Consolidate DEFINE_TRAP_ENTRY_* macros Julien Grall
2018-01-24 23:03   ` Stefano Stabellini
2018-01-19 13:40 ` [PATCH 2/7] xen/arm32: Add missing MIDR values for Cortex-A17 and A12 Julien Grall
2018-01-24 23:06   ` Stefano Stabellini
2018-01-19 13:40 ` [PATCH 3/7] xen/arm32: entry: Add missing trap_reset entry Julien Grall
2018-01-24 23:14   ` Stefano Stabellini
2018-01-25 11:24     ` Julien Grall
2018-01-19 13:41 ` [PATCH 4/7] xen/arm32: Add skeleton to harden branch predictor aliasing attacks Julien Grall
2018-01-24 23:54   ` Stefano Stabellini
2018-01-25 11:36     ` Julien Grall
2018-01-25 18:45       ` Stefano Stabellini
2018-01-25 18:50         ` Julien Grall
2018-01-25 19:37           ` Stefano Stabellini
2018-01-26 16:21             ` Julien Grall
2018-01-31 15:29               ` Julien Grall
2018-01-31 16:40                 ` Stefano Stabellini
2018-01-19 13:41 ` [PATCH 5/7] xen/arm32: Invalidate BTB on guest exit for Cortex A17 and 12 Julien Grall
2018-01-24 22:22   ` Konrad Rzeszutek Wilk
2018-01-24 22:28     ` Julien Grall
2018-01-25  1:02   ` Stefano Stabellini
2018-01-25 11:50     ` Julien Grall
2018-01-25 19:35       ` Stefano Stabellini
2018-01-31 15:31         ` Julien Grall
2018-01-31 16:40           ` Stefano Stabellini
2018-01-19 13:41 ` [PATCH 6/7] xen/arm32: Invalidate icache on guest exist for Cortex-A15 Julien Grall
2018-01-25  1:08   ` Stefano Stabellini
2018-01-19 13:41 ` [PATCH 7/7] xen/arm32: entry: Document the purpose of r11 in the traps handler Julien Grall
2018-01-25  1:08   ` Stefano Stabellini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1801241708250.6440@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=andre.przywara@linaro.org \
    --cc=julien.grall@linaro.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.