Changeset 03a8a8e in mainline
- Timestamp:
- 2012-09-15T18:19:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e9fe33b
- Parents:
- c97b086
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
rc97b086 r03a8a8e 65 65 mutex_t lock; 66 66 link_t link; 67 struct task *caller; 67 68 struct answerbox *callee; 68 69 ipc_phone_state_t state; … … 177 178 extern void _ipc_answer_free_call(call_t *, bool); 178 179 179 extern void ipc_phone_init(phone_t * );180 extern void ipc_phone_init(phone_t *, struct task *); 180 181 extern bool ipc_phone_connect(phone_t *, answerbox_t *); 181 182 extern int ipc_phone_hangup(phone_t *); -
kernel/generic/src/ipc/ipc.c
rc97b086 r03a8a8e 76 76 call->active = false; 77 77 call->forget = false; 78 call->sender = TASK;78 call->sender = NULL; 79 79 call->buffer = NULL; 80 80 } … … 175 175 * 176 176 * @param phone Phone structure to be initialized. 177 * 178 */ 179 void ipc_phone_init(phone_t *phone) 177 * @param caller Owning task. 178 * 179 */ 180 void ipc_phone_init(phone_t *phone, task_t *caller) 180 181 { 181 182 mutex_initialize(&phone->lock, MUTEX_PASSIVE); 183 phone->caller = caller; 182 184 phone->callee = NULL; 183 185 phone->state = IPC_PHONE_FREE; … … 265 267 void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err) 266 268 { 269 task_t *caller = phone->caller; 270 267 271 atomic_inc(&phone->active_calls); 268 272 call->caller_phone = phone; 273 call->sender = caller; 269 274 270 275 call->active = true; 271 spinlock_lock(& TASK->active_calls_lock);272 list_append(&call->ta_link, & TASK->active_calls);273 spinlock_unlock(& TASK->active_calls_lock);276 spinlock_lock(&caller->active_calls_lock); 277 list_append(&call->ta_link, &caller->active_calls); 278 spinlock_unlock(&caller->active_calls_lock); 274 279 275 280 call->data.phone = phone; … … 288 293 static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call) 289 294 { 295 task_t *caller = phone->caller; 296 290 297 /* Count sent ipc call */ 291 irq_spinlock_lock(& TASK->lock, true);292 TASK->ipc_info.call_sent++;293 irq_spinlock_unlock(& TASK->lock, true);298 irq_spinlock_lock(&caller->lock, true); 299 caller->ipc_info.call_sent++; 300 irq_spinlock_unlock(&caller->lock, true); 294 301 295 302 if (!(call->flags & IPC_CALL_FORWARDED)) { 296 303 atomic_inc(&phone->active_calls); 297 304 call->caller_phone = phone; 305 call->sender = caller; 298 306 299 307 call->active = true; 300 spinlock_lock(& TASK->active_calls_lock);301 list_append(&call->ta_link, & TASK->active_calls);302 spinlock_unlock(& TASK->active_calls_lock);308 spinlock_lock(&caller->active_calls_lock); 309 list_append(&call->ta_link, &caller->active_calls); 310 spinlock_unlock(&caller->active_calls_lock); 303 311 304 312 call->data.phone = phone; 305 call->data.task_id = TASK->taskid;313 call->data.task_id = phone->caller->taskid; 306 314 } 307 315 … … 559 567 // FIXME: phone can become deallocated at any time now 560 568 561 // FIXME: call->sender == TASK562 563 569 /* 564 570 * Send one message to the answerbox for each -
kernel/generic/src/ipc/kbox.c
rc97b086 r03a8a8e 168 168 while (!done) { 169 169 call_t *call = ipc_wait_for_call(&TASK->kb.box, SYNCH_NO_TIMEOUT, 170 170 SYNCH_FLAGS_NONE); 171 171 172 172 if (call == NULL) -
kernel/generic/src/proc/task.c
rc97b086 r03a8a8e 161 161 size_t i; 162 162 for (i = 0; i < IPC_MAX_PHONES; i++) 163 ipc_phone_init(&task->phones[i] );163 ipc_phone_init(&task->phones[i], task); 164 164 165 165 spinlock_initialize(&task->active_calls_lock, "active_calls_lock");
Note:
See TracChangeset
for help on using the changeset viewer.