Changeset 13dbaa8c in mainline


Ignore:
Timestamp:
2012-08-21T21:37:54Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b1e6269
Parents:
1b186ed
Message:

Factor out dealing with call→buffer from process_answer() to
respective IPC_M_CONNECT_ME_TO and IPC_M_DEBUG ops routines.

Location:
kernel/generic/src/ipc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ops/dataread.c

    r1b186ed r13dbaa8c  
    9191}
    9292
     93static int answer_process(call_t *answer)
     94{
     95        if (answer->buffer) {
     96                uintptr_t dst = IPC_GET_ARG1(answer->data);
     97                size_t size = IPC_GET_ARG2(answer->data);
     98                int rc;
     99
     100                rc = copy_to_uspace((void *) dst, answer->buffer, size);
     101                if (rc)
     102                        IPC_SET_RETVAL(answer->data, rc);
     103        }
     104
     105        return EOK;
     106}
     107
    93108sysipc_ops_t ipc_m_data_read_ops = {
    94109        .request_preprocess = request_preprocess,
    95110        .request_process = null_request_process,
    96111        .answer_preprocess = answer_preprocess,
    97         .answer_process = null_answer_process,
     112        .answer_process = answer_process,
    98113};
    99114
  • kernel/generic/src/ipc/ops/debug.c

    r1b186ed r13dbaa8c  
    3636#include <ipc/ipc.h>
    3737#include <udebug/udebug_ipc.h>
     38#include <syscall/copy.h>
     39#include <abi/errno.h>
    3840
    3941static int request_process(call_t *call, answerbox_t *box)
    4042{
    4143        return -1;
     44}
     45
     46static int answer_process(call_t *answer)
     47{
     48        if (answer->buffer) {
     49                uintptr_t dst = IPC_GET_ARG1(answer->data);
     50                size_t size = IPC_GET_ARG2(answer->data);
     51                int rc;
     52
     53                rc = copy_to_uspace((void *) dst, answer->buffer, size);
     54                if (rc)
     55                        IPC_SET_RETVAL(answer->data, rc);
     56        }
     57
     58        return EOK;
    4259}
    4360
     
    5067        .request_process = request_process,
    5168        .answer_preprocess = null_answer_preprocess,
    52         .answer_process = null_answer_process,
     69        .answer_process = answer_process,
    5370};
    5471
  • kernel/generic/src/ipc/sysipc.c

    r1b186ed r13dbaa8c  
    243243                IPC_SET_RETVAL(call->data, EFORWARD);
    244244       
    245         if (call->buffer) {
    246                 /*
    247                  * This must be an affirmative answer to IPC_M_DATA_READ
    248                  * or IPC_M_DEBUG/UDEBUG_M_MEM_READ...
    249                  *
    250                  */
    251                 uintptr_t dst = IPC_GET_ARG1(call->data);
    252                 size_t size = IPC_GET_ARG2(call->data);
    253                 int rc = copy_to_uspace((void *) dst, call->buffer, size);
    254                 if (rc)
    255                         IPC_SET_RETVAL(call->data, rc);
    256                 free(call->buffer);
    257                 call->buffer = NULL;
    258         }
    259 
    260245        sysipc_ops_t *ops = sysipc_ops_get(call->request_method);
    261246        if (ops->answer_process)
Note: See TracChangeset for help on using the changeset viewer.