Changes in kernel/generic/src/interrupt/interrupt.c [181a746:8f4f444] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/interrupt/interrupt.c
r181a746 r8f4f444 50 50 #include <panic.h> 51 51 #include <print.h> 52 #include <stdarg.h> 52 53 #include <symtab.h> 53 54 #include <proc/thread.h> … … 110 111 } 111 112 112 /* Account CPU usage if it wokeup from sleep */113 if (CPU && CPU->idle) {113 /* Account CPU usage if it has waked up from sleep */ 114 if (CPU) { 114 115 irq_spinlock_lock(&CPU->lock, false); 115 uint64_t now = get_cycle(); 116 CPU->idle_cycles += now - CPU->last_cycle; 117 CPU->last_cycle = now; 118 CPU->idle = false; 116 if (CPU->idle) { 117 uint64_t now = get_cycle(); 118 CPU->idle_cycles += now - CPU->last_cycle; 119 CPU->last_cycle = now; 120 CPU->idle = false; 121 } 119 122 irq_spinlock_unlock(&CPU->lock, false); 120 123 } … … 163 166 } 164 167 165 /** Terminate thread and task if exception came from userspace. 166 * 167 */ 168 NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...) 169 { 170 if (!istate_from_uspace(istate)) 171 return; 172 168 static NO_TRACE void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args) 169 { 173 170 printf("Task %s (%" PRIu64 ") killed due to an exception at " 174 171 "program counter %p.\n", TASK->name, TASK->taskid, … … 179 176 180 177 printf("Kill message: "); 178 vprintf(fmt, args); 179 printf("\n"); 180 181 task_kill_self(true); 182 } 183 184 /** Terminate thread and task after the exception came from userspace. 185 * 186 */ 187 NO_TRACE void fault_from_uspace(istate_t *istate, const char *fmt, ...) 188 { 189 va_list args; 190 191 va_start(args, fmt); 192 fault_from_uspace_core(istate, fmt, args); 193 va_end(args); 194 } 195 196 /** Terminate thread and task if exception came from userspace. 197 * 198 */ 199 NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...) 200 { 201 if (!istate_from_uspace(istate)) 202 return; 181 203 182 204 va_list args; 183 205 va_start(args, fmt); 184 vprintf(fmt, args);206 fault_from_uspace_core(istate, fmt, args); 185 207 va_end(args); 186 printf("\n");187 188 task_kill_self(true);189 208 } 190 209
Note:
See TracChangeset
for help on using the changeset viewer.