Changeset 286e03d in mainline


Ignore:
Timestamp:
2006-03-15T11:44:26Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8965838e
Parents:
91d5ad6
Message:

Added support for taskid.

Location:
generic
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • generic/include/ipc/ipc.h

    r91d5ad6 r286e03d  
    8484        answerbox_t *callerbox;
    8585        int flags;
     86        task_t *sender;
    8687        __native data[IPC_CALL_LEN];
    8788} call_t;
  • generic/include/proc/task.h

    r91d5ad6 r286e03d  
    4141        link_t tasks_link;      /**< Link to other tasks within the system. */
    4242        as_t *as;               /**< Address space. */
     43        task_id_t taskid;           /**< Unique identity of task */
     44
    4345        /* IPC stuff */
    4446        answerbox_t answerbox;  /**< Communication endpoint */
  • generic/include/syscall/syscall.h

    r91d5ad6 r286e03d  
    3838        SYS_IPC_CALL_ASYNC_FAST,
    3939        SYS_IPC_CALL_ASYNC,
     40        SYS_IPC_ANSWER_FAST,
    4041        SYS_IPC_ANSWER,
    4142        SYS_IPC_WAIT,
  • generic/include/typedefs.h

    r91d5ad6 r286e03d  
    3838typedef unsigned long count_t;
    3939typedef unsigned long index_t;
     40
     41typedef unsigned long long task_id_t;
    4042
    4143typedef struct config config_t;
  • generic/src/ipc/ipc.c

    r91d5ad6 r286e03d  
    6262        memsetb((__address)call, sizeof(*call), 0);
    6363        call->callerbox = &TASK->answerbox;
     64        call->sender = TASK;
    6465
    6566        return call;
  • generic/src/proc/task.c

    r91d5ad6 r286e03d  
    4545SPINLOCK_INITIALIZE(tasks_lock);
    4646LIST_INITIALIZE(tasks_head);
     47static task_id_t task_counter = 0;
    4748
    4849/** Initialize tasks
     
    8687        ipl = interrupts_disable();
    8788        spinlock_lock(&tasks_lock);
     89
     90        ta->taskid = ++task_counter;
    8891        list_append(&ta->tasks_link, &tasks_head);
     92
    8993        spinlock_unlock(&tasks_lock);
    9094        interrupts_restore(ipl);
  • generic/src/syscall/syscall.c

    r91d5ad6 r286e03d  
    9898
    9999/** Synchronous IPC call allowing to send whole message */
    100 static __native sys_ipc_call_sync(__native phoneid, __native *data)
     100static __native sys_ipc_call_sync(__native phoneid, __native *question,
     101                                  __native *reply)
    101102{
    102103        call_t call;
     
    109110
    110111        ipc_call_init(&call);
    111         copy_from_uspace(&call.data, data, sizeof(call.data));
     112        copy_from_uspace(&call.data, question, sizeof(call.data));
    112113       
    113114        ipc_call_sync(phone, &call);
    114115
    115         copy_to_uspace(data, &call.data, sizeof(call.data));
     116        copy_to_uspace(reply, &call.data, sizeof(call.data));
    116117
    117118        return 0;
     
    185186
    186187/** Send IPC answer */
    187 static __native sys_ipc_answer(__native callid, __native retval, __native arg1,
    188                               __native arg2)
     188static __native sys_ipc_answer_fast(__native callid, __native retval,
     189                                    __native arg1, __native arg2)
    189190{
    190191        call_t *call;
     
    203204}
    204205
     206/** Send IPC answer */
     207static __native sys_ipc_answer(__native callid, __native *data)
     208{
     209        call_t *call;
     210
     211        /* Check that the user is not sending us answer callid */
     212        ASSERT(! (callid & 1));
     213        /* TODO: Check that the callid is in the dispatch table */
     214        call = (call_t *) callid;
     215        copy_from_uspace(&call->data, data, sizeof(call->data));
     216        ipc_answer(&TASK->answerbox, call);
     217
     218        return 0;
     219}
     220
    205221/** Wait for incoming ipc call or answer
    206222 *
     
    209225 * @return Callid, if callid & 1, then the call is answer
    210226 */
    211 static __native sys_ipc_wait_for_call(__native *calldata, __native flags)
     227static __native sys_ipc_wait_for_call(__native *calldata, task_id_t *taskid,
     228                                      __native flags)
    212229{
    213230        call_t *call;
     
    223240                return ((__native)call) | IPC_CALLID_ANSWERED;
    224241        }
     242        copy_to_uspace(taskid, (void *)&TASK->taskid, sizeof(TASK->taskid));
    225243        return (__native)call;
    226244}
     
    239257        sys_ipc_call_async_fast,
    240258        sys_ipc_call_async,
     259        sys_ipc_answer_fast,
    241260        sys_ipc_answer,
    242261        sys_ipc_wait_for_call
Note: See TracChangeset for help on using the changeset viewer.