Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3430 → Rev 3431

/branches/tracing/kernel/generic/include/proc/task.h
95,6 → 95,7
*/
atomic_t active_calls;
 
#ifdef CONFIG_UDEBUG
/** Debugging stuff */
udebug_task_t udebug;
 
106,6 → 107,7
mutex_t kb_cleanup_lock;
/** True if cleanup of kbox has already started */
bool kb_finished;
#endif
/** Architecture specific task data. */
task_arch_t arch;
/branches/tracing/kernel/generic/include/proc/thread.h
205,8 → 205,11
/** Thread's kernel stack. */
uint8_t *kstack;
 
#ifdef CONFIG_UDEBUG
/** Debugging stuff */
udebug_thread_t udebug;
#endif
 
} thread_t;
 
/** Thread list lock.
/branches/tracing/kernel/generic/include/mm/as.h
225,8 → 225,12
extern int as_area_get_flags(as_area_t *area);
extern bool as_area_check_access(as_area_t *area, pf_access_t access);
extern size_t as_area_get_size(uintptr_t base);
 
#ifdef CONFIG_UDEBUG
extern int as_area_make_writeable(uintptr_t address);
extern int as_debug_write(uintptr_t va, void *data, size_t n);
#endif
 
extern int used_space_insert(as_area_t *a, uintptr_t page, count_t count);
extern int used_space_remove(as_area_t *a, uintptr_t page, count_t count);
 
/branches/tracing/kernel/generic/src/main/uinit.c
45,9 → 45,10
#include <proc/thread.h>
#include <userspace.h>
#include <mm/slab.h>
#include <arch.h>
#include <udebug/udebug.h>
#include <arch.h>
 
 
/** Thread used to bring up userspace thread.
*
* @param arg Pointer to structure containing userspace entry and stack
67,7 → 68,9
*/
thread_detach(THREAD);
 
#ifdef CONFIG_UDEBUG
udebug_stoppable_end();
#endif
uarg.uspace_entry = ((uspace_arg_t *) arg)->uspace_entry;
uarg.uspace_stack = ((uspace_arg_t *) arg)->uspace_stack;
/branches/tracing/kernel/generic/src/interrupt/interrupt.c
87,11 → 87,15
{
ASSERT(n < IVT_ITEMS);
 
#ifdef CONFIG_UDEBUG
if (THREAD) THREAD->udebug.uspace_state = istate;
#endif
exc_table[n].f(n + IVT_FIRST, istate);
 
#ifdef CONFIG_UDEBUG
if (THREAD) THREAD->udebug.uspace_state = NULL;
#endif
 
/* This is a safe place to exit exiting thread */
if (THREAD && THREAD->interrupted && istate_from_uspace(istate))
/branches/tracing/kernel/generic/src/time/clock.c
193,11 → 193,13
 
scheduler();
 
#ifdef CONFIG_UDEBUG
/*
* Give udebug chance to stop the thread
* before it begins executing.
*/
udebug_before_thread_runs();
#endif
}
}
 
/branches/tracing/kernel/generic/src/proc/task.c
156,6 → 156,7
ta->capabilities = 0;
ta->cycles = 0;
 
#ifdef CONFIG_UDEBUG
/* Init debugging stuff */
udebug_task_init(&ta->udebug);
 
164,6 → 165,7
ta->kb_thread = NULL;
mutex_initialize(&ta->kb_cleanup_lock, MUTEX_PASSIVE);
ta->kb_finished = false;
#endif
 
ipc_answerbox_init(&ta->answerbox, ta);
for (i = 0; i < IPC_MAX_PHONES; i++)
/branches/tracing/kernel/generic/src/proc/thread.c
180,7 → 180,9
return -1;
}
 
#ifdef CONFIG_UDEBUG
mutex_initialize(&t->udebug.lock, MUTEX_PASSIVE);
#endif
 
return 0;
}
348,9 → 350,11
 
avltree_node_initialize(&t->threads_tree_node);
t->threads_tree_node.key = (uintptr_t) t;
 
#ifdef CONFIG_UDEBUG
/* Init debugging stuff */
udebug_thread_initialize(&t->udebug);
#endif
 
/* might depend on previous initialization */
thread_create_arch(t);
418,10 → 422,13
*/
ipl = interrupts_disable();
spinlock_lock(&task->lock);
 
atomic_inc(&task->refcount);
 
/* Must not count kbox thread into lifecount */
if (t->flags & THREAD_FLAG_USPACE)
atomic_inc(&task->lifecount);
 
list_append(&t->th_link, &task->th_head);
spinlock_unlock(&task->lock);
 
445,9 → 452,10
ipl_t ipl;
 
if (THREAD->flags & THREAD_FLAG_USPACE) {
#ifdef CONFIG_UDEBUG
/* Generate udebug THREAD_E event */
udebug_thread_e_event();
 
#endif
if (atomic_predec(&TASK->lifecount) == 0) {
/*
* We are the last userspace thread in the task that
752,8 → 760,10
thread_attach(t, TASK);
thread_ready(t);
 
#ifdef CONFIG_UDEBUG
/* Generate udebug THREAD_B event */
udebug_thread_b_event(t);
#endif
 
return 0;
} else
/branches/tracing/kernel/generic/src/mm/as.c
1107,6 → 1107,8
AS = new_as;
}
 
#ifdef CONFIG_UDEBUG
 
/** Write directly into a page, bypassing area flags.
*
* This allows a debugger to write into a page that is mapped read-only
1307,6 → 1309,8
return EOK;
}
 
#endif /* defined(CONFIG_UDEBUG) */
 
/** Convert address space area flags to page flags.
*
* @param aflags Flags of some address space area.
/branches/tracing/kernel/generic/src/syscall/syscall.c
101,13 → 101,18
unative_t a4, unative_t a5, unative_t a6, unative_t id)
{
unative_t rc;
 
#ifdef CONFIG_UDEBUG
istate_t fake_state;
 
THREAD->udebug.uspace_state = &fake_state;
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
#endif
 
if (id < SYSCALL_END) {
#ifdef CONFIG_UDEBUG
udebug_stoppable_begin();
#endif
rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
} else {
printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
118,9 → 123,11
if (THREAD->interrupted)
thread_exit();
 
#ifdef CONFIG_UDEBUG
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
udebug_stoppable_end();
THREAD->udebug.uspace_state = NULL;
#endif
return rc;
}
/branches/tracing/kernel/generic/src/ipc/sysipc.c
342,8 → 342,10
return rc;
}
break;
#ifdef CONFIG_UDEBUG
case IPC_M_DEBUG_ALL:
return udebug_request_preprocess(call, phone);
#endif
default:
break;
}
888,6 → 890,7
*/
unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
{
#ifdef CONFIG_UDEBUG
sysarg64_t taskid_arg;
int rc;
898,6 → 901,9
printf("sys_ipc_connect_kbox(%lld, %d)\n", taskid_arg.value);
 
return ipc_connect_kbox(taskid_arg.value);
#else
return (unative_t) ENOTSUP;
#endif
}
 
/** @}
/branches/tracing/kernel/generic/src/ipc/ipc.c
456,7 → 456,7
ipl_t ipl;
call_t *call;
 
call = ipc_call_alloc(0);
call = notify_box ? ipc_call_alloc(0) : NULL;
 
/* Disconnect all phones connected to our answerbox */
restart_phones:
510,6 → 510,8
if (call) ipc_call_free(call);
}
 
#ifdef CONFIG_UDEBUG
 
static void ipc_kbox_cleanup()
{
bool have_kb_thread;
546,6 → 548,7
spinlock_unlock(&TASK->kernel_box.lock);
}
 
#endif
 
/** Cleans up all IPC communication of the current task.
*
567,8 → 570,10
/* Disconnect all phones connected to our regular answerbox */
ipc_answerbox_slam_phones(&TASK->answerbox, false);
 
#ifdef CONFIG_UDEBUG
/* Clean up kbox thread and communications */
ipc_kbox_cleanup();
#endif
 
/* Answer all messages in 'calls' and 'dispatched_calls' queues */
spinlock_lock(&TASK->answerbox.lock);
723,6 → 728,8
spinlock_unlock(&task->lock);
}
 
#ifdef CONFIG_UDEBUG
 
#include <ipc/ipcrsc.h>
#include <print.h>
#include <udebug/udebug_ipc.h>
864,5 → 871,7
return newphid;
}
 
#endif /* defined(CONFIG_UDEBUG) */
 
/** @}
*/