All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 10/16] arm64: Allow exceptions to return
Date: Tue,  2 Feb 2016 03:45:08 +0100	[thread overview]
Message-ID: <1454381114-22547-11-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1454381114-22547-1-git-send-email-agraf@suse.de>

Our current arm64 exception handlers all panic and never return to the
exception triggering code.

But if any handler wanted to continue execution after fixups, it would
need help from the exception handling code to restore all registers.

This patch implements that help. With this code, exception handlers on
aarch64 can successfully return to the place the exception happened (or
somewhere else if they modify elr).

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/cpu/armv8/exceptions.S | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/cpu/armv8/exceptions.S b/arch/arm/cpu/armv8/exceptions.S
index baf9401..4f4f526 100644
--- a/arch/arm/cpu/armv8/exceptions.S
+++ b/arch/arm/cpu/armv8/exceptions.S
@@ -82,31 +82,65 @@ vectors:
 _do_bad_sync:
 	exception_entry
 	bl	do_bad_sync
+	b	exception_exit
 
 _do_bad_irq:
 	exception_entry
 	bl	do_bad_irq
+	b	exception_exit
 
 _do_bad_fiq:
 	exception_entry
 	bl	do_bad_fiq
+	b	exception_exit
 
 _do_bad_error:
 	exception_entry
 	bl	do_bad_error
+	b	exception_exit
 
 _do_sync:
 	exception_entry
 	bl	do_sync
+	b	exception_exit
 
 _do_irq:
 	exception_entry
 	bl	do_irq
+	b	exception_exit
 
 _do_fiq:
 	exception_entry
 	bl	do_fiq
+	b	exception_exit
 
 _do_error:
 	exception_entry
 	bl	do_error
+	b	exception_exit
+
+exception_exit:
+	ldp	x2, x0, [sp],#16
+	switch_el x11, 3f, 2f, 1f
+3:	msr	elr_el3, x2
+	b	0f
+2:	msr	elr_el2, x2
+	b	0f
+1:	msr	elr_el1, x2
+0:
+	ldp	x1, x2, [sp],#16
+	ldp	x3, x4, [sp],#16
+	ldp	x5, x6, [sp],#16
+	ldp	x7, x8, [sp],#16
+	ldp	x9, x10, [sp],#16
+	ldp	x11, x12, [sp],#16
+	ldp	x13, x14, [sp],#16
+	ldp	x15, x16, [sp],#16
+	ldp	x17, x18, [sp],#16
+	ldp	x19, x20, [sp],#16
+	ldp	x21, x22, [sp],#16
+	ldp	x23, x24, [sp],#16
+	ldp	x25, x26, [sp],#16
+	ldp	x27, x28, [sp],#16
+	ldp	x29, x30, [sp],#16
+	eret
-- 
2.6.2

  parent reply	other threads:[~2016-02-02  2:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  2:44 [U-Boot] [PATCH 00/16] EFI payload / application support v3 Alexander Graf
2016-02-02  2:44 ` [U-Boot] [PATCH 01/16] disk/part.c: Expose list of available block drivers Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 02/16] include/efi_api.h: Add more detailed API definitions Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 03/16] efi_loader: Add PE image loader Alexander Graf
2016-02-02 12:54   ` Leif Lindholm
2016-02-02 17:49   ` Mark Rutland
2016-02-26  1:25     ` Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 04/16] efi_loader: Add boot time services Alexander Graf
2016-02-02 14:47   ` Leif Lindholm
2016-02-26  1:00     ` Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 05/16] efi_loader: Add console interface Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 06/16] efi_loader: Add runtime services Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 07/16] efi_loader: Add disk interfaces Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 08/16] efi_loader: Add "bootefi" command Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 09/16] efi_loader: Implement memory allocation and map Alexander Graf
2016-02-02 17:35   ` Leif Lindholm
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` Alexander Graf [this message]
2016-02-02  2:45 ` [U-Boot] [PATCH 11/16] arm64: Allow EFI payload code to take exceptions Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 12/16] efi_loader: Add DCACHE_OFF support for arm64 Alexander Graf
2016-02-02 15:55   ` Mark Rutland
2016-02-02 16:28     ` Tom Rini
2016-02-02 16:58       ` Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 13/16] efi_loader: hook up in build environment Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 14/16] efi_loader: Add distro boot script for removable media Alexander Graf
2016-02-02 17:52   ` Leif Lindholm
2016-02-26  1:29     ` Alexander Graf
2016-02-03 10:36   ` Leif Lindholm
2016-02-03 15:53     ` Alexander Graf
2016-02-04  4:11       ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 15/16] efi_loader: Add README section in README.efi Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 16/16] efi_loader: Add MAINTAINERS entry Alexander Graf
2016-02-03  3:31   ` Simon Glass

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=1454381114-22547-11-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /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.