Changeset a074b4f in mainline for kernel/generic/src
- Timestamp:
- 2010-01-23T19:19:18Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 03333bc
- Parents:
- 336db295
- Location:
- kernel/generic/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/interrupt/interrupt.c
r336db295 ra074b4f 44 44 #include <console/console.h> 45 45 #include <console/cmd.h> 46 #include <ipc/event.h> 47 #include <synch/mutex.h> 48 #include <time/delay.h> 49 #include <macros.h> 46 50 #include <panic.h> 47 51 #include <print.h> … … 107 111 fault_if_from_uspace(istate, "Unhandled exception %d.", n); 108 112 panic("Unhandled exception %d.", n); 113 } 114 115 /** Terminate thread and task if exception came from userspace. */ 116 void fault_if_from_uspace(istate_t *istate, char *fmt, ...) 117 { 118 task_t *task = TASK; 119 va_list args; 120 121 if (!istate_from_uspace(istate)) 122 return; 123 124 printf("Task %s (%" PRIu64 ") killed due to an exception at " 125 "program counter %p.\n", task->name, task->taskid, 126 istate_get_pc(istate)); 127 128 stack_trace_istate(istate); 129 130 printf("Kill message: "); 131 va_start(args, fmt); 132 vprintf(fmt, args); 133 va_end(args); 134 printf("\n"); 135 136 if (event_is_subscribed(EVENT_FAULT)) { 137 event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid), 138 UPPER32(TASK->taskid), (unative_t) THREAD); 139 } 140 141 #ifdef CONFIG_UDEBUG 142 /* Wait until a debugger attends to us. */ 143 mutex_lock(&THREAD->udebug.lock); 144 while (!THREAD->udebug.active) 145 condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock); 146 mutex_unlock(&THREAD->udebug.lock); 147 148 udebug_stoppable_begin(); 149 udebug_stoppable_end(); 150 151 /* Make sure the debugging session is over before proceeding. */ 152 mutex_lock(&THREAD->udebug.lock); 153 while (THREAD->udebug.active) 154 condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock); 155 mutex_unlock(&THREAD->udebug.lock); 156 #endif 157 158 task_kill(task->taskid); 159 thread_exit(); 109 160 } 110 161 -
kernel/generic/src/udebug/udebug.c
r336db295 ra074b4f 69 69 mutex_initialize(&ut->lock, MUTEX_PASSIVE); 70 70 waitq_initialize(&ut->go_wq); 71 condvar_initialize(&ut->active_cv); 71 72 72 73 ut->go_call = NULL; … … 446 447 waitq_wakeup(&t->udebug.go_wq, WAKEUP_FIRST); 447 448 } 449 mutex_unlock(&t->udebug.lock); 450 condvar_broadcast(&t->udebug.active_cv); 451 } else { 452 mutex_unlock(&t->udebug.lock); 448 453 } 449 mutex_unlock(&t->udebug.lock);450 454 } 451 455 -
kernel/generic/src/udebug/udebug_ops.c
r336db295 ra074b4f 209 209 210 210 mutex_lock(&t->udebug.lock); 211 if ((t->flags & THREAD_FLAG_USPACE) != 0) 211 if ((t->flags & THREAD_FLAG_USPACE) != 0) { 212 212 t->udebug.active = true; 213 mutex_unlock(&t->udebug.lock); 213 mutex_unlock(&t->udebug.lock); 214 condvar_broadcast(&t->udebug.active_cv); 215 } else { 216 mutex_unlock(&t->udebug.lock); 217 } 214 218 } 215 219
Note:
See TracChangeset
for help on using the changeset viewer.