Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1004 → Rev 1005

/kernel/trunk/generic/include/proc/task.h
40,6 → 40,8
link_t th_head; /**< List of threads contained in this task. */
link_t tasks_link; /**< Link to other tasks within the system. */
as_t *as; /**< Address space. */
task_id_t taskid; /**< Unique identity of task */
 
/* IPC stuff */
answerbox_t answerbox; /**< Communication endpoint */
phone_t phones[IPC_MAX_PHONES];
/kernel/trunk/generic/include/typedefs.h
38,6 → 38,8
typedef unsigned long count_t;
typedef unsigned long index_t;
 
typedef unsigned long long task_id_t;
 
typedef struct config config_t;
typedef struct cpu_info cpu_info_t;
 
/kernel/trunk/generic/include/syscall/syscall.h
37,6 → 37,7
SYS_IPC_CALL_SYNC,
SYS_IPC_CALL_ASYNC_FAST,
SYS_IPC_CALL_ASYNC,
SYS_IPC_ANSWER_FAST,
SYS_IPC_ANSWER,
SYS_IPC_WAIT,
SYSCALL_END
/kernel/trunk/generic/include/ipc/ipc.h
83,6 → 83,7
link_t list;
answerbox_t *callerbox;
int flags;
task_t *sender;
__native data[IPC_CALL_LEN];
} call_t;
 
/kernel/trunk/generic/src/proc/task.c
44,6 → 44,7
 
SPINLOCK_INITIALIZE(tasks_lock);
LIST_INITIALIZE(tasks_head);
static task_id_t task_counter = 0;
 
/** Initialize tasks
*
85,7 → 86,10
ipl = interrupts_disable();
spinlock_lock(&tasks_lock);
 
ta->taskid = ++task_counter;
list_append(&ta->tasks_link, &tasks_head);
 
spinlock_unlock(&tasks_lock);
interrupts_restore(ipl);
 
/kernel/trunk/generic/src/syscall/syscall.c
97,7 → 97,8
}
 
/** Synchronous IPC call allowing to send whole message */
static __native sys_ipc_call_sync(__native phoneid, __native *data)
static __native sys_ipc_call_sync(__native phoneid, __native *question,
__native *reply)
{
call_t call;
phone_t *phone;
108,11 → 109,11
return IPC_CALLRET_FATAL;
 
ipc_call_init(&call);
copy_from_uspace(&call.data, data, sizeof(call.data));
copy_from_uspace(&call.data, question, sizeof(call.data));
ipc_call_sync(phone, &call);
 
copy_to_uspace(data, &call.data, sizeof(call.data));
copy_to_uspace(reply, &call.data, sizeof(call.data));
 
return 0;
}
184,8 → 185,8
 
 
/** Send IPC answer */
static __native sys_ipc_answer(__native callid, __native retval, __native arg1,
__native arg2)
static __native sys_ipc_answer_fast(__native callid, __native retval,
__native arg1, __native arg2)
{
call_t *call;
 
202,6 → 203,21
return 0;
}
 
/** Send IPC answer */
static __native sys_ipc_answer(__native callid, __native *data)
{
call_t *call;
 
/* Check that the user is not sending us answer callid */
ASSERT(! (callid & 1));
/* TODO: Check that the callid is in the dispatch table */
call = (call_t *) callid;
copy_from_uspace(&call->data, data, sizeof(call->data));
ipc_answer(&TASK->answerbox, call);
 
return 0;
}
 
/** Wait for incoming ipc call or answer
*
* @param result
208,7 → 224,8
* @param flags
* @return Callid, if callid & 1, then the call is answer
*/
static __native sys_ipc_wait_for_call(__native *calldata, __native flags)
static __native sys_ipc_wait_for_call(__native *calldata, task_id_t *taskid,
__native flags)
{
call_t *call;
222,6 → 239,7
atomic_dec(&TASK->active_calls);
return ((__native)call) | IPC_CALLID_ANSWERED;
}
copy_to_uspace(taskid, (void *)&TASK->taskid, sizeof(TASK->taskid));
return (__native)call;
}
 
238,6 → 256,7
sys_ipc_call_sync,
sys_ipc_call_async_fast,
sys_ipc_call_async,
sys_ipc_answer_fast,
sys_ipc_answer,
sys_ipc_wait_for_call
};
/kernel/trunk/generic/src/ipc/ipc.c
61,6 → 61,7
call = slab_alloc(ipc_call_slab, 0);
memsetb((__address)call, sizeof(*call), 0);
call->callerbox = &TASK->answerbox;
call->sender = TASK;
 
return call;
}