exception.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2004 Jakub Jermar
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef __mips32_EXCEPTION_H__
00036 #define __mips32_EXCEPTION_H__
00037 
00038 #ifndef __mips32_TYPES_H__
00039 #  include <arch/types.h>
00040 #endif
00041 
00042 #include <typedefs.h>
00043 #include <arch/cp0.h>
00044 
00045 #define EXC_Int         0
00046 #define EXC_Mod         1
00047 #define EXC_TLBL        2
00048 #define EXC_TLBS        3
00049 #define EXC_AdEL        4
00050 #define EXC_AdES        5
00051 #define EXC_IBE         6
00052 #define EXC_DBE         7
00053 #define EXC_Sys         8
00054 #define EXC_Bp          9
00055 #define EXC_RI          10
00056 #define EXC_CpU         11
00057 #define EXC_Ov          12
00058 #define EXC_Tr          13
00059 #define EXC_VCEI        14
00060 #define EXC_FPE         15
00061 #define EXC_WATCH       23
00062 #define EXC_VCED        31
00063 
00064 struct istate {
00065         __u32 at;
00066         __u32 v0;
00067         __u32 v1;
00068         __u32 a0;
00069         __u32 a1;
00070         __u32 a2;
00071         __u32 a3;
00072         __u32 t0;
00073         __u32 t1;
00074         __u32 t2;
00075         __u32 t3;
00076         __u32 t4;
00077         __u32 t5;
00078         __u32 t6;
00079         __u32 t7;
00080         __u32 s0;
00081         __u32 s1;
00082         __u32 s2;
00083         __u32 s3;
00084         __u32 s4;
00085         __u32 s5;
00086         __u32 s6;
00087         __u32 s7;
00088         __u32 t8;
00089         __u32 t9;
00090         __u32 gp;
00091         __u32 sp;
00092         __u32 s8;
00093         __u32 ra;
00094         
00095         __u32 lo;
00096         __u32 hi;
00097 
00098         __u32 status; /* cp0_status */
00099         __u32 epc; /* cp0_epc */
00100         __u32 k1; /* We use it as thread-local pointer */
00101 };
00102 
00103 static inline void istate_set_retaddr(istate_t *istate, __address retaddr)
00104 {
00105         istate->epc = retaddr;
00106 }
00107 
00109 static inline int istate_from_uspace(istate_t *istate)
00110 {
00111         return istate->status & cp0_status_um_bit;
00112 }
00113 static inline __native istate_get_pc(istate_t *istate)
00114 {
00115         return istate->epc;
00116 }
00117 
00118 extern void exception(istate_t *istate);
00119 extern void tlb_refill_entry(void);
00120 extern void exception_entry(void);
00121 extern void cache_error_entry(void);
00122 extern void exception_init(void);
00123 
00124 #endif
00125 

Generated on Sun Jun 18 17:01:57 2006 for HelenOS Kernel (mips32) by  doxygen 1.4.6