Generalize some Exception Syndrome Register (ESR) definitions by renaming EL1-specific macros to ELx equivalents. This allows these constants to be shared between EL1 and EL2, supporting the upcoming S2MMU library implementation. Signed-off-by: Jing Zhang --- lib/arm64/asm/esr.h | 5 +++-- lib/arm64/processor.c | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/arm64/asm/esr.h b/lib/arm64/asm/esr.h index 335343c5..8437916f 100644 --- a/lib/arm64/asm/esr.h +++ b/lib/arm64/asm/esr.h @@ -12,7 +12,7 @@ #define ESR_EL1_CM (1 << 8) #define ESR_EL1_IL (1 << 25) -#define ESR_EL1_EC_SHIFT (26) +#define ESR_ELx_EC_SHIFT (26) #define ESR_EL1_EC_UNKNOWN (0x00) #define ESR_EL1_EC_WFI (0x01) #define ESR_EL1_EC_CP15_32 (0x03) @@ -25,12 +25,13 @@ #define ESR_EL1_EC_ILL_ISS (0x0E) #define ESR_EL1_EC_SVC32 (0x11) #define ESR_EL1_EC_SVC64 (0x15) +#define ESR_ELx_EC_HVC64 (0x16) #define ESR_EL1_EC_SYS64 (0x18) #define ESR_EL1_EC_SVE (0x19) #define ESR_EL1_EC_IABT_EL0 (0x20) #define ESR_EL1_EC_IABT_EL1 (0x21) #define ESR_EL1_EC_PC_ALIGN (0x22) -#define ESR_EL1_EC_DABT_EL0 (0x24) +#define ESR_ELx_EC_DABT_LOW (0x24) #define ESR_EL1_EC_DABT_EL1 (0x25) #define ESR_EL1_EC_SP_ALIGN (0x26) #define ESR_EL1_EC_FP_EXC32 (0x28) diff --git a/lib/arm64/processor.c b/lib/arm64/processor.c index f9fea519..bde3caa5 100644 --- a/lib/arm64/processor.c +++ b/lib/arm64/processor.c @@ -48,7 +48,7 @@ static const char *ec_names[EC_MAX] = { [ESR_EL1_EC_IABT_EL0] = "IABT_EL0", [ESR_EL1_EC_IABT_EL1] = "IABT_EL1", [ESR_EL1_EC_PC_ALIGN] = "PC_ALIGN", - [ESR_EL1_EC_DABT_EL0] = "DABT_EL0", + [ESR_ELx_EC_DABT_LOW] = "DABT_EL0", [ESR_EL1_EC_DABT_EL1] = "DABT_EL1", [ESR_EL1_EC_SP_ALIGN] = "SP_ALIGN", [ESR_EL1_EC_FP_EXC32] = "FP_EXC32", @@ -82,7 +82,7 @@ void show_regs(struct pt_regs *regs) bool get_far(unsigned int esr, unsigned long *far) { - unsigned int ec = esr >> ESR_EL1_EC_SHIFT; + unsigned int ec = esr >> ESR_ELx_EC_SHIFT; asm volatile("mrs %0, far_el1": "=r" (*far)); @@ -90,7 +90,7 @@ bool get_far(unsigned int esr, unsigned long *far) case ESR_EL1_EC_IABT_EL0: case ESR_EL1_EC_IABT_EL1: case ESR_EL1_EC_PC_ALIGN: - case ESR_EL1_EC_DABT_EL0: + case ESR_ELx_EC_DABT_LOW: case ESR_EL1_EC_DABT_EL1: case ESR_EL1_EC_WATCHPT_EL0: case ESR_EL1_EC_WATCHPT_EL1: @@ -108,7 +108,7 @@ static void bad_exception(enum vector v, struct pt_regs *regs, { unsigned long far; bool far_valid = get_far(esr, &far); - unsigned int ec = esr >> ESR_EL1_EC_SHIFT; + unsigned int ec = esr >> ESR_ELx_EC_SHIFT; uintptr_t text = (uintptr_t)&_text; printf("Load address: %" PRIxPTR "\n", text); @@ -158,7 +158,7 @@ void default_vector_sync_handler(enum vector v, struct pt_regs *regs, unsigned int esr) { struct thread_info *ti = thread_info_sp(regs->sp); - unsigned int ec = esr >> ESR_EL1_EC_SHIFT; + unsigned int ec = esr >> ESR_ELx_EC_SHIFT; if (ti->flags & TIF_USER_MODE) { if (ec < EC_MAX && ti->exception_handlers[v][ec]) { -- 2.53.0.1213.gd9a14994de-goog