- Timestamp:
- Mar 5, 2013, 1:42:57 PM (12 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/common.c
r228 r231 23 23 24 24 // SR save (used by _it_mask() / it_restore() 25 unsigned int _status_register_save ;25 unsigned int _status_register_save[NB_CLUSTERS*NB_PROCS_MAX]; 26 26 27 27 /////////////////////////////////////////////////////////////////////////////////// … … 103 103 // _it_mask() 104 104 // Access CP0 and mask IRQs 105 // This function uses a global _status_register_save array 106 // This function is NOT USED and NOT TESTED 105 107 /////////////////////////////////////////////////////////////////////////////////// 106 108 inline void _it_mask() { 107 109 unsigned int sr_value; 110 unsigned int proc_id; 108 111 asm volatile( 109 112 "li $3, 0xFFFFFFFE \n" … … 111 114 "and $3, $3, %0 \n" 112 115 "mtc0 $3, $12 \n" 113 : "=r"(sr_value) 116 "mfc0 %1, $15, 1 \n" 117 : "=r"(sr_value), "=r"(proc_id) 114 118 : 115 119 : "$3"); 116 _status_register_save = sr_value;120 _status_register_save[proc_id] = sr_value; 117 121 } 118 122 … … 121 125 // _it_restore() 122 126 // Access CP0 and enable IRQs 127 // This function uses a global _status_register_save array 128 // This function is NOT USED and NOT TESTED 123 129 /////////////////////////////////////////////////////////////////////////////////// 124 130 inline void _it_restore() { 125 unsigned int sr_value = _status_register_save; 126 asm volatile( 127 "mtc0 %0, $12 \n" 128 : 129 : "r"(sr_value)); 131 unsigned int proc_id; 132 // get the processor id to index the _status_register_save table 133 asm volatile("mfc0 %0, $15, 1" : "=r" (proc_id)); 134 // restore the saved value into the status register 135 asm volatile("mtc0 %0, $12" : : "r" (_status_register_save[proc_id])); 136 } 137 138 /////////////////////////////////////////////////////////////////////////////////// 139 // _it_disable() 140 // Access CP0 and disables IRQs 141 /////////////////////////////////////////////////////////////////////////////////// 142 inline void _it_disable() { 143 asm volatile( 144 "li $3, 0xFFFFFFFE \n" 145 "mfc0 $4, $12 \n" 146 "and $3, $3, $4 \n" 147 "mtc0 $3, $12 \n" 148 ::: "$3", "$4"); 149 } 150 151 /////////////////////////////////////////////////////////////////////////////////// 152 // _it_enable() 153 // Access CP0 and enables IRQs 154 /////////////////////////////////////////////////////////////////////////////////// 155 inline void _it_enable() { 156 asm volatile( 157 "li $3, 0x00000001 \n" 158 "mfc0 $4, $12 \n" 159 "or $3, $3, $4 \n" 160 "mtc0 $3, $12 \n" 161 ::: "$3", "$4"); 130 162 } 131 163 -
soft/giet_vm/sys/common.h
r228 r231 10 10 11 11 #include <mapping_info.h> 12 #include <giet_config.h> 12 13 13 14 /////////////////////////////////////////////////////////////////////////////////// … … 45 46 void _it_mask(void); 46 47 void _it_restore(void); 48 void _it_disable(void); 49 void _it_enable(void); 47 50 48 51 unsigned int _get_epc(void); -
soft/giet_vm/sys/ctx_handler.c
r228 r231 155 155 _release_lock(&_tty_put_lock); 156 156 157 delay = 1000000; 157 158 } 158 159 } // end ctx_idle() -
soft/giet_vm/sys/ctx_handler.h
r218 r231 37 37 #define CTX_PTPR_ID 39 38 38 39 #define CTX_TTY_ID 40 40 #define CTX_DMA_ID 41 41 #define CTX_NIC_ID 42 42 #define CTX_TIMER_ID 43 43 #define CTX_PTAB_ID 44 44 #define CTX_LTID_ID 45 45 #define CTX_VSID_ID 46 46 #define CTX_RUN_ID 47 39 #define CTX_TTY_ID 40 // Integer : global TTY terminal index 40 #define CTX_DMA_ID 41 // Integer : global DMA channel index 41 #define CTX_NIC_ID 42 // Integer : global NIC channel index 42 #define CTX_TIMER_ID 43 // Integer : user level timer index / UNUSED 43 #define CTX_PTAB_ID 44 // Pointer : page table virtual base adress 44 #define CTX_LTID_ID 45 // Integer : local task index (in scheduler) / UNUSED 45 #define CTX_VSID_ID 46 // Integer : vspace index 46 #define CTX_RUN_ID 47 // Boolean : task runable 47 47 48 48 ////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/sys/irq_handler.c
r228 r231 57 57 unsigned int entry = _get_interrupt_vector_entry(irq_id); 58 58 unsigned int isr_id = entry & 0x000000FF; 59 unsigned int type_id = (entry >> 8) & 0x000000FF; 59 60 unsigned int channel_id = (entry >> 16) & 0x0000FFFF; 60 if ( isr_id == ISR_SWITCH) _isr_switch( channel_id); 61 else if ( isr_id == ISR_IOC ) _isr_ioc(); 62 else if ( isr_id == ISR_DMA ) _isr_dma(channel_id); 63 else if ( isr_id == ISR_TTY ) _isr_tty(channel_id); 64 else if ( isr_id == ISR_TIMER ) _isr_timer(channel_id); 65 else _isr_default(); 61 if(type_id == 0) // HARD irq type 62 { 63 if ( isr_id == ISR_SWITCH) _isr_switch(channel_id); 64 else if ( isr_id == ISR_IOC ) _isr_ioc(); 65 else if ( isr_id == ISR_DMA ) _isr_dma(channel_id); 66 else if ( isr_id == ISR_TTY ) _isr_tty(channel_id); 67 else if ( isr_id == ISR_TIMER ) _isr_timer(channel_id); 68 else _isr_default(); 69 } 70 else // PTI irq type 71 { 72 if ( isr_id == ISR_SWITCH) _isr_switch(irq_id); 73 else if ( isr_id == ISR_TIMER ) _isr_timer(irq_id); 74 } 66 75 } 67 76 } -
soft/giet_vm/sys/sys_handler.c
r230 r231 94 94 95 95 // deschedule 96 _c tx_switch();96 _context_switch(); 97 97 } 98 98 … … 232 232 //////////////////////////////////////////////////////////////// 233 233 void _context_switch() { 234 _it_ mask();234 _it_disable(); 235 235 _ctx_switch(); 236 _it_restore();237 236 } 238 237 -
soft/giet_vm/xml/xml_parser.c
r230 r231 1239 1239 irq[irq_index]->type = 0; 1240 1240 } 1241 else if (strcmp(str, "SOFT") == 0 ){1241 else { 1242 1242 irq[irq_index]->type = 1; 1243 1243 } 1244 else { 1245 printf("[XML ERROR] undefined IRQ <type> for processor %d in cluster %d\n", 1246 cluster_index, proc_loc_index); 1247 exit(1); 1248 } 1249 } 1244 } 1250 1245 else { 1251 1246 printf("[XML ERROR] missing IRQ <type> for processor %d in cluster %d\n",
Note: See TracChangeset
for help on using the changeset viewer.