Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2808 → Rev 2809

/branches/tracing/kernel/generic/include/ipc/ipc.h
252,6 → 252,15
*/
#define IPC_M_DEBUG_THREAD_READ 13
 
/** Read the list of the debugged tasks's memory.
*
* - ARG1 - destination address in the caller's address space
* - ARG2 - source address in the recipient's address space
* - ARG3 - size of receiving buffer in bytes
*
*/
#define IPC_M_DEBUG_MEM_READ 14
 
/* Well-known methods */
#define IPC_M_LAST_SYSTEM 511
#define IPC_M_PING 512
/branches/tracing/kernel/generic/src/ipc/sysipc.c
565,6 → 565,7
 
if (call->buffer) {
/* This must be an affirmative answer to IPC_M_DATA_READ. */
/* or IPC_M_DEBUG_MEM_READ... */
uintptr_t dst = IPC_GET_ARG1(call->data);
size_t size = IPC_GET_ARG2(call->data);
int rc = copy_to_uspace((void *) dst, call->buffer, size);
786,6 → 787,9
ipc_call_free(call);
return (unative_t) rc;
}
if (TASK->being_debugged)
klog_printf("call_async_slow: phone=%u, uspace_ptr=%u, arg0=%u",
phoneid, (unsigned)data, call->data.args[0]);
if (!(res = request_preprocess(call, phone)))
ipc_call(phone, call);
else
/branches/tracing/kernel/generic/src/ipc/ipc.c
608,15 → 608,59
 
#include <ipc/ipcrsc.h>
#include <console/klog.h>
#include <syscall/copy.h>
 
static void debug_mem_read(call_t *call)
{
void *uspace_ptr;
unsigned size;
void *buffer;
int rc;
 
klog_printf("debug_mem_read()");
uspace_ptr = (void *)IPC_GET_ARG2(call->data);
size = IPC_GET_ARG3(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_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;
 
(void)arg;
klog_printf("kbox_thread_proc()");
while (1) {
klog_printf("kbox: wait for call");
ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT,
call = ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT,
SYNCH_FLAGS_NONE);
if (call != NULL) {
method = IPC_GET_METHOD(call->data);
if (method == IPC_M_DEBUG_MEM_READ) {
debug_mem_read(call);
}
}
}
}
 
/branches/tracing/uspace/app/tester/debug/debug1.c
1,5 → 1,6
#include <stdio.h>
#include <unistd.h>
#include <syscall.h>
#include <ipc/ipc.h>
#include "../tester.h"
 
46,6 → 47,7
int phoneid;
int i;
unsigned sc_args[6];
unsigned ipc_args[6];
unsigned copied;
unsigned ev_type;
unsigned sc_id;
90,6 → 92,18
sc_args[3], sc_args[4], sc_args[5],
sc_rc);
}
if (sc_id == SYS_IPC_CALL_ASYNC_SLOW) {
memset(ipc_args, 0, sizeof(ipc_args));
printf("read async call args..\n");
printf("dest=%u, ptr=%u, len=%u\n",
(sysarg_t)ipc_args, sc_args[1], sizeof(ipc_args));
rc = ipc_call_sync_3_0(phoneid, IPC_M_DEBUG_MEM_READ,
(sysarg_t)ipc_args, sc_args[1], sizeof(ipc_args));
printf("-> %d\n", rc);
printf("args: (%u, %u, %u, %u, %u, %u)\n",
ipc_args[0], ipc_args[1], ipc_args[2],
ipc_args[3], ipc_args[4], ipc_args[5]);
}
}
 
printf("done\n");