Changeset 798 for soft/giet_vm/giet_kernel
- Timestamp:
- Mar 2, 2016, 3:08:27 PM (9 years ago)
- Location:
- soft/giet_vm/giet_kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/exc_handler.c
r709 r798 16 16 /////////////////////////////////////////////////////////////////////////////////// 17 17 18 static void _cause_ukn( );19 static void _cause_adel( );20 static void _cause_ades( );21 static void _cause_ibe( );22 static void _cause_dbe( );23 static void _cause_bp( );24 static void _cause_ri( );25 static void _cause_cpu( );26 static void _cause_ovf( );18 static void _cause_ukn(unsigned int * regs_table); 19 static void _cause_adel(unsigned int * regs_table); 20 static void _cause_ades(unsigned int * regs_table); 21 static void _cause_ibe(unsigned int * regs_table); 22 static void _cause_dbe(unsigned int * regs_table); 23 static void _cause_bp(unsigned int * regs_table); 24 static void _cause_ri(unsigned int * regs_table); 25 static void _cause_cpu(unsigned int * regs_table); 26 static void _cause_ovf(unsigned int * regs_table); 27 27 28 28 extern void _int_handler(); … … 55 55 56 56 /////////////////////////////////////////////// 57 static void _display_cause( unsigned int type )57 static void _display_cause( unsigned int type, unsigned int * regs_table ) 58 58 { 59 59 unsigned int gpid = _get_procid(); 60 60 unsigned int cluster_xy = gpid >> P_WIDTH; 61 61 unsigned int x = cluster_xy >> Y_WIDTH; 62 unsigned int y = cluster_xy & ((1 <<Y_WIDTH)-1);63 unsigned int p = gpid & ((1 <<P_WIDTH)-1);62 unsigned int y = cluster_xy & ((1 << Y_WIDTH) - 1); 63 unsigned int p = gpid & ((1 << P_WIDTH) - 1); 64 64 unsigned int trdid = _get_thread_trdid(); 65 65 unsigned int ltid = _get_thread_ltid(); … … 85 85 mips32_exc_str[type], _get_epc(), _get_bvar() ); 86 86 87 _printf("Registers:\n"); 88 _printf("CR: %X\tEPC: %X\tSR: %X\tCO_HI %X\tC0_LO %X\n", 89 regs_table[33], regs_table[32], regs_table[34], regs_table[36], regs_table[35]); 90 _printf("at_1 %X\tv0_2 %X\tv1_3 %X\ta0_4 %X\ta1_5 %X\n", 91 regs_table[1], regs_table[2], regs_table[3], regs_table[4], regs_table[5]); 92 _printf("a2_6 %X\ta3_7 %X\tt0_8 %X\tt1_9 %X\tt2_10 %X\n", 93 regs_table[6], regs_table[7], regs_table[8], regs_table[9], regs_table[10]); 94 _printf("t3_11 %X\tt4_12 %X\tt5_13 %X\tt6_14 %X\tt7_15 %X\n", 95 regs_table[11], regs_table[12], regs_table[13], regs_table[14], regs_table[15]); 96 _printf("s0_16 %X\ts1_17 %X\ts2_18 %X\ts3_19 %X\ts4_20 %X\n", 97 regs_table[16], regs_table[17], regs_table[18], regs_table[19], regs_table[20]); 98 _printf("s5_21 %X\ts6_22 %X\ts7_23 %X\tt8_24 %X\tt9_25 %X\n", 99 regs_table[21], regs_table[22], regs_table[23], regs_table[24], regs_table[25]); 100 _printf("gp_28 %X\tsp_29 %X\tfp_30 %X\tra_31 %X\n\n", 101 regs_table[28], regs_table[29], regs_table[30], regs_table[31]); 102 103 87 104 // register KILL signal 88 105 _atomic_or( &psched->context[ltid].slot[CTX_SIGS_ID] , SIGS_MASK_KILL ); … … 95 112 } // end display_cause() 96 113 97 static void _cause_ukn( ) { _display_cause(0); }98 static void _cause_adel( ) { _display_cause(1); }99 static void _cause_ades( ) { _display_cause(2); }100 static void _cause_ibe( ) { _display_cause(3); }101 static void _cause_dbe( ) { _display_cause(4); }102 static void _cause_bp( ) { _display_cause(5); }103 static void _cause_ri( ) { _display_cause(6); }104 static void _cause_cpu( ) { _display_cause(7); }105 static void _cause_ovf( ) { _display_cause(8); }114 static void _cause_ukn(unsigned int * regs_table) { _display_cause(0, regs_table); } 115 static void _cause_adel(unsigned int * regs_table) { _display_cause(1, regs_table); } 116 static void _cause_ades(unsigned int * regs_table) { _display_cause(2, regs_table); } 117 static void _cause_ibe(unsigned int * regs_table) { _display_cause(3, regs_table); } 118 static void _cause_dbe(unsigned int * regs_table) { _display_cause(4, regs_table); } 119 static void _cause_bp(unsigned int * regs_table) { _display_cause(5, regs_table); } 120 static void _cause_ri(unsigned int * regs_table) { _display_cause(6, regs_table); } 121 static void _cause_cpu(unsigned int * regs_table) { _display_cause(7, regs_table); } 122 static void _cause_ovf(unsigned int * regs_table) { _display_cause(8, regs_table); } 106 123 107 124 // Local Variables: -
soft/giet_vm/giet_kernel/exc_handler.h
r440 r798 17 17 /////////////////////////////////////////////////////////////////////////////////// 18 18 19 typedef void (*_exc_func_t)( void);19 typedef void (*_exc_func_t)(); 20 20 21 21 extern const _exc_func_t _cause_vector[16]; -
soft/giet_vm/giet_kernel/giet.s
r742 r798 39 39 _giet: 40 40 mfc0 $27, $13 /* $27 <= Cause register */ 41 la $26, _cause_vector /* $26 <= _cause_vector */ 42 andi $27, $27, 0x3c /* $27 <= XCODE*4 */ 43 addu $26, $26, $27 /* $26 <= &_cause_vector[XCODE] */ 44 lw $26, ($26) /* $26 <= _cause_vector[XCODE] */ 45 jr $26 /* Jump to handler indexed by XCODE */ 41 andi $27, $27, 0x3c /* $27 <= XCODE*4 */ 42 beq $27, $0, do_jump /* jump if interrupt */ 43 addiu $26, $0, 0x20 44 beq $27, $26, do_jump /* jump if syscall */ 45 /* Other exception: saving registers for future display */ 46 addiu $27, $29, -38*4 47 sw $29, (29*4)($27) 48 or $29, $27, $0 49 50 .set noat 51 sw $1, (1*4)($29) 52 .set at 53 sw $2, (2*4)($29) 54 sw $3, (3*4)($29) 55 sw $4, (4*4)($29) 56 sw $5, (5*4)($29) 57 sw $6, (6*4)($29) 58 sw $7, (7*4)($29) 59 sw $8, (8*4)($29) 60 sw $9, (9*4)($29) 61 sw $10, (10*4)($29) 62 sw $11, (11*4)($29) 63 sw $12, (12*4)($29) 64 sw $13, (13*4)($29) 65 sw $14, (14*4)($29) 66 sw $15, (15*4)($29) 67 sw $24, (24*4)($29) 68 sw $25, (25*4)($29) 69 sw $16, (16*4)($29) 70 mfc0 $16, $14 /* Read EPC */ 71 sw $17, (17*4)($29) 72 mfc0 $17, $13 /* read CR (used later) */ 73 sw $18, (18*4)($29) 74 mfc0 $18, $12 /* Read current SR (used later) */ 75 sw $19, (19*4)($29) 76 sw $20, (20*4)($29) 77 sw $21, (21*4)($29) 78 sw $22, (22*4)($29) 79 sw $23, (23*4)($29) 80 sw $30, (30*4)($29) 81 sw $28, (28*4)($29) 82 mflo $14 /* read LO */ 83 mfhi $15 /* read HI */ 84 sw $31, (31*4)($29) /* save RA */ 85 sw $16, (32*4)($29) /* Save EPC */ 86 sw $17, (33*4)($29) /* Save CR */ 87 sw $18, (34*4)($29) /* Save SR */ 88 sw $14, (35*4)($29) /* save LO */ 89 sw $15, (36*4)($29) /* save HI */ 90 or $4, $0, $27 91 92 93 do_jump: 94 mfc0 $27, $13 /* $27 <= Cause register */ 95 andi $27, $27, 0x3c /* $27 <= XCODE*4 */ 96 la $26, _cause_vector /* $26 <= _cause_vector */ 97 addu $26, $26, $27 /* $26 <= &_cause_vector[XCODE] */ 98 lw $26, 0($26) /* $26 <= _cause_vector[XCODE] */ 99 jr $26 /* Jump to handler indexed by XCODE */ 46 100 47 101 .endfunc
Note: See TracChangeset
for help on using the changeset viewer.