Changeset e3c762cd in mainline for generic/src/ipc


Ignore:
Timestamp:
2006-05-05T11:59:19Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
de07bcf
Parents:
22cf454d
Message:

Complete implementation of copy_from_uspace() and copy_to_uspace()
for amd64 and ia32. Other architectures still compile and run,
but need to implement their own assembly-only memcpy(), memcpy_from_uspace(),
memcpy_to_uspace() and their failover parts. For these architectures
only dummy implementations are provided.

Location:
generic/src/ipc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/src/ipc/irq.c

    r22cf454d re3c762cd  
    4848#include <ipc/irq.h>
    4949#include <atomic.h>
     50#include <syscall/copy.h>
    5051
    5152typedef struct {
     
    121122        irq_code_t *code;
    122123        irq_cmd_t *ucmds;
     124        int rc;
    123125
    124126        code = malloc(sizeof(*code), 0);
    125         copy_from_uspace(code, ucode, sizeof(*code));
     127        rc = copy_from_uspace(code, ucode, sizeof(*code));
     128        if (rc != 0) {
     129                free(code);
     130                return NULL;
     131        }
    126132       
    127133        if (code->cmdcount > IRQ_MAX_PROG_SIZE) {
     
    131137        ucmds = code->cmds;
    132138        code->cmds = malloc(sizeof(code->cmds[0]) * (code->cmdcount), 0);
    133         copy_from_uspace(code->cmds, ucmds, sizeof(code->cmds[0]) * (code->cmdcount));
     139        rc = copy_from_uspace(code->cmds, ucmds, sizeof(code->cmds[0]) * (code->cmdcount));
     140        if (rc != 0) {
     141                free(code->cmds);
     142                free(code);
     143                return NULL;
     144        }
    134145
    135146        return code;
  • generic/src/ipc/sysipc.c

    r22cf454d re3c762cd  
    2929#include <arch.h>
    3030#include <proc/task.h>
    31 
     31#include <proc/thread.h>
    3232#include <errno.h>
    33 #include <mm/page.h>
    3433#include <memstr.h>
    3534#include <debug.h>
     
    3938#include <ipc/ipcrsc.h>
    4039#include <arch/interrupt.h>
    41 
    4240#include <print.h>
    43 #include <arch.h>
    44 #include <proc/thread.h>
     41#include <syscall/copy.h>
    4542
    4643#define GET_CHECK_PHONE(phone,phoneid,err) { \
     
    229226        phone_t *phone;
    230227        int res;
     228        int rc;
    231229
    232230        ipc_call_static_init(&call);
    233         copy_from_uspace(&call.data.args, &question->args, sizeof(call.data.args));
     231        rc = copy_from_uspace(&call.data.args, &question->args, sizeof(call.data.args));
     232        if (rc != 0)
     233                return (__native) rc;
    234234
    235235        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     
    241241                IPC_SET_RETVAL(call.data, res);
    242242
    243         STRUCT_TO_USPACE(&reply->args, &call.data.args);
     243        rc = STRUCT_TO_USPACE(&reply->args, &call.data.args);
     244        if (rc != 0)
     245                return rc;
    244246
    245247        return 0;
     
    298300        phone_t *phone;
    299301        int res;
     302        int rc;
    300303
    301304        if (check_call_limit())
     
    305308
    306309        call = ipc_call_alloc(0);
    307         copy_from_uspace(&call->data.args, &data->args, sizeof(call->data.args));
     310        rc = copy_from_uspace(&call->data.args, &data->args, sizeof(call->data.args));
     311        if (rc != 0)
     312                return (__native) rc;
    308313        if (!(res=request_preprocess(call)))
    309314                ipc_call(phone, call);
     
    394399        ipc_data_t saved_data;
    395400        int saveddata = 0;
     401        int rc;
    396402
    397403        call = get_call(callid);
     
    403409                saveddata = 1;
    404410        }
    405         copy_from_uspace(&call->data.args, &data->args,
     411        rc = copy_from_uspace(&call->data.args, &data->args,
    406412                         sizeof(call->data.args));
     413        if (rc != 0)
     414                return rc;
    407415
    408416        answer_preprocess(call, saveddata ? &saved_data : NULL);
Note: See TracChangeset for help on using the changeset viewer.