Subversion Repositories HelenOS

Rev

Rev 2813 | Rev 2816 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2813 Rev 2815
Line 8... Line 8...
8
 */
8
 */
9
 
9
 
10
#include <console/klog.h>
10
#include <console/klog.h>
11
#include <proc/task.h>
11
#include <proc/task.h>
12
#include <proc/thread.h>
12
#include <proc/thread.h>
-
 
13
#include <arch.h>
13
#include <errno.h>
14
#include <errno.h>
14
#include <ipc/ipc.h>
15
#include <ipc/ipc.h>
15
#include <syscall/copy.h>
16
#include <syscall/copy.h>
16
#include <udebug/udebug.h>
17
#include <udebug/udebug.h>
17
#include <udebug/udebug_ipc.h>
18
#include <udebug/udebug_ipc.h>
Line 219... Line 220...
219
    }
220
    }
220
 
221
 
221
    return 0;
222
    return 0;
222
}
223
}
223
 
224
 
-
 
225
static void udebug_receive_mem_read(call_t *call)
-
 
226
{
-
 
227
    unative_t uspace_dst;
-
 
228
    void *uspace_ptr;
-
 
229
    unsigned size;
-
 
230
    void *buffer;
-
 
231
    int rc;
-
 
232
 
-
 
233
    klog_printf("debug_mem_read()");
-
 
234
    uspace_dst = IPC_GET_ARG2(call->data);
-
 
235
    uspace_ptr = (void *)IPC_GET_ARG3(call->data);
-
 
236
    size = IPC_GET_ARG4(call->data);
-
 
237
 
-
 
238
    buffer = malloc(size, 0); // ???
-
 
239
    klog_printf("debug_mem_read: src=%u, size=%u", uspace_ptr, size);
-
 
240
 
-
 
241
    /* NOTE: this is not strictly from a syscall... but that shouldn't
-
 
242
     * be a problem */
-
 
243
    rc = copy_from_uspace(buffer, uspace_ptr, size);
-
 
244
    if (rc) {
-
 
245
        IPC_SET_RETVAL(call->data, rc);
-
 
246
        return;
-
 
247
    }
-
 
248
 
-
 
249
    klog_printf("first word: %u", *((unative_t *)buffer));
-
 
250
 
-
 
251
    IPC_SET_RETVAL(call->data, 0);
-
 
252
    /* Hack: ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-
 
253
       same code in process_answer() can be used
-
 
254
       (no way to distinguish method in answer) */
-
 
255
    IPC_SET_ARG1(call->data, uspace_dst);
-
 
256
    IPC_SET_ARG2(call->data, size);
-
 
257
    call->buffer = buffer;
-
 
258
 
-
 
259
    ipc_answer(&TASK->kernel_box, call);
-
 
260
}
-
 
261
 
-
 
262
/**
-
 
263
 * Handle a debug call received on the kernel answerbox.
-
 
264
 *
-
 
265
 * This is called by the kbox servicing thread.
-
 
266
 */
-
 
267
void udebug_call_receive(call_t *call)
-
 
268
{
-
 
269
    int debug_method;
-
 
270
 
-
 
271
    debug_method = IPC_GET_ARG1(call->data);
-
 
272
 
-
 
273
    switch (debug_method) {
-
 
274
    case UDEBUG_M_MEM_READ:
-
 
275
        udebug_receive_mem_read(call);
-
 
276
        break;
-
 
277
    }
-
 
278
}
224
 
279
 
225
/** @}
280
/** @}
226
 */
281
 */