Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/exception.h

    r6ac14a70 r598f90e  
    2828 */
    2929
    30 /** @addtogroup arm32   
     30/** @addtogroup arm32
    3131 * @{
    3232 */
     
    3838#define KERN_arm32_EXCEPTION_H_
    3939
    40 #include <arch/types.h>
    41 #include <arch/regutils.h>
     40#include <typedefs.h>
     41#include <arch/istate.h>
    4242
    4343/** If defined, forces using of high exception vectors. */
     
    4545
    4646#ifdef HIGH_EXCEPTION_VECTORS
    47         #define EXC_BASE_ADDRESS        0xffff0000
     47        #define EXC_BASE_ADDRESS  0xffff0000
    4848#else
    49         #define EXC_BASE_ADDRESS        0x0
     49        #define EXC_BASE_ADDRESS  0x0
    5050#endif
    5151
    5252/* 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)
     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)
    6060
    6161/* Exception numbers */
     
    6868#define EXC_FIQ             6
    6969
    70 
    7170/** Kernel stack pointer.
    7271 *
    7372 * It is set when thread switches to user mode,
    7473 * and then used for exception handling.
     74 *
    7575 */
    7676extern uintptr_t supervisor_sp;
    77 
    7877
    7978/** Temporary exception stack pointer.
     
    8180 * Temporary stack is used in exceptions handling routines
    8281 * before switching to thread's kernel stack.
     82 *
    8383 */
    8484extern uintptr_t exc_stack;
    8585
    86 
    87 /** Struct representing CPU state saved when an exception occurs. */
    88 typedef struct {
    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;
    108 } istate_t;
    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  */
    116 static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
    117 {
    118         istate->pc = retaddr;
    119 }
    120 
    121 
    122 /** Returns true if exception happened while in userspace. */
    123 static inline int istate_from_uspace(istate_t *istate)
    124 {
    125         return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE;
    126 }
    127 
    128 
    129 /** Returns Program Counter member of given istate structure. */
    130 static inline unative_t istate_get_pc(istate_t *istate)
    131 {
    132         return istate->pc;
    133 }
    134 
    135 
    13686extern void install_exception_handlers(void);
    13787extern void exception_init(void);
    138 extern void print_istate(istate_t *istate);
    13988extern void reset_exception_entry(void);
    14089extern void irq_exception_entry(void);
     
    14594extern void swi_exception_entry(void);
    14695
    147 
    14896#endif
    14997
Note: See TracChangeset for help on using the changeset viewer.