Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3022 | Rev 4055 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #ifndef KERN_ppc32_EXCEPTION_H_ |
35 | #ifndef KERN_ppc32_EXCEPTION_H_ |
36 | #define KERN_ppc32_EXCEPTION_H_ |
36 | #define KERN_ppc32_EXCEPTION_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
- | 39 | #include <arch/regutils.h> |
|
39 | 40 | ||
40 | typedef struct { |
41 | typedef struct { |
41 | uint32_t r0; |
42 | uint32_t r0; |
42 | uint32_t r2; |
43 | uint32_t r2; |
43 | uint32_t r3; |
44 | uint32_t r3; |
Line 72... | Line 73... | ||
72 | uint32_t pc; |
73 | uint32_t pc; |
73 | uint32_t srr1; |
74 | uint32_t srr1; |
74 | uint32_t lr; |
75 | uint32_t lr; |
75 | uint32_t ctr; |
76 | uint32_t ctr; |
76 | uint32_t xer; |
77 | uint32_t xer; |
- | 78 | uint32_t dar; |
|
77 | uint32_t r12; |
79 | uint32_t r12; |
78 | uint32_t sp; |
80 | uint32_t sp; |
79 | } istate_t; |
81 | } istate_t; |
80 | 82 | ||
81 | static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr) |
83 | static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr) |
82 | { |
84 | { |
83 | istate->pc = retaddr; |
85 | istate->pc = retaddr; |
84 | } |
86 | } |
- | 87 | ||
85 | /** Return true if exception happened while in userspace */ |
88 | /** Return true if exception happened while in userspace */ |
86 | #include <panic.h> |
- | |
87 | static inline int istate_from_uspace(istate_t *istate) |
89 | static inline int istate_from_uspace(istate_t *istate) |
88 | { |
90 | { |
89 | panic("istate_from_uspace not yet implemented"); |
91 | /* true if privilege level PR (copied from MSR) == 1 */ |
90 | return 0; |
92 | return (istate->srr1 & MSR_PR) != 0; |
91 | } |
93 | } |
- | 94 | ||
92 | static inline unative_t istate_get_pc(istate_t *istate) |
95 | static inline unative_t istate_get_pc(istate_t *istate) |
93 | { |
96 | { |
94 | return istate->pc; |
97 | return istate->pc; |
95 | } |
98 | } |
96 | 99 |