Rev 2180 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2180 | Rev 2235 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #define EXC_PREFETCH_ABORT_VEC 0xc |
46 | #define EXC_PREFETCH_ABORT_VEC 0xc |
47 | #define EXC_DATA_ABORT_VEC 0x10 |
47 | #define EXC_DATA_ABORT_VEC 0x10 |
48 | #define EXC_IRQ_VEC 0x18 |
48 | #define EXC_IRQ_VEC 0x18 |
49 | #define EXC_FIQ_VEC 0x1c |
49 | #define EXC_FIQ_VEC 0x1c |
50 | 50 | ||
51 | typedef struct { |
51 | /* Exception numbers */ |
- | 52 | #define EXC_RESET 0 |
|
- | 53 | #define EXC_UNDEF_INSTR 1 |
|
52 | 54 | #define EXC_SWI 2 |
|
- | 55 | #define EXC_PREFETCH_ABORT 3 |
|
- | 56 | #define EXC_DATA_ABORT 4 |
|
53 | uint32_t cpsr; |
57 | #define EXC_IRQ 5 |
54 | uint32_t retaddr; |
58 | #define EXC_FIQ 6 |
- | 59 | ||
- | 60 | ||
55 | 61 | ||
- | 62 | typedef struct { |
|
56 | uint32_t r0; |
63 | uint32_t r0; |
57 | uint32_t r1; |
64 | uint32_t r1; |
58 | uint32_t r2; |
65 | uint32_t r2; |
59 | uint32_t r3; |
66 | uint32_t r3; |
60 | uint32_t r4; |
67 | uint32_t r4; |
Line 66... | Line 73... | ||
66 | uint32_t r11; |
73 | uint32_t r11; |
67 | uint32_t r12; |
74 | uint32_t r12; |
68 | uint32_t sp; |
75 | uint32_t sp; |
69 | uint32_t lr; |
76 | uint32_t lr; |
70 | 77 | ||
- | 78 | uint32_t spsr; |
|
71 | } istate_t; |
79 | } istate_t; |
72 | 80 | ||
73 | static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr) |
81 | static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr) |
74 | { |
82 | { |
75 | istate->retaddr = retaddr; |
83 | istate->lr = retaddr; |
76 | } |
84 | } |
77 | 85 | ||
78 | /** Return true if exception happened while in userspace */ |
86 | /** Return true if exception happened while in userspace */ |
79 | static inline int istate_from_uspace(istate_t *istate) |
87 | static inline int istate_from_uspace(istate_t *istate) |
80 | { |
88 | { |
81 | return !(istate->retaddr & 0x80000000); |
89 | return !(istate->lr & 0x80000000); |
- | 90 | return 0; |
|
82 | } |
91 | } |
83 | static inline unative_t istate_get_pc(istate_t *istate) |
92 | static inline unative_t istate_get_pc(istate_t *istate) |
84 | { |
93 | { |
85 | return istate->retaddr; |
94 | return istate->lr; |
86 | } |
95 | } |
87 | 96 | ||
88 | - | ||
- | 97 | extern void setup_exception_stacks(void); |
|
89 | extern void install_exception_handlers(void); |
98 | extern void install_exception_handlers(void); |
90 | extern void exception_init(void); |
99 | extern void exception_init(void); |
91 | 100 | ||
92 | #endif |
101 | #endif |
93 | 102 |