aa64: finalise context switch, page fault handler and syscall
[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 #define EC_SVC              0b010101
27
28 #define EC_I_ABORT          0b100000
29 #define EC_I_ABORT_EL       0b100001
30
31 #define EC_D_ABORT          0b100100
32 #define EC_D_ABORT_EL       0b100101
33
34 #define EC_PC_ALIGN         0b100010
35 #define EC_SP_ALIGN         0b100110
36
37 #define EC_SERROR           0b101111
38
39 static inline bool
40 esr_inst32(reg_t esr)
41 {
42     return !!BITS_GET(esr, ESR_IL);
43 }
44
45 static inline unsigned int
46 esr_ec(reg_t esr)
47 {
48     return (unsigned int)BITS_GET(esr, ESR_EC);
49 }
50
51 static inline reg_t
52 esr_iss(reg_t esr)
53 {
54     return (reg_t)BITS_GET(esr, ESR_ISS);
55 }
56
57 #endif /* !__ASM__ */
58 #endif /* __LUNAIX_AA64_ESR_H */