Rev 1769 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1769 | Rev 1780 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | #define EXC_FPE 15 |
60 | #define EXC_FPE 15 |
61 | #define EXC_WATCH 23 |
61 | #define EXC_WATCH 23 |
62 | #define EXC_VCED 31 |
62 | #define EXC_VCED 31 |
63 | 63 | ||
64 | struct istate { |
64 | struct istate { |
65 | __u32 at; |
65 | uint32_t at; |
66 | __u32 v0; |
66 | uint32_t v0; |
67 | __u32 v1; |
67 | uint32_t v1; |
68 | __u32 a0; |
68 | uint32_t a0; |
69 | __u32 a1; |
69 | uint32_t a1; |
70 | __u32 a2; |
70 | uint32_t a2; |
71 | __u32 a3; |
71 | uint32_t a3; |
72 | __u32 t0; |
72 | uint32_t t0; |
73 | __u32 t1; |
73 | uint32_t t1; |
74 | __u32 t2; |
74 | uint32_t t2; |
75 | __u32 t3; |
75 | uint32_t t3; |
76 | __u32 t4; |
76 | uint32_t t4; |
77 | __u32 t5; |
77 | uint32_t t5; |
78 | __u32 t6; |
78 | uint32_t t6; |
79 | __u32 t7; |
79 | uint32_t t7; |
80 | __u32 s0; |
80 | uint32_t s0; |
81 | __u32 s1; |
81 | uint32_t s1; |
82 | __u32 s2; |
82 | uint32_t s2; |
83 | __u32 s3; |
83 | uint32_t s3; |
84 | __u32 s4; |
84 | uint32_t s4; |
85 | __u32 s5; |
85 | uint32_t s5; |
86 | __u32 s6; |
86 | uint32_t s6; |
87 | __u32 s7; |
87 | uint32_t s7; |
88 | __u32 t8; |
88 | uint32_t t8; |
89 | __u32 t9; |
89 | uint32_t t9; |
90 | __u32 gp; |
90 | uint32_t gp; |
91 | __u32 sp; |
91 | uint32_t sp; |
92 | __u32 s8; |
92 | uint32_t s8; |
93 | __u32 ra; |
93 | uint32_t ra; |
94 | 94 | ||
95 | __u32 lo; |
95 | uint32_t lo; |
96 | __u32 hi; |
96 | uint32_t hi; |
97 | 97 | ||
98 | __u32 status; /* cp0_status */ |
98 | uint32_t status; /* cp0_status */ |
99 | __u32 epc; /* cp0_epc */ |
99 | uint32_t epc; /* cp0_epc */ |
100 | __u32 k1; /* We use it as thread-local pointer */ |
100 | uint32_t k1; /* We use it as thread-local pointer */ |
101 | }; |
101 | }; |
102 | 102 | ||
103 | static inline void istate_set_retaddr(istate_t *istate, __address retaddr) |
103 | static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr) |
104 | { |
104 | { |
105 | istate->epc = retaddr; |
105 | istate->epc = retaddr; |
106 | } |
106 | } |
107 | 107 | ||
108 | /** Return true if exception happened while in userspace */ |
108 | /** Return true if exception happened while in userspace */ |
109 | static inline int istate_from_uspace(istate_t *istate) |
109 | static inline int istate_from_uspace(istate_t *istate) |
110 | { |
110 | { |
111 | return istate->status & cp0_status_um_bit; |
111 | return istate->status & cp0_status_um_bit; |
112 | } |
112 | } |
113 | static inline __native istate_get_pc(istate_t *istate) |
113 | static inline unative_t istate_get_pc(istate_t *istate) |
114 | { |
114 | { |
115 | return istate->epc; |
115 | return istate->epc; |
116 | } |
116 | } |
117 | 117 | ||
118 | extern void exception(istate_t *istate); |
118 | extern void exception(istate_t *istate); |