diff options
| author | Marc Zyngier <Marc.Zyngier@arm.com> | 2013-04-08 12:17:03 -0400 |
|---|---|---|
| committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-04-17 10:58:25 -0400 |
| commit | 5c1ce6f7c2aae5329f667fb079b3198266d9a3fa (patch) | |
| tree | 5e8b0db09bf756512d42a0c2e7d7fa8918248921 | |
| parent | d4784be3b20ed0dd19bbde3b2d58df023ae1dc86 (diff) | |
arm64: add explicit symbols to ESR_EL1 decoding
The ESR_EL1 decoding process is a bit cryptic, and KVM has also
a need for the same constants.
Add a new esr.h file containing the appropriate exception classes
constants, and change entry.S to use it. Fix a small bug in the
EL1 breakpoint check while we're at it.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| -rw-r--r-- | arch/arm64/include/asm/esr.h | 55 | ||||
| -rw-r--r-- | arch/arm64/kernel/entry.S | 53 |
2 files changed, 82 insertions, 26 deletions
diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h new file mode 100644 index 000000000000..78834123a32e --- /dev/null +++ b/arch/arm64/include/asm/esr.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013 - ARM Ltd | ||
| 3 | * Author: Marc Zyngier <marc.zyngier@arm.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef __ASM_ESR_H | ||
| 19 | #define __ASM_ESR_H | ||
| 20 | |||
| 21 | #define ESR_EL1_EC_SHIFT (26) | ||
| 22 | #define ESR_EL1_IL (1U << 25) | ||
| 23 | |||
| 24 | #define ESR_EL1_EC_UNKNOWN (0x00) | ||
| 25 | #define ESR_EL1_EC_WFI (0x01) | ||
| 26 | #define ESR_EL1_EC_CP15_32 (0x03) | ||
| 27 | #define ESR_EL1_EC_CP15_64 (0x04) | ||
| 28 | #define ESR_EL1_EC_CP14_MR (0x05) | ||
| 29 | #define ESR_EL1_EC_CP14_LS (0x06) | ||
| 30 | #define ESR_EL1_EC_FP_ASIMD (0x07) | ||
| 31 | #define ESR_EL1_EC_CP10_ID (0x08) | ||
| 32 | #define ESR_EL1_EC_CP14_64 (0x0C) | ||
| 33 | #define ESR_EL1_EC_ILL_ISS (0x0E) | ||
| 34 | #define ESR_EL1_EC_SVC32 (0x11) | ||
| 35 | #define ESR_EL1_EC_SVC64 (0x15) | ||
| 36 | #define ESR_EL1_EC_SYS64 (0x18) | ||
| 37 | #define ESR_EL1_EC_IABT_EL0 (0x20) | ||
| 38 | #define ESR_EL1_EC_IABT_EL1 (0x21) | ||
| 39 | #define ESR_EL1_EC_PC_ALIGN (0x22) | ||
| 40 | #define ESR_EL1_EC_DABT_EL0 (0x24) | ||
| 41 | #define ESR_EL1_EC_DABT_EL1 (0x25) | ||
| 42 | #define ESR_EL1_EC_SP_ALIGN (0x26) | ||
| 43 | #define ESR_EL1_EC_FP_EXC32 (0x28) | ||
| 44 | #define ESR_EL1_EC_FP_EXC64 (0x2C) | ||
| 45 | #define ESR_EL1_EC_SERRROR (0x2F) | ||
| 46 | #define ESR_EL1_EC_BREAKPT_EL0 (0x30) | ||
| 47 | #define ESR_EL1_EC_BREAKPT_EL1 (0x31) | ||
| 48 | #define ESR_EL1_EC_SOFTSTP_EL0 (0x32) | ||
| 49 | #define ESR_EL1_EC_SOFTSTP_EL1 (0x33) | ||
| 50 | #define ESR_EL1_EC_WATCHPT_EL0 (0x34) | ||
| 51 | #define ESR_EL1_EC_WATCHPT_EL1 (0x35) | ||
| 52 | #define ESR_EL1_EC_BKPT32 (0x38) | ||
| 53 | #define ESR_EL1_EC_BRK64 (0x3C) | ||
| 54 | |||
| 55 | #endif /* __ASM_ESR_H */ | ||
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 514d6098dbee..c7e047049f2c 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <asm/assembler.h> | 24 | #include <asm/assembler.h> |
| 25 | #include <asm/asm-offsets.h> | 25 | #include <asm/asm-offsets.h> |
| 26 | #include <asm/errno.h> | 26 | #include <asm/errno.h> |
| 27 | #include <asm/esr.h> | ||
| 27 | #include <asm/thread_info.h> | 28 | #include <asm/thread_info.h> |
| 28 | #include <asm/unistd.h> | 29 | #include <asm/unistd.h> |
| 29 | #include <asm/unistd32.h> | 30 | #include <asm/unistd32.h> |
| @@ -239,18 +240,18 @@ ENDPROC(el1_error_invalid) | |||
| 239 | el1_sync: | 240 | el1_sync: |
| 240 | kernel_entry 1 | 241 | kernel_entry 1 |
| 241 | mrs x1, esr_el1 // read the syndrome register | 242 | mrs x1, esr_el1 // read the syndrome register |
| 242 | lsr x24, x1, #26 // exception class | 243 | lsr x24, x1, #ESR_EL1_EC_SHIFT // exception class |
| 243 | cmp x24, #0x25 // data abort in EL1 | 244 | cmp x24, #ESR_EL1_EC_DABT_EL1 // data abort in EL1 |
| 244 | b.eq el1_da | 245 | b.eq el1_da |
| 245 | cmp x24, #0x18 // configurable trap | 246 | cmp x24, #ESR_EL1_EC_SYS64 // configurable trap |
| 246 | b.eq el1_undef | 247 | b.eq el1_undef |
| 247 | cmp x24, #0x26 // stack alignment exception | 248 | cmp x24, #ESR_EL1_EC_SP_ALIGN // stack alignment exception |
| 248 | b.eq el1_sp_pc | 249 | b.eq el1_sp_pc |
| 249 | cmp x24, #0x22 // pc alignment exception | 250 | cmp x24, #ESR_EL1_EC_PC_ALIGN // pc alignment exception |
| 250 | b.eq el1_sp_pc | 251 | b.eq el1_sp_pc |
| 251 | cmp x24, #0x00 // unknown exception in EL1 | 252 | cmp x24, #ESR_EL1_EC_UNKNOWN // unknown exception in EL1 |
| 252 | b.eq el1_undef | 253 | b.eq el1_undef |
| 253 | cmp x24, #0x30 // debug exception in EL1 | 254 | cmp x24, #ESR_EL1_EC_BREAKPT_EL1 // debug exception in EL1 |
| 254 | b.ge el1_dbg | 255 | b.ge el1_dbg |
| 255 | b el1_inv | 256 | b el1_inv |
| 256 | el1_da: | 257 | el1_da: |
| @@ -346,27 +347,27 @@ el1_preempt: | |||
| 346 | el0_sync: | 347 | el0_sync: |
| 347 | kernel_entry 0 | 348 | kernel_entry 0 |
| 348 | mrs x25, esr_el1 // read the syndrome register | 349 | mrs x25, esr_el1 // read the syndrome register |
| 349 | lsr x24, x25, #26 // exception class | 350 | lsr x24, x25, #ESR_EL1_EC_SHIFT // exception class |
| 350 | cmp x24, #0x15 // SVC in 64-bit state | 351 | cmp x24, #ESR_EL1_EC_SVC64 // SVC in 64-bit state |
| 351 | b.eq el0_svc | 352 | b.eq el0_svc |
| 352 | adr lr, ret_from_exception | 353 | adr lr, ret_from_exception |
| 353 | cmp x24, #0x24 // data abort in EL0 | 354 | cmp x24, #ESR_EL1_EC_DABT_EL0 // data abort in EL0 |
| 354 | b.eq el0_da | 355 | b.eq el0_da |
| 355 | cmp x24, #0x20 // instruction abort in EL0 | 356 | cmp x24, #ESR_EL1_EC_IABT_EL0 // instruction abort in EL0 |
| 356 | b.eq el0_ia | 357 | b.eq el0_ia |
| 357 | cmp x24, #0x07 // FP/ASIMD access | 358 | cmp x24, #ESR_EL1_EC_FP_ASIMD // FP/ASIMD access |
| 358 | b.eq el0_fpsimd_acc | 359 | b.eq el0_fpsimd_acc |
| 359 | cmp x24, #0x2c // FP/ASIMD exception | 360 | cmp x24, #ESR_EL1_EC_FP_EXC64 // FP/ASIMD exception |
| 360 | b.eq el0_fpsimd_exc | 361 | b.eq el0_fpsimd_exc |
| 361 | cmp x24, #0x18 // configurable trap | 362 | cmp x24, #ESR_EL1_EC_SYS64 // configurable trap |
| 362 | b.eq el0_undef | 363 | b.eq el0_undef |
| 363 | cmp x24, #0x26 // stack alignment exception | 364 | cmp x24, #ESR_EL1_EC_SP_ALIGN // stack alignment exception |
| 364 | b.eq el0_sp_pc | 365 | b.eq el0_sp_pc |
| 365 | cmp x24, #0x22 // pc alignment exception | 366 | cmp x24, #ESR_EL1_EC_PC_ALIGN // pc alignment exception |
| 366 | b.eq el0_sp_pc | 367 | b.eq el0_sp_pc |
| 367 | cmp x24, #0x00 // unknown exception in EL0 | 368 | cmp x24, #ESR_EL1_EC_UNKNOWN // unknown exception in EL0 |
| 368 | b.eq el0_undef | 369 | b.eq el0_undef |
| 369 | cmp x24, #0x30 // debug exception in EL0 | 370 | cmp x24, #ESR_EL1_EC_BREAKPT_EL0 // debug exception in EL0 |
| 370 | b.ge el0_dbg | 371 | b.ge el0_dbg |
| 371 | b el0_inv | 372 | b el0_inv |
| 372 | 373 | ||
| @@ -375,21 +376,21 @@ el0_sync: | |||
| 375 | el0_sync_compat: | 376 | el0_sync_compat: |
| 376 | kernel_entry 0, 32 | 377 | kernel_entry 0, 32 |
| 377 | mrs x25, esr_el1 // read the syndrome register | 378 | mrs x25, esr_el1 // read the syndrome register |
| 378 | lsr x24, x25, #26 // exception class | 379 | lsr x24, x25, #ESR_EL1_EC_SHIFT // exception class |
| 379 | cmp x24, #0x11 // SVC in 32-bit state | 380 | cmp x24, #ESR_EL1_EC_SVC32 // SVC in 32-bit state |
| 380 | b.eq el0_svc_compat | 381 | b.eq el0_svc_compat |
| 381 | adr lr, ret_from_exception | 382 | adr lr, ret_from_exception |
| 382 | cmp x24, #0x24 // data abort in EL0 | 383 | cmp x24, #ESR_EL1_EC_DABT_EL0 // data abort in EL0 |
| 383 | b.eq el0_da | 384 | b.eq el0_da |
| 384 | cmp x24, #0x20 // instruction abort in EL0 | 385 | cmp x24, #ESR_EL1_EC_IABT_EL0 // instruction abort in EL0 |
| 385 | b.eq el0_ia | 386 | b.eq el0_ia |
| 386 | cmp x24, #0x07 // FP/ASIMD access | 387 | cmp x24, #ESR_EL1_EC_FP_ASIMD // FP/ASIMD access |
| 387 | b.eq el0_fpsimd_acc | 388 | b.eq el0_fpsimd_acc |
| 388 | cmp x24, #0x28 // FP/ASIMD exception | 389 | cmp x24, #ESR_EL1_EC_FP_EXC32 // FP/ASIMD exception |
| 389 | b.eq el0_fpsimd_exc | 390 | b.eq el0_fpsimd_exc |
| 390 | cmp x24, #0x00 // unknown exception in EL0 | 391 | cmp x24, #ESR_EL1_EC_UNKNOWN // unknown exception in EL0 |
| 391 | b.eq el0_undef | 392 | b.eq el0_undef |
| 392 | cmp x24, #0x30 // debug exception in EL0 | 393 | cmp x24, #ESR_EL1_EC_BREAKPT_EL0 // debug exception in EL0 |
| 393 | b.ge el0_dbg | 394 | b.ge el0_dbg |
| 394 | b el0_inv | 395 | b el0_inv |
| 395 | el0_svc_compat: | 396 | el0_svc_compat: |
