Changeset 631ca4d in mainline


Ignore:
Timestamp:
2006-03-13T20:51:35Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5c089c3a
Parents:
25d7709
Message:

New synchronous ipc.
Widened syscall to support up to 5 parameters.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/syscall.h

    r25d7709 r631ca4d  
    3232#include <arch/types.h>
    3333
    34 extern __native syscall_handler(__native id, __native a1, __native a2, __native a3);
     34extern __native syscall_handler(__native a1,__native a2, __native a3,
     35                                __native a4, __native id);
    3536extern void syscall_setup_cpu(void);
    3637
  • arch/amd64/src/syscall.c

    r25d7709 r631ca4d  
    6464/** Dispatch system call */
    6565__native syscall_handler(__native a1, __native a2, __native a3,
    66                          __native id)
     66                         __native a4, __native id)
    6767{
    6868        if (id < SYSCALL_END)
    69                 return syscall_table[id](a1,a2,a3);
     69                return syscall_table[id](a1,a2,a3,a4);
    7070        else
    7171                panic("Undefined syscall %d", id);
  • arch/ia32/src/interrupt.c

    r25d7709 r631ca4d  
    108108{
    109109        interrupts_enable();
    110         if (istate->edx < SYSCALL_END)
    111                 istate->eax = syscall_table[istate->edx](istate->eax, istate->ebx, istate->ecx);
     110        if (istate->esi < SYSCALL_END)
     111                istate->eax = syscall_table[istate->esi](istate->eax, istate->ebx, istate->ecx, istate->edx);
    112112        else
    113                 panic("Undefined syscall %d", istate->edx);
     113                panic("Undefined syscall %d", istate->esi);
    114114        interrupts_disable();
    115115}
  • arch/mips32/src/exception.c

    r25d7709 r631ca4d  
    135135{
    136136        interrupts_enable();
    137         if (istate->a3 < SYSCALL_END)
    138                 istate->v0 = syscall_table[istate->a3](istate->a0,
     137        if (istate->t0 < SYSCALL_END)
     138                istate->v0 = syscall_table[istate->t0](istate->a0,
    139139                                                       istate->a1,
    140                                                        istate->a2);
     140                                                       istate->a2,
     141                                                       istate->a3);
    141142        else
    142143                panic("Undefined syscall %d", istate->a3);
  • generic/include/ipc/ipc.h

    r25d7709 r631ca4d  
    7878extern void ipc_answer(answerbox_t *box, call_t *request);
    7979extern void ipc_call(phone_t *phone, call_t *request);
     80extern void ipc_call_sync(phone_t *phone, call_t *request);
    8081extern void ipc_phone_destroy(phone_t *phone);
    8182extern void ipc_phone_init(phone_t *phone, answerbox_t *box);
  • generic/include/syscall/syscall.h

    r25d7709 r631ca4d  
    3232typedef enum {
    3333        SYS_CTL = 0,
    34         SYS_IO  = 1,
    35         SYS_IPC_CALL = 2,
    36         SYS_IPC_ANSWER = 3,
    37         SYS_IPC_WAIT = 4,
     34        SYS_IO,
     35        SYS_IPC_CALL_SYNC,
     36        SYS_IPC_CALL_ASYNC,
     37        SYS_IPC_ANSWER,
     38        SYS_IPC_WAIT,
    3839        SYSCALL_END
    3940} syscall_t;
  • generic/src/ipc/ipc.c

    r25d7709 r631ca4d  
    106106}
    107107
    108 
    109 /** Send a request using phone to answerbox
     108/** Helper function to facilitate synchronous calls */
     109void ipc_call_sync(phone_t *phone, call_t *request)
     110{
     111        answerbox_t sync_box;
     112
     113        ipc_answerbox_init(&sync_box);
     114
     115        /* We will receive data on special box */
     116        request->callerbox = &sync_box;
     117
     118        ipc_call(phone, request);
     119        ipc_wait_for_call(&sync_box, 0);
     120}
     121
     122/** Send a asynchronous request using phone to answerbox
    110123 *
    111124 * @param phone Phone connected to answerbox
     
    200213                printf("Received phone call - %P %P\n",
    201214                       call->data[0], call->data[1]);
     215                call->data[0] = 0xbabaaaee;;
     216                call->data[1] = 0xaaaaeeee;
    202217                ipc_answer(&TASK->answerbox, call);
    203218                printf("Call answered.\n");
  • generic/src/syscall/syscall.c

    r25d7709 r631ca4d  
    5656}
    5757
    58 /** Send a call over syscall
     58/** Send a call over IPC, wait for reply, return to user
    5959 *
    6060 * @return Call identification, returns -1 on fatal error,
    6161           -2 on 'Too many async request, handle answers first
    6262 */
    63 static __native sys_ipc_call(__native phoneid, __native arg1, __native arg2)
     63static __native sys_ipc_call_sync(__native phoneid, __native arg1,
     64                                   __native arg2, __native *respdata)
     65{
     66        call_t *call;
     67        phone_t *phone;
     68        /* Special answerbox for synchronous messages */
     69
     70        if (phoneid >= IPC_MAX_PHONES)
     71                return -ENOENT;
     72
     73        phone = &TASK->phones[phoneid];
     74        if (!phone->callee)
     75                return -ENOENT;
     76
     77        call = ipc_call_alloc();
     78        call->data[0] = arg1;
     79        call->data[1] = arg2;
     80       
     81        ipc_call_sync(phone, call);
     82
     83        copy_to_uspace(respdata, &call->data, sizeof(__native) * IPC_CALL_LEN);
     84
     85        return 0;
     86}
     87
     88/** Send an asynchronous call over ipc
     89 *
     90 * @return Call identification, returns -1 on fatal error,
     91           -2 on 'Too many async request, handle answers first
     92 */
     93static __native sys_ipc_call_async(__native phoneid, __native arg1,
     94                                   __native arg2)
    6495{
    6596        call_t *call;
     
    125156        sys_ctl,
    126157        sys_io,
    127         sys_ipc_call,
     158        sys_ipc_call_sync,
     159        sys_ipc_call_async,
    128160        sys_ipc_answer,
    129161        sys_ipc_wait_for_call
Note: See TracChangeset for help on using the changeset viewer.