Changeset 6b781c0 in mainline for kernel/arch/arm32/include/exception.h
- Timestamp:
- 2007-06-08T15:02:49Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c03ee1c
- Parents:
- 3ee8a075
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/exception.h
r3ee8a075 r6b781c0 1 1 /* 2 * Copyright (c) 2003-2004 Jakub Jermar 2 * Copyright (c) 2007 Michal Kebrt, Petr Stepan 3 * 3 4 * All rights reserved. 4 5 * … … 31 32 */ 32 33 /** @file 34 * @brief Exception declarations. 33 35 */ 34 36 … … 37 39 38 40 #include <arch/types.h> 41 #include <arch/regutils.h> 39 42 43 /** If defined, forces using of high exception vectors. */ 44 #define HIGH_EXCEPTION_VECTORS 45 46 #ifdef HIGH_EXCEPTION_VECTORS 47 #define EXC_BASE_ADDRESS 0xffff0000 48 #else 49 #define EXC_BASE_ADDRESS 0x0 50 #endif 51 52 /* Exception Vectors */ 53 #define EXC_RESET_VEC (EXC_BASE_ADDRESS + 0x0) 54 #define EXC_UNDEF_INSTR_VEC (EXC_BASE_ADDRESS + 0x4) 55 #define EXC_SWI_VEC (EXC_BASE_ADDRESS + 0x8) 56 #define EXC_PREFETCH_ABORT_VEC (EXC_BASE_ADDRESS + 0xc) 57 #define EXC_DATA_ABORT_VEC (EXC_BASE_ADDRESS + 0x10) 58 #define EXC_IRQ_VEC (EXC_BASE_ADDRESS + 0x18) 59 #define EXC_FIQ_VEC (EXC_BASE_ADDRESS + 0x1c) 60 61 /* Exception numbers */ 62 #define EXC_RESET 0 63 #define EXC_UNDEF_INSTR 1 64 #define EXC_SWI 2 65 #define EXC_PREFETCH_ABORT 3 66 #define EXC_DATA_ABORT 4 67 #define EXC_IRQ 5 68 #define EXC_FIQ 6 69 70 71 /** Kernel stack pointer. 72 * 73 * It is set when thread switches to user mode, 74 * and then used for exception handling. 75 */ 76 extern uintptr_t supervisor_sp; 77 78 79 /** Temporary exception stack pointer. 80 * 81 * Temporary stack is used in exceptions handling routines 82 * before switching to thread's kernel stack. 83 */ 84 extern uintptr_t exc_stack; 85 86 87 /** Struct representing CPU state saved when an exception occurs. */ 40 88 typedef struct { 41 /* TODO */ 89 uint32_t spsr; 90 uint32_t sp; 91 uint32_t lr; 92 93 uint32_t r0; 94 uint32_t r1; 95 uint32_t r2; 96 uint32_t r3; 97 uint32_t r4; 98 uint32_t r5; 99 uint32_t r6; 100 uint32_t r7; 101 uint32_t r8; 102 uint32_t r9; 103 uint32_t r10; 104 uint32_t r11; 105 uint32_t r12; 106 107 uint32_t pc; 42 108 } istate_t; 43 109 110 111 /** Sets Program Counter member of given istate structure. 112 * 113 * @param istate istate structure 114 * @param retaddr new value of istate's PC member 115 */ 44 116 static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr) 45 117 { 46 /* TODO */ 118 istate->pc = retaddr; 47 119 } 48 120 49 /** Return true if exception happened while in userspace */ 121 122 /** Returns true if exception happened while in userspace. */ 50 123 static inline int istate_from_uspace(istate_t *istate) 51 124 { 52 /* TODO */ 53 return 0; 125 return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE; 54 126 } 127 128 129 /** Returns Program Counter member of given istate structure. */ 55 130 static inline unative_t istate_get_pc(istate_t *istate) 56 131 { 57 /* TODO */ 58 return 0; 132 return istate->pc; 59 133 } 134 135 136 extern void install_exception_handlers(void); 137 extern void exception_init(void); 138 extern void print_istate(istate_t *istate); 139 60 140 61 141 #endif
Note:
See TracChangeset
for help on using the changeset viewer.