Subversion Repositories HelenOS

Rev

Rev 2304 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2304 Rev 2329
Line 37... Line 37...
37
#define KERN_arm32_EXCEPTION_H_
37
#define KERN_arm32_EXCEPTION_H_
38
 
38
 
39
#include <arch/types.h>
39
#include <arch/types.h>
40
#include <arch/regutils.h>
40
#include <arch/regutils.h>
41
 
41
 
-
 
42
 
42
#define HIGH_EXCEPTION_VECTORS
43
#define HIGH_EXCEPTION_VECTORS
43
 
44
 
44
#ifdef HIGH_EXCEPTION_VECTORS
45
#ifdef HIGH_EXCEPTION_VECTORS
45
    #define EXC_BASE_ADDRESS    0xffff0000
46
    #define EXC_BASE_ADDRESS    0xffff0000
46
#else
47
#else
Line 63... Line 64...
63
#define EXC_PREFETCH_ABORT  3
64
#define EXC_PREFETCH_ABORT  3
64
#define EXC_DATA_ABORT      4
65
#define EXC_DATA_ABORT      4
65
#define EXC_IRQ             5
66
#define EXC_IRQ             5
66
#define EXC_FIQ             6
67
#define EXC_FIQ             6
67
 
68
 
-
 
69
 
-
 
70
/** Structure representing CPU state saved when an exception occurs. */
68
typedef struct {
71
typedef struct {
69
    uint32_t spsr;
72
    uint32_t spsr;
70
    uint32_t sp;
73
    uint32_t sp;
71
    uint32_t lr;
74
    uint32_t lr;
72
 
75
 
Line 92... Line 95...
92
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
95
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
93
{
96
{
94
    istate->pc = retaddr;
97
    istate->pc = retaddr;
95
}
98
}
96
 
99
 
-
 
100
 
97
/** Return true if exception happened while in userspace */
101
/** Return true if exception happened while in userspace. */
98
static inline int istate_from_uspace(istate_t *istate)
102
static inline int istate_from_uspace(istate_t *istate)
99
{
103
{
100
    return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE;
104
    return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE;
101
}
105
}
-
 
106
 
-
 
107
 
102
static inline unative_t istate_get_pc(istate_t *istate)
108
static inline unative_t istate_get_pc(istate_t *istate)
103
{
109
{
104
    return istate->pc;
110
    return istate->pc;
105
}
111
}
106
 
112
 
-
 
113
 
107
extern void setup_exception_stacks(void);
114
extern void setup_exception_stacks(void);
108
extern void install_exception_handlers(void);
115
extern void install_exception_handlers(void);
109
extern void exception_init(void);
116
extern void exception_init(void);
110
extern void print_istate(istate_t *istate);
117
extern void print_istate(istate_t *istate);
111
 
118
 
-
 
119
 
112
#endif
120
#endif
113
 
121
 
114
/** @}
122
/** @}
115
 */
123
 */