arch: aarch64: Use SP_EL0 instead of SP_ELx

ARM64 is currently using SP_ELx as stack pointer for kernel and threads
because everything is running in EL1. If support for EL0 is required, it
is necessary to switch to use SP_EL0 instead, that is the only stack
pointer that can be accessed at all exception levels by threads.

While it is not required to keep using SP_EL0 also during the
exceptions, the current code implementation makes it easier to use the
same stack pointer as the one used by threads also during the
exceptions.

This patch moves the code from using SP_ELx to SP_EL0 and fill in the
missing entries in the vector table.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2020-11-06 12:21:52 +01:00 committed by Anas Nashif
commit 7e36bd31fe
5 changed files with 20 additions and 6 deletions

View file

@ -20,6 +20,8 @@
#define DAIF_DBG BIT(9)
#define DAIF_MASK (0xf << 6)
#define SPSR_MODE_EL0T (0x0)
#define SPSR_MODE_EL1T (0x4)
#define SPSR_MODE_EL1H (0x5)
#define SCTLR_EL3_RES1 (BIT(29) | BIT(28) | BIT(23) | \