Subversion Repositories HelenOS

Rev

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

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