adjust exec_param to keep track of sp_el0, fix incorrect use sys regs
[lunaix-os.git] / lunaix-os / arch / aarch64 / includes / asm / aa64_exception.h
1 #ifndef __LUNAIX_AA64_ESR_H
2 #define __LUNAIX_AA64_ESR_H
3
4 #define EXCEPTION_SYNC      0
5 #define EXCEPTION_FIQ       1
6 #define EXCEPTION_IRQ       2
7 #define EXCEPTION_SERR      3
8
9 #ifndef __ASM__
10
11 #include <lunaix/bits.h>
12 #include <lunaix/types.h>
13
14 #define ESR_ISS2            BITFIELD(55, 32)
15 #define ESR_EC              BITFIELD(31, 26)
16 #define ESR_IL              BIT(25)
17 #define ESR_ISS             BITFIELD(24,  0)
18
19 #define EC_UNKNOWN          0b000000
20 #define EC_WF               0b000001
21 #define EC_SIMD             0b000111
22 #define EC_LS64             0b001010
23 #define EC_BTI              0b001101
24 #define EC_EXEC_STATE       0b001110
25 #define EC_SYS_INST         0b011000
26
27 #define EC_I_ABORT          0b100000
28 #define EC_I_ABORT_EL       0b100001
29
30 #define EC_D_ABORT          0b100100
31 #define EC_D_ABORT_EL       0b100101
32
33 #define EC_PC_ALIGN         0b100010
34 #define EC_SP_ALIGN         0b100110
35
36 #define EC_SERROR           0b101111
37
38 static inline bool
39 esr_inst32(reg_t esr)
40 {
41     return !!BITS_GET(esr, ESR_IL);
42 }
43
44 static inline unsigned int
45 esr_ec(reg_t esr)
46 {
47     return (unsigned int)BITS_GET(esr, ESR_EC);
48 }
49
50 static inline reg_t
51 esr_iss(reg_t esr)
52 {
53     return (reg_t)BITS_GET(esr, ESR_ISS);
54 }
55
56 #endif /* !__ASM__ */
57 #endif /* __LUNAIX_AA64_ESR_H */