Subversion Repositories HelenOS

Rev

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

Rev 2896 Rev 2897
Line 173... Line 173...
173
    unsigned buf_size;
173
    unsigned buf_size;
174
    void *buffer;
174
    void *buffer;
175
    size_t n;
175
    size_t n;
176
    int rc;
176
    int rc;
177
 
177
 
-
 
178
    uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */
-
 
179
    buf_size = IPC_GET_ARG3(call->data);    /* Dest. buffer size */
-
 
180
 
-
 
181
    /*
-
 
182
     * Read thread list. Variable n will be filled with actual number
-
 
183
     * of threads times thread-id size.
-
 
184
     */
178
    rc = udebug_thread_read(&buffer, &n);
185
    rc = udebug_thread_read(&buffer, buf_size, &n);
179
    if (rc < 0) {
186
    if (rc < 0) {
180
        IPC_SET_RETVAL(call->data, rc);
187
        IPC_SET_RETVAL(call->data, rc);
181
        ipc_answer(&TASK->kernel_box, call);
188
        ipc_answer(&TASK->kernel_box, call);
182
        return;
189
        return;
183
    }
190
    }
184
 
191
 
185
    /*
-
 
186
     * Make use of call->buffer to transfer data to caller's userspace
-
 
187
     */
-
 
188
 
-
 
189
    uspace_addr = IPC_GET_ARG2(call->data);
-
 
190
    buf_size = IPC_GET_ARG3(call->data);
-
 
191
 
-
 
192
    total_bytes = n;
192
    total_bytes = n;
193
 
193
 
-
 
194
    /* Copy MAX(buf_size, total_bytes) bytes */
-
 
195
 
194
    if (buf_size > total_bytes)
196
    if (buf_size > total_bytes)
195
        to_copy = total_bytes;
197
        to_copy = total_bytes;
196
    else
198
    else
197
        to_copy = buf_size;
199
        to_copy = buf_size;
198
 
200
 
-
 
201
    /*
-
 
202
     * Make use of call->buffer to transfer data to caller's userspace
-
 
203
     */
-
 
204
 
199
    IPC_SET_RETVAL(call->data, 0);
205
    IPC_SET_RETVAL(call->data, 0);
200
    /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
206
    /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
201
       same code in process_answer() can be used
207
       same code in process_answer() can be used
202
       (no way to distinguish method in answer) */
208
       (no way to distinguish method in answer) */
203
    IPC_SET_ARG1(call->data, uspace_addr);
209
    IPC_SET_ARG1(call->data, uspace_addr);