Changeset 909c6e3 in mainline
- Timestamp:
- 2005-09-07T09:44:30Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d246e7e
- Parents:
- 24bd23a
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips/include/context.h
r24bd23a r909c6e3 31 31 32 32 #define STACK_ITEM_SIZE 4 33 34 /* These are offsets into the register dump saved35 * on exception entry36 */37 #define EOFFSET_AT 038 #define EOFFSET_V0 439 #define EOFFSET_V1 840 #define EOFFSET_A0 1241 #define EOFFSET_A1 1642 #define EOFFSET_A2 2043 #define EOFFSET_A3 2444 #define EOFFSET_A4 2845 #define EOFFSET_T1 3246 #define EOFFSET_T2 3647 #define EOFFSET_T3 4048 #define EOFFSET_T4 4449 #define EOFFSET_T5 4850 #define EOFFSET_T6 5251 #define EOFFSET_T7 5652 #define EOFFSET_T8 6053 #define EOFFSET_T9 6454 #define EOFFSET_S0 6855 #define EOFFSET_S1 7256 #define EOFFSET_S2 7657 #define EOFFSET_S3 8058 #define EOFFSET_S4 8459 #define EOFFSET_S5 8860 #define EOFFSET_S6 9261 #define EOFFSET_S7 9662 #define EOFFSET_S8 10063 #define EOFFSET_GP 10464 #define EOFFSET_RA 10865 #define EOFFSET_SP 11266 67 #define EOFFSET_LO 11668 #define EOFFSET_HI 12069 #define EOFFSET_STATUS 12470 71 #define REGISTER_SPACE 12872 33 73 34 /* -
arch/mips/include/exception.h
r24bd23a r909c6e3 30 30 #define __EXCEPTION_H__ 31 31 32 #ifndef __mips_TYPES_H_ 33 # include <arch/types.h> 34 #endif 35 32 36 #define EXC_Int 0 33 37 #define EXC_Mod 1 … … 49 53 #define EXC_VCED 31 50 54 51 extern void exception(void); 55 struct exception_regdump { 56 __u32 at; 57 __u32 v0; 58 __u32 v1; 59 __u32 a0; 60 __u32 a1; 61 __u32 a2; 62 __u32 a3; 63 __u32 t0; 64 __u32 t1; 65 __u32 t2; 66 __u32 t3; 67 __u32 t4; 68 __u32 t5; 69 __u32 t6; 70 __u32 t7; 71 __u32 s0; 72 __u32 s1; 73 __u32 s2; 74 __u32 s3; 75 __u32 s4; 76 __u32 s5; 77 __u32 s6; 78 __u32 s7; 79 __u32 t8; 80 __u32 t9; 81 __u32 gp; 82 __u32 sp; 83 __u32 s8; 84 __u32 ra; 85 86 __u32 lo; 87 __u32 hi; 88 89 __u32 status; /* cp0_status */ 90 __u32 epc; /* cp0_epc */ 91 }; 92 93 extern void exception(struct exception_regdump *pstate); 52 94 53 95 #endif -
arch/mips/include/mm/tlb.h
r24bd23a r909c6e3 29 29 #ifndef __mips_TLB_H__ 30 30 #define __mips_TLB_H__ 31 32 #include <arch/exception.h> 31 33 32 34 #define PAGE_UNCACHED 2 … … 64 66 typedef struct entry_lo pte_t; 65 67 66 extern void tlb_ refill(void);67 extern void tlb_ invalid(void);68 extern void tlb_invalid(struct exception_regdump *pstate); 69 extern void tlb_refill(struct exception_regdump *pstate); 68 70 69 71 #endif -
arch/mips/include/thread.h
r24bd23a r909c6e3 30 30 #define __mips_THREAD_H__ 31 31 32 #define ARCH_THREAD_DATA __u32 saved_epc;32 #define ARCH_THREAD_DATA 33 33 34 34 #endif -
arch/mips/src/context.S
r24bd23a r909c6e3 29 29 #define __ASM__ 30 30 #include <arch/asm/regname.h> 31 #include "context_offset.h"31 #include <arch/context_offset.h> 32 32 33 33 .text -
arch/mips/src/exception.c
r24bd23a r909c6e3 35 35 #include <debug.h> 36 36 37 void exception( void)37 void exception(struct exception_regdump *pstate) 38 38 { 39 39 int excno; 40 __u32 epc;41 40 __u32 epc_shift = 0; 42 41 … … 46 45 * NOTE ON OPERATION ORDERING 47 46 * 48 * On entry, cpu_priority_high() must be called before exception bit is cleared.49 * On exit, exception bit must be set before cpu_priority_restore() is called.47 * On entry, cpu_priority_high() must be called before 48 * exception bit is cleared. 50 49 */ 51 50 52 51 cpu_priority_high(); 53 epc = cp0_epc_read();54 52 cp0_status_write(cp0_status_read() & ~ (cp0_status_exl_exception_bit | 55 53 cp0_status_um_bit)); 56 54 57 if (THREAD) {58 THREAD->saved_epc = epc;59 }60 55 /* decode exception number and process the exception */ 61 56 switch (excno = (cp0_cause_read() >> 2) & 0x1f) { … … 65 60 case EXC_TLBL: 66 61 case EXC_TLBS: 67 tlb_invalid( );62 tlb_invalid(pstate); 68 63 break; 69 64 case EXC_Mod: … … 115 110 } 116 111 117 if (THREAD) 118 epc = THREAD->saved_epc; 119 120 /* Raise EXL bit before epc_write, so that we support 121 * properly nested exceptions 122 */ 123 cp0_status_write(cp0_status_read() | cp0_status_exl_exception_bit); 124 cp0_epc_write(epc + epc_shift); 112 pstate->epc += epc_shift; 125 113 } -
arch/mips/src/mm/tlb.c
r24bd23a r909c6e3 36 36 #include <symtab.h> 37 37 38 void tlb_refill( void)38 void tlb_refill(struct exception_regdump *pstate) 39 39 { 40 40 panic("tlb_refill exception\n"); 41 41 } 42 42 43 void tlb_invalid( void)43 void tlb_invalid(struct exception_regdump *pstate) 44 44 { 45 45 char *symbol = ""; 46 46 47 47 if (THREAD) { 48 char *s = get_symtab_entry( THREAD->saved_epc);48 char *s = get_symtab_entry(pstate->epc); 49 49 if (s) 50 50 symbol = s; 51 51 } 52 52 panic("%X: TLB exception at %X(%s)\n", cp0_badvaddr_read(), 53 THREAD ? THREAD->saved_epc : 0, symbol);53 pstate->epc, symbol); 54 54 } 55 55 -
arch/mips/src/start.S
r24bd23a r909c6e3 32 32 #include <arch/mm/page.h> 33 33 #include <arch/asm/boot.h> 34 #include <arch/context .h>34 #include <arch/context_offset.h> 35 35 36 36 .text … … 56 56 sw $a2,EOFFSET_A2(\r) 57 57 sw $a3,EOFFSET_A3(\r) 58 sw $t0,EOFFSET_ A4(\r)58 sw $t0,EOFFSET_T0(\r) 59 59 sw $t1,EOFFSET_T1(\r) 60 60 sw $t2,EOFFSET_T2(\r) … … 87 87 mfc0 $at, $status 88 88 sw $at,EOFFSET_STATUS(\r) 89 mfc0 $at, $epc 90 sw $at,EOFFSET_EPC(\r) 89 91 .endm 90 92 … … 96 98 lw $a2,EOFFSET_A2(\r) 97 99 lw $a3,EOFFSET_A3(\r) 98 lw $t0,EOFFSET_ A4(\r)100 lw $t0,EOFFSET_T0(\r) 99 101 lw $t1,EOFFSET_T1(\r) 100 102 lw $t2,EOFFSET_T2(\r) … … 125 127 lw $at,EOFFSET_STATUS(\r) 126 128 mtc0 $at, $status 129 lw $at,EOFFSET_EPC(\r) 130 mtc0 $at, $epc 127 131 128 132 lw $at,EOFFSET_AT(\r) … … 192 196 add $sp, $k0, 0 193 197 194 jal exception 198 add $a0, $sp, 0 199 jal exception /* exception(register_space) */ 195 200 nop 196 201 … … 206 211 add $sp, $k0, 0 207 212 208 jal tlb_refill 213 add $a0, $sp, 0 214 jal tlb_refill /* tlb_refill(register_space) */ 209 215 nop 210 216 -
src/clean.mips
r24bd23a r909c6e3 4 4 5 5 rm ../tools/mips/gencontext 6 rm ../arch/mips/ src/context_offset.h6 rm ../arch/mips/include/context_offset.h -
tools/mips/gencontext.c
r24bd23a r909c6e3 7 7 #define __mips_TYPES_H_ 8 8 #include "../../arch/mips/include/context.h" 9 #include "../../arch/mips/include/exception.h" 9 10 10 #define FILENAME "../../arch/mips/ src/context_offset.h"11 #define FILENAME "../../arch/mips/include/context_offset.h" 11 12 12 13 int main(void) 13 14 { 14 15 FILE *f; 15 struct context ctx; 16 struct context *pctx = &ctx; 16 struct context *pctx = NULL; 17 struct exception_regdump *edmp = NULL; 18 17 19 18 20 f = fopen(FILENAME,"w"); … … 23 25 24 26 fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__); 27 28 fprintf(f,"/* struct context */\n"); 25 29 26 30 fprintf(f,"#define OFFSET_SP 0x%x\n",((int)&pctx->sp) - (int )pctx); … … 37 41 fprintf(f,"#define OFFSET_GP 0x%x\n",((int)&pctx->gp) - (int )pctx); 38 42 43 fprintf(f,"\n\n/* struct register_dump */\n"); 44 fprintf(f,"#define EOFFSET_AT 0x%x\n",((int)&edmp->at) - (int )edmp); 45 fprintf(f,"#define EOFFSET_V0 0x%x\n",((int)&edmp->v0) - (int )edmp); 46 fprintf(f,"#define EOFFSET_V1 0x%x\n",((int)&edmp->v1) - (int )edmp); 47 fprintf(f,"#define EOFFSET_A0 0x%x\n",((int)&edmp->a0) - (int )edmp); 48 fprintf(f,"#define EOFFSET_A1 0x%x\n",((int)&edmp->a1) - (int )edmp); 49 fprintf(f,"#define EOFFSET_A2 0x%x\n",((int)&edmp->a2) - (int )edmp); 50 fprintf(f,"#define EOFFSET_A3 0x%x\n",((int)&edmp->a3) - (int )edmp); 51 fprintf(f,"#define EOFFSET_T0 0x%x\n",((int)&edmp->t0) - (int )edmp); 52 fprintf(f,"#define EOFFSET_T1 0x%x\n",((int)&edmp->t1) - (int )edmp); 53 fprintf(f,"#define EOFFSET_T2 0x%x\n",((int)&edmp->t2) - (int )edmp); 54 fprintf(f,"#define EOFFSET_T3 0x%x\n",((int)&edmp->t3) - (int )edmp); 55 fprintf(f,"#define EOFFSET_T4 0x%x\n",((int)&edmp->t4) - (int )edmp); 56 fprintf(f,"#define EOFFSET_T5 0x%x\n",((int)&edmp->t5) - (int )edmp); 57 fprintf(f,"#define EOFFSET_T6 0x%x\n",((int)&edmp->t6) - (int )edmp); 58 fprintf(f,"#define EOFFSET_T7 0x%x\n",((int)&edmp->t7) - (int )edmp); 59 fprintf(f,"#define EOFFSET_S0 0x%x\n",((int)&edmp->s0) - (int )edmp); 60 fprintf(f,"#define EOFFSET_S1 0x%x\n",((int)&edmp->s1) - (int )edmp); 61 fprintf(f,"#define EOFFSET_S2 0x%x\n",((int)&edmp->s2) - (int )edmp); 62 fprintf(f,"#define EOFFSET_S3 0x%x\n",((int)&edmp->s3) - (int )edmp); 63 fprintf(f,"#define EOFFSET_S4 0x%x\n",((int)&edmp->s4) - (int )edmp); 64 fprintf(f,"#define EOFFSET_S5 0x%x\n",((int)&edmp->s5) - (int )edmp); 65 fprintf(f,"#define EOFFSET_S6 0x%x\n",((int)&edmp->s6) - (int )edmp); 66 fprintf(f,"#define EOFFSET_S7 0x%x\n",((int)&edmp->s7) - (int )edmp); 67 fprintf(f,"#define EOFFSET_T8 0x%x\n",((int)&edmp->t8) - (int )edmp); 68 fprintf(f,"#define EOFFSET_T9 0x%x\n",((int)&edmp->t9) - (int )edmp); 69 fprintf(f,"#define EOFFSET_GP 0x%x\n",((int)&edmp->gp) - (int )edmp); 70 fprintf(f,"#define EOFFSET_SP 0x%x\n",((int)&edmp->sp) - (int )edmp); 71 fprintf(f,"#define EOFFSET_S8 0x%x\n",((int)&edmp->s8) - (int )edmp); 72 fprintf(f,"#define EOFFSET_RA 0x%x\n",((int)&edmp->ra) - (int )edmp); 73 fprintf(f,"#define EOFFSET_LO 0x%x\n",((int)&edmp->lo) - (int )edmp); 74 fprintf(f,"#define EOFFSET_HI 0x%x\n",((int)&edmp->hi) - (int )edmp); 75 fprintf(f,"#define EOFFSET_STATUS 0x%x\n",((int)&edmp->status) - (int )edmp); 76 fprintf(f,"#define EOFFSET_EPC 0x%x\n",((int)&edmp->epc) - (int )edmp); 77 78 fprintf(f,"#define REGISTER_SPACE %d\n",sizeof(*edmp)); 39 79 40 80 fclose(f);
Note:
See TracChangeset
for help on using the changeset viewer.