Subversion Repositories HelenOS

Rev

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

Rev 2809 Rev 2812
Line 607... Line 607...
607
}
607
}
608
 
608
 
609
#include <ipc/ipcrsc.h>
609
#include <ipc/ipcrsc.h>
610
#include <console/klog.h>
610
#include <console/klog.h>
611
#include <syscall/copy.h>
611
#include <syscall/copy.h>
-
 
612
#include <udebug.h>
612
 
613
 
613
static void debug_mem_read(call_t *call)
614
static void debug_mem_read(call_t *call)
614
{
615
{
-
 
616
    unative_t uspace_dst;
615
    void *uspace_ptr;
617
    void *uspace_ptr;
616
    unsigned size;
618
    unsigned size;
617
    void *buffer;
619
    void *buffer;
618
    int rc;
620
    int rc;
619
 
621
 
620
    klog_printf("debug_mem_read()");
622
    klog_printf("debug_mem_read()");
-
 
623
    uspace_dst = IPC_GET_ARG2(call->data);
621
    uspace_ptr = (void *)IPC_GET_ARG2(call->data);
624
    uspace_ptr = (void *)IPC_GET_ARG3(call->data);
622
    size = IPC_GET_ARG3(call->data);
625
    size = IPC_GET_ARG4(call->data);
623
 
626
 
624
    buffer = malloc(size, 0); // ???
627
    buffer = malloc(size, 0); // ???
625
    klog_printf("debug_mem_read: src=%u, size=%u", uspace_ptr, size);
628
    klog_printf("debug_mem_read: src=%u, size=%u", uspace_ptr, size);
626
 
629
 
627
    /* NOTE: this is not strictly from a syscall... but that shouldn't
630
    /* NOTE: this is not strictly from a syscall... but that shouldn't
Line 636... Line 639...
636
 
639
 
637
    IPC_SET_RETVAL(call->data, 0);
640
    IPC_SET_RETVAL(call->data, 0);
638
    /* Hack: ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
641
    /* Hack: ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
639
       same code in process_answer() can be used
642
       same code in process_answer() can be used
640
       (no way to distinguish method in answer) */
643
       (no way to distinguish method in answer) */
-
 
644
    IPC_SET_ARG1(call->data, uspace_dst);
641
    IPC_SET_ARG2(call->data, size);
645
    IPC_SET_ARG2(call->data, size);
642
    call->buffer = buffer;
646
    call->buffer = buffer;
643
 
647
 
644
    ipc_answer(&TASK->kernel_box, call);
648
    ipc_answer(&TASK->kernel_box, call);
645
}
649
}
646
 
650
 
647
static void kbox_thread_proc(void *arg)
651
static void kbox_thread_proc(void *arg)
648
{
652
{
649
    call_t *call;
653
    call_t *call;
650
    int method;
654
    int method;
-
 
655
    int dm;
651
 
656
 
652
    (void)arg;
657
    (void)arg;
653
    klog_printf("kbox_thread_proc()");
658
    klog_printf("kbox_thread_proc()");
654
    while (1) {
659
    while (1) {
655
        klog_printf("kbox: wait for call");
660
        klog_printf("kbox: wait for call");
656
        call = ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT,
661
        call = ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT,
657
            SYNCH_FLAGS_NONE);
662
            SYNCH_FLAGS_NONE);
658
        if (call != NULL) {
663
        if (call != NULL) {
659
            method = IPC_GET_METHOD(call->data);
664
            method = IPC_GET_METHOD(call->data);
-
 
665
            dm = IPC_GET_ARG1(call->data);
-
 
666
 
660
            if (method == IPC_M_DEBUG_MEM_READ) {
667
            if (method == IPC_M_DEBUG_ALL &&
-
 
668
                dm == UDEBUG_M_MEM_READ) {
661
                debug_mem_read(call);
669
                debug_mem_read(call);
662
            }
670
            }
663
        }
671
        }
664
    }
672
    }
665
}
673
}