Changes in kernel/generic/src/interrupt/interrupt.c [8df5f20:11909ce3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/interrupt/interrupt.c
r8df5f20 r11909ce3 58 58 #include <trace.h> 59 59 60 /* 61 * If IVT_ITEMS is zero (e.g. for special/abs32le) we hide completely any 62 * access to the exception table array and panic if the function is called 63 * at all. It also silences (correct) compiler warnings about possible 64 * out-of-bound array access. 65 */ 66 60 67 exc_table_t exc_table[IVT_ITEMS]; 61 68 IRQ_SPINLOCK_INITIALIZE(exctbl_lock); … … 77 84 #if (IVT_ITEMS > 0) 78 85 assert(n < IVT_ITEMS); 79 #endif80 86 81 87 irq_spinlock_lock(&exctbl_lock, true); … … 91 97 92 98 return old; 99 #else 100 panic("No space for any exception handler, cannot register."); 101 #endif 93 102 } 94 103 … … 103 112 #if (IVT_ITEMS > 0) 104 113 assert(n < IVT_ITEMS); 105 #endif106 114 107 115 /* Account user cycles */ 108 if (THREAD) { 109 irq_spinlock_lock(&THREAD->lock, false); 116 if (THREAD) 110 117 thread_update_accounting(true); 111 irq_spinlock_unlock(&THREAD->lock, false);112 }113 118 114 119 /* Account CPU usage if it woke up from sleep */ 115 if (CPU && CPU->idle) { 116 irq_spinlock_lock(&CPU->lock, false); 120 if (CPU && CPU_LOCAL->idle) { 117 121 uint64_t now = get_cycle(); 118 CPU->idle_cycles += now - CPU->last_cycle; 119 CPU->last_cycle = now; 120 CPU->idle = false; 121 irq_spinlock_unlock(&CPU->lock, false); 122 atomic_time_increment(&CPU->idle_cycles, now - CPU_LOCAL->last_cycle); 123 CPU_LOCAL->last_cycle = now; 124 CPU_LOCAL->idle = false; 122 125 } 123 126 … … 149 152 150 153 /* Do not charge THREAD for exception cycles */ 151 if (THREAD) { 152 irq_spinlock_lock(&THREAD->lock, false); 154 if (THREAD) 153 155 THREAD->last_cycle = end_cycle; 154 irq_spinlock_unlock(&THREAD->lock, false); 155 } 156 #else 157 panic("No space for any exception handler, yet we want to handle some exception."); 158 #endif 156 159 } 157 160
Note:
See TracChangeset
for help on using the changeset viewer.