Subversion Repositories HelenOS

Rev

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

Rev 3014 Rev 3424
Line 33... Line 33...
33
/**
33
/**
34
 * @file
34
 * @file
35
 * @brief   Udebug IPC message handling.
35
 * @brief   Udebug IPC message handling.
36
 */
36
 */
37
 
37
 
38
#include <console/klog.h>
38
#include <print.h>
39
#include <proc/task.h>
39
#include <proc/task.h>
40
#include <proc/thread.h>
40
#include <proc/thread.h>
41
#include <arch.h>
41
#include <arch.h>
42
#include <errno.h>
42
#include <errno.h>
43
#include <ipc/ipc.h>
43
#include <ipc/ipc.h>
Line 51... Line 51...
51
    void *uspace_data;
51
    void *uspace_data;
52
    unative_t to_copy;
52
    unative_t to_copy;
53
    int rc;
53
    int rc;
54
    void *buffer;
54
    void *buffer;
55
 
55
 
56
    klog_printf("debug_regs_write()");
56
    printf("debug_regs_write()\n");
57
 
57
 
58
    uspace_data = (void *)IPC_GET_ARG3(call->data);
58
    uspace_data = (void *)IPC_GET_ARG3(call->data);
59
    to_copy = sizeof(istate_t);
59
    to_copy = sizeof(istate_t);
60
    buffer = malloc(to_copy, 0);
60
    buffer = malloc(to_copy, 0);
61
 
61
 
62
    rc = copy_from_uspace(buffer, uspace_data, to_copy);
62
    rc = copy_from_uspace(buffer, uspace_data, to_copy);
63
    if (rc != 0) {
63
    if (rc != 0) {
64
        klog_printf("debug_regs_write() - copy failed");
64
        printf("debug_regs_write() - copy failed\n");
65
        return rc;
65
        return rc;
66
    }
66
    }
67
 
67
 
68
    call->buffer = buffer;
68
    call->buffer = buffer;
69
 
69
 
70
    klog_printf(" - done");
70
    printf(" - done\n");
71
    return 0;
71
    return 0;
72
}
72
}
73
 
73
 
74
static int udebug_rp_mem_write(call_t *call, phone_t *phone)
74
static int udebug_rp_mem_write(call_t *call, phone_t *phone)
75
{
75
{
76
    void *uspace_data;
76
    void *uspace_data;
77
    unative_t to_copy;
77
    unative_t to_copy;
78
    int rc;
78
    int rc;
79
    void *buffer;
79
    void *buffer;
80
 
80
 
81
    klog_printf("udebug_rp_mem_write()");
81
    printf("udebug_rp_mem_write()\n");
82
 
82
 
83
    uspace_data = (void *)IPC_GET_ARG2(call->data);
83
    uspace_data = (void *)IPC_GET_ARG2(call->data);
84
    to_copy = IPC_GET_ARG4(call->data);
84
    to_copy = IPC_GET_ARG4(call->data);
85
 
85
 
86
    buffer = malloc(to_copy, 0);
86
    buffer = malloc(to_copy, 0);
87
 
87
 
88
    rc = copy_from_uspace(buffer, uspace_data, to_copy);
88
    rc = copy_from_uspace(buffer, uspace_data, to_copy);
89
    if (rc != 0) {
89
    if (rc != 0) {
90
        klog_printf(" - copy failed");
90
        printf(" - copy failed\n");
91
        return rc;
91
        return rc;
92
    }
92
    }
93
 
93
 
94
    call->buffer = buffer;
94
    call->buffer = buffer;
95
 
95
 
96
    klog_printf(" - done");
96
    printf(" - done\n");
97
    return 0;
97
    return 0;
98
}
98
}
99
 
99
 
100
 
100
 
101
int udebug_request_preprocess(call_t *call, phone_t *phone)
101
int udebug_request_preprocess(call_t *call, phone_t *phone)
Line 159... Line 159...
159
static void udebug_receive_go(call_t *call)
159
static void udebug_receive_go(call_t *call)
160
{
160
{
161
    thread_t *t;
161
    thread_t *t;
162
    int rc;
162
    int rc;
163
 
163
 
164
    //klog_printf("debug_go()");
164
    //printf("debug_go()\n");
165
 
165
 
166
    t = (thread_t *)IPC_GET_ARG2(call->data);
166
    t = (thread_t *)IPC_GET_ARG2(call->data);
167
 
167
 
168
    rc = udebug_go(t, call);
168
    rc = udebug_go(t, call);
169
    if (rc < 0) {
169
    if (rc < 0) {
Line 176... Line 176...
176
static void udebug_receive_stop(call_t *call)
176
static void udebug_receive_stop(call_t *call)
177
{
177
{
178
    thread_t *t;
178
    thread_t *t;
179
    int rc;
179
    int rc;
180
 
180
 
181
    klog_printf("debug_stop()");
181
    printf("debug_stop()\n");
182
 
182
 
183
    t = (thread_t *)IPC_GET_ARG2(call->data);
183
    t = (thread_t *)IPC_GET_ARG2(call->data);
184
 
184
 
185
    rc = udebug_stop(t, call);
185
    rc = udebug_stop(t, call);
186
    IPC_SET_RETVAL(call->data, rc);
186
    IPC_SET_RETVAL(call->data, rc);
Line 276... Line 276...
276
    unative_t uspace_addr;
276
    unative_t uspace_addr;
277
    unative_t to_copy;
277
    unative_t to_copy;
278
    void *buffer;
278
    void *buffer;
279
    int rc;
279
    int rc;
280
 
280
 
281
    klog_printf("debug_regs_read()");
281
    printf("debug_regs_read()\n");
282
 
282
 
283
    t = (thread_t *) IPC_GET_ARG2(call->data);
283
    t = (thread_t *) IPC_GET_ARG2(call->data);
284
    buffer = malloc(sizeof(istate_t), 0);
284
    buffer = malloc(sizeof(istate_t), 0);
285
 
285
 
286
    rc = udebug_regs_read(t, buffer);
286
    rc = udebug_regs_read(t, buffer);
Line 369... Line 369...
369
{
369
{
370
    unative_t uspace_dst;
370
    unative_t uspace_dst;
371
    unsigned size;
371
    unsigned size;
372
    int rc;
372
    int rc;
373
 
373
 
374
    klog_printf("udebug_receive_mem_write()");
374
    printf("udebug_receive_mem_write()\n");
375
 
375
 
376
    uspace_dst = IPC_GET_ARG3(call->data);
376
    uspace_dst = IPC_GET_ARG3(call->data);
377
    size = IPC_GET_ARG4(call->data);
377
    size = IPC_GET_ARG4(call->data);
378
 
378
 
379
    rc = udebug_mem_write(uspace_dst, call->buffer, size);
379
    rc = udebug_mem_write(uspace_dst, call->buffer, size);