Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2814 → Rev 2815

/branches/tracing/kernel/generic/src/ipc/ipc.c
608,51 → 608,12
 
#include <ipc/ipcrsc.h>
#include <console/klog.h>
#include <syscall/copy.h>
#include <udebug/udebug.h>
#include <udebug/udebug_ipc.h>
 
static void debug_mem_read(call_t *call)
{
unative_t uspace_dst;
void *uspace_ptr;
unsigned size;
void *buffer;
int rc;
 
klog_printf("debug_mem_read()");
uspace_dst = IPC_GET_ARG2(call->data);
uspace_ptr = (void *)IPC_GET_ARG3(call->data);
size = IPC_GET_ARG4(call->data);
 
buffer = malloc(size, 0); // ???
klog_printf("debug_mem_read: src=%u, size=%u", uspace_ptr, size);
 
/* NOTE: this is not strictly from a syscall... but that shouldn't
* be a problem */
rc = copy_from_uspace(buffer, uspace_ptr, size);
if (rc) {
IPC_SET_RETVAL(call->data, rc);
return;
}
 
klog_printf("first word: %u", *((unative_t *)buffer));
 
IPC_SET_RETVAL(call->data, 0);
/* Hack: ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
same code in process_answer() can be used
(no way to distinguish method in answer) */
IPC_SET_ARG1(call->data, uspace_dst);
IPC_SET_ARG2(call->data, size);
call->buffer = buffer;
 
ipc_answer(&TASK->kernel_box, call);
}
 
static void kbox_thread_proc(void *arg)
{
call_t *call;
int method;
int dm;
 
(void)arg;
klog_printf("kbox_thread_proc()");
662,11 → 623,9
SYNCH_FLAGS_NONE);
if (call != NULL) {
method = IPC_GET_METHOD(call->data);
dm = IPC_GET_ARG1(call->data);
 
if (method == IPC_M_DEBUG_ALL &&
dm == UDEBUG_M_MEM_READ) {
debug_mem_read(call);
if (method == IPC_M_DEBUG_ALL) {
udebug_call_receive(call);
}
}
}