Rev 2808 | Rev 2812 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2808 | Rev 2809 | ||
---|---|---|---|
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 | ||
- | 613 | static void debug_mem_read(call_t *call) |
|
- | 614 | { |
|
- | 615 | void *uspace_ptr; |
|
- | 616 | unsigned size; |
|
- | 617 | void *buffer; |
|
- | 618 | int rc; |
|
- | 619 | ||
- | 620 | klog_printf("debug_mem_read()"); |
|
- | 621 | uspace_ptr = (void *)IPC_GET_ARG2(call->data); |
|
- | 622 | size = IPC_GET_ARG3(call->data); |
|
- | 623 | ||
- | 624 | buffer = malloc(size, 0); // ??? |
|
- | 625 | klog_printf("debug_mem_read: src=%u, size=%u", uspace_ptr, size); |
|
- | 626 | ||
- | 627 | /* NOTE: this is not strictly from a syscall... but that shouldn't |
|
- | 628 | * be a problem */ |
|
- | 629 | rc = copy_from_uspace(buffer, uspace_ptr, size); |
|
- | 630 | if (rc) { |
|
- | 631 | IPC_SET_RETVAL(call->data, rc); |
|
- | 632 | return; |
|
- | 633 | } |
|
- | 634 | ||
- | 635 | klog_printf("first word: %u", *((unative_t *)buffer)); |
|
- | 636 | ||
- | 637 | IPC_SET_RETVAL(call->data, 0); |
|
- | 638 | /* Hack: ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that |
|
- | 639 | same code in process_answer() can be used |
|
- | 640 | (no way to distinguish method in answer) */ |
|
- | 641 | IPC_SET_ARG2(call->data, size); |
|
- | 642 | call->buffer = buffer; |
|
- | 643 | ||
- | 644 | ipc_answer(&TASK->kernel_box, call); |
|
- | 645 | } |
|
611 | 646 | ||
612 | static void kbox_thread_proc(void *arg) |
647 | static void kbox_thread_proc(void *arg) |
613 | { |
648 | { |
- | 649 | call_t *call; |
|
- | 650 | int method; |
|
- | 651 | ||
614 | (void)arg; |
652 | (void)arg; |
615 | klog_printf("kbox_thread_proc()"); |
653 | klog_printf("kbox_thread_proc()"); |
616 | while (1) { |
654 | while (1) { |
617 | klog_printf("kbox: wait for call"); |
655 | klog_printf("kbox: wait for call"); |
618 | ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT, |
656 | call = ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT, |
619 | SYNCH_FLAGS_NONE); |
657 | SYNCH_FLAGS_NONE); |
- | 658 | if (call != NULL) { |
|
- | 659 | method = IPC_GET_METHOD(call->data); |
|
- | 660 | if (method == IPC_M_DEBUG_MEM_READ) { |
|
- | 661 | debug_mem_read(call); |
|
- | 662 | } |
|
- | 663 | } |
|
620 | } |
664 | } |
621 | } |
665 | } |
622 | 666 | ||
623 | /** |
667 | /** |
624 | * Connect phone to a task kernel-box specified by id. |
668 | * Connect phone to a task kernel-box specified by id. |