Ignore:
File:
1 edited

Legend:

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

    r598f90e rce890ec9  
    3737
    3838#include <typedefs.h>
    39 #include <arch/istate.h>
     39#include <arch/cp0.h>
     40#include <trace.h>
    4041
    4142#define EXC_Int    0
     
    5859#define EXC_VCED   31
    5960
     61typedef struct istate {
     62        /*
     63         * The first seven registers are arranged so that the istate structure
     64         * can be used both for exception handlers and for the syscall handler.
     65         */
     66        uint32_t a0;    /* arg1 */
     67        uint32_t a1;    /* arg2 */
     68        uint32_t a2;    /* arg3 */
     69        uint32_t a3;    /* arg4 */
     70        uint32_t t0;    /* arg5 */
     71        uint32_t t1;    /* arg6 */
     72        uint32_t v0;    /* arg7 */
     73        uint32_t v1;
     74        uint32_t at;
     75        uint32_t t2;
     76        uint32_t t3;
     77        uint32_t t4;
     78        uint32_t t5;
     79        uint32_t t6;
     80        uint32_t t7;
     81        uint32_t s0;
     82        uint32_t s1;
     83        uint32_t s2;
     84        uint32_t s3;
     85        uint32_t s4;
     86        uint32_t s5;
     87        uint32_t s6;
     88        uint32_t s7;
     89        uint32_t t8;
     90        uint32_t t9;
     91        uint32_t kt0;
     92        uint32_t kt1;   /* We use it as thread-local pointer */
     93        uint32_t gp;
     94        uint32_t sp;
     95        uint32_t s8;
     96        uint32_t ra;
     97       
     98        uint32_t lo;
     99        uint32_t hi;
     100       
     101        uint32_t status;        /* cp0_status */
     102        uint32_t epc;           /* cp0_epc */
     103
     104        uint32_t alignment;     /* to make sizeof(istate_t) a multiple of 8 */
     105} istate_t;
     106
     107NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
     108    uintptr_t retaddr)
     109{
     110        istate->epc = retaddr;
     111}
     112
     113/** Return true if exception happened while in userspace */
     114NO_TRACE static inline int istate_from_uspace(istate_t *istate)
     115{
     116        return istate->status & cp0_status_um_bit;
     117}
     118
     119NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)
     120{
     121        return istate->epc;
     122}
     123
     124NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)
     125{
     126        return istate->sp;
     127}
     128
    60129extern void exception(istate_t *istate);
    61130extern void tlb_refill_entry(void);
Note: See TracChangeset for help on using the changeset viewer.