Ignore:
File:
1 edited

Legend:

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

    r598f90e r7a0359b  
    3939
    4040#include <typedefs.h>
    41 #include <arch/istate.h>
     41#include <arch/regutils.h>
     42#include <trace.h>
    4243
    4344/** If defined, forces using of high exception vectors. */
     
    8485extern uintptr_t exc_stack;
    8586
     87/** Struct representing CPU state saved when an exception occurs. */
     88typedef struct istate {
     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 fp;
     105        uint32_t r12;
     106       
     107        uint32_t pc;
     108} istate_t;
     109
     110/** Set Program Counter member of given istate structure.
     111 *
     112 * @param istate  istate structure
     113 * @param retaddr new value of istate's PC member
     114 *
     115 */
     116NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
     117    uintptr_t retaddr)
     118{
     119        istate->pc = retaddr;
     120}
     121
     122/** Return true if exception happened while in userspace. */
     123NO_TRACE static inline int istate_from_uspace(istate_t *istate)
     124{
     125        return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE;
     126}
     127
     128/** Return Program Counter member of given istate structure. */
     129NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)
     130{
     131        return istate->pc;
     132}
     133
     134NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)
     135{
     136        return istate->fp;
     137}
     138
    86139extern void install_exception_handlers(void);
    87140extern void exception_init(void);
Note: See TracChangeset for help on using the changeset viewer.