/branches/tracing/kernel/generic/include/udebug/udebug.h |
---|
84,13 → 84,7 |
* |
* - ARG2 - thread identification |
* - ARG3 - destination address in the caller's address space |
* - ARG4 - size of receiving buffer in bytes |
* |
* on answer, the kernel will set: |
* |
* - ARG1 - actual size in bytes of data read |
* - ARG2 - total size in bytes of data available |
* |
* or, on error, retval will be |
* - ENOENT - thread does not exist |
* - EBUSY - register state not available |
101,13 → 95,7 |
* |
* - ARG2 - thread identification |
* - ARG3 - source address in the caller's address space |
* - ARG4 - size of source data in bytes |
* |
* on answer, the kernel will set: |
* |
* - ARG1 - actual size in bytes of data copied |
* - ARG2 - max size in bytes that could have been copied |
* |
* or, on error, retval will be |
* - ENOENT - thread does not exist |
* - EBUSY - register state not available |
/branches/tracing/kernel/generic/include/udebug/udebug_ops.h |
---|
47,7 → 47,7 |
int udebug_thread_read(void **buffer, size_t buf_size, size_t *n); |
int udebug_args_read(thread_t *t, void **buffer); |
int udebug_regs_read(thread_t *t, void **buffer, size_t *n); |
int udebug_regs_read(thread_t *t, void *buffer); |
int udebug_regs_write(thread_t *t, void *buffer); |
int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer); |
/branches/tracing/kernel/generic/src/udebug/udebug_ipc.c |
---|
56,9 → 56,7 |
klog_printf("debug_regs_write()"); |
uspace_data = (void *)IPC_GET_ARG3(call->data); |
to_copy = IPC_GET_ARG4(call->data); |
if (to_copy > sizeof(istate_t)) to_copy = sizeof(istate_t); |
to_copy = sizeof(istate_t); |
buffer = malloc(to_copy, 0); |
rc = copy_from_uspace(buffer, uspace_data, to_copy); |
277,17 → 275,15 |
thread_t *t; |
unative_t uspace_addr; |
unative_t to_copy; |
unative_t buf_size; |
unative_t total_bytes; |
void *buffer; |
int rc; |
size_t n; |
klog_printf("debug_regs_read()"); |
t = (thread_t *) IPC_GET_ARG2(call->data); |
buffer = malloc(sizeof(istate_t), 0); |
rc = udebug_regs_read(t, &buffer, &n); |
rc = udebug_regs_read(t, buffer); |
if (rc < 0) { |
IPC_SET_RETVAL(call->data, rc); |
ipc_answer(&TASK->kernel_box, call); |
299,15 → 295,8 |
*/ |
uspace_addr = IPC_GET_ARG3(call->data); |
buf_size = IPC_GET_ARG4(call->data); |
to_copy = sizeof(istate_t); |
total_bytes = n; |
if (buf_size > total_bytes) |
to_copy = total_bytes; |
else |
to_copy = buf_size; |
IPC_SET_RETVAL(call->data, 0); |
/* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that |
same code in process_answer() can be used |
315,7 → 304,6 |
IPC_SET_ARG1(call->data, uspace_addr); |
IPC_SET_ARG2(call->data, to_copy); |
IPC_SET_ARG3(call->data, total_bytes); |
call->buffer = buffer; |
ipc_answer(&TASK->kernel_box, call); |
325,14 → 313,11 |
{ |
thread_t *t; |
void *uspace_data; |
unative_t to_copy; |
int rc; |
t = (thread_t *) IPC_GET_ARG2(call->data); |
uspace_data = (void *)IPC_GET_ARG3(call->data); |
to_copy = IPC_GET_ARG4(call->data); |
t = (thread_t *) IPC_GET_ARG2(call->data); |
rc = udebug_regs_write(t, call->buffer); |
if (rc < 0) { |
IPC_SET_RETVAL(call->data, rc); |
342,9 → 327,6 |
/* Set answer values */ |
IPC_SET_ARG1(call->data, to_copy); |
IPC_SET_ARG2(call->data, sizeof(istate_t)); |
IPC_SET_RETVAL(call->data, 0); |
free(call->buffer); |
call->buffer = NULL; |
/branches/tracing/kernel/generic/src/udebug/udebug_ops.c |
---|
415,18 → 415,14 |
return 0; |
} |
int udebug_regs_read(thread_t *t, void **buffer, size_t *n) |
int udebug_regs_read(thread_t *t, void *buffer) |
{ |
istate_t *state; |
void *regs_buffer; |
int rc; |
ipl_t ipl; |
klog_printf("udebug_regs_read()"); |
/* Prepare a buffer to hold the registers */ |
regs_buffer = malloc(sizeof(istate_t), 0); |
ipl = interrupts_disable(); |
/* On success, this will lock t->debug_lock */ |
445,14 → 441,11 |
} |
/* Copy to the allocated buffer */ |
memcpy(regs_buffer, state, sizeof(istate_t)); |
memcpy(buffer, state, sizeof(istate_t)); |
_thread_op_end(t); |
interrupts_restore(ipl); |
*buffer = regs_buffer; |
*n = sizeof(istate_t); |
return 0; |
} |
471,6 → 464,7 |
/* On success, this will lock t->debug_lock */ |
rc = _thread_op_begin(t, false); |
if (rc != EOK) { |
klog_printf("error locking thread"); |
interrupts_restore(ipl); |
return rc; |
} |
484,7 → 478,7 |
return EBUSY; |
} |
memcpy(t->uspace_state, buffer, sizeof(t->uspace_state)); |
memcpy(t->uspace_state, buffer, sizeof(istate_t)); |
_thread_op_end(t); |
interrupts_restore(ipl); |