Changes in kernel/generic/src/ipc/sysipc.c [ab34cc9:f6bffee] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
rab34cc9 rf6bffee 40 40 #include <debug.h> 41 41 #include <ipc/ipc.h> 42 #include <abi/ipc/methods.h>43 42 #include <ipc/sysipc.h> 44 43 #include <ipc/irq.h> 45 44 #include <ipc/ipcrsc.h> 46 #include <ipc/event.h>47 45 #include <ipc/kbox.h> 48 46 #include <synch/waitq.h> … … 54 52 #include <mm/as.h> 55 53 #include <print.h> 56 #include <macros.h>57 54 58 55 /** … … 136 133 case IPC_M_DATA_WRITE: 137 134 case IPC_M_DATA_READ: 138 case IPC_M_STATE_CHANGE_AUTHORIZE:139 135 return true; 140 136 default: … … 167 163 case IPC_M_DATA_WRITE: 168 164 case IPC_M_DATA_READ: 169 case IPC_M_STATE_CHANGE_AUTHORIZE:170 165 return true; 171 166 default: … … 253 248 /* The connection was accepted */ 254 249 phone_connect(phoneid, &answer->sender->answerbox); 250 /* Set 'task hash' as arg4 of response */ 251 IPC_SET_ARG4(answer->data, (sysarg_t) TASK); 255 252 /* Set 'phone hash' as arg5 of response */ 256 253 IPC_SET_ARG5(answer->data, … … 336 333 free(answer->buffer); 337 334 answer->buffer = NULL; 338 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_STATE_CHANGE_AUTHORIZE) {339 if (!IPC_GET_RETVAL(answer->data)) {340 /* The recipient authorized the change of state. */341 phone_t *recipient_phone;342 task_t *other_task_s;343 task_t *other_task_r;344 int rc;345 346 rc = phone_get(IPC_GET_ARG1(answer->data),347 &recipient_phone);348 if (rc != EOK) {349 IPC_SET_RETVAL(answer->data, ENOENT);350 return ENOENT;351 }352 353 mutex_lock(&recipient_phone->lock);354 if (recipient_phone->state != IPC_PHONE_CONNECTED) {355 mutex_unlock(&recipient_phone->lock);356 IPC_SET_RETVAL(answer->data, EINVAL);357 return EINVAL;358 }359 360 other_task_r = recipient_phone->callee->task;361 other_task_s = (task_t *) IPC_GET_ARG5(*olddata);362 363 /*364 * See if both the sender and the recipient meant the365 * same third party task.366 */367 if (other_task_r != other_task_s) {368 IPC_SET_RETVAL(answer->data, EINVAL);369 rc = EINVAL;370 } else {371 rc = event_task_notify_5(other_task_r,372 EVENT_TASK_STATE_CHANGE, false,373 IPC_GET_ARG1(*olddata),374 IPC_GET_ARG2(*olddata),375 IPC_GET_ARG3(*olddata),376 LOWER32(olddata->task_id),377 UPPER32(olddata->task_id));378 IPC_SET_RETVAL(answer->data, rc);379 }380 381 mutex_unlock(&recipient_phone->lock);382 return rc;383 }384 335 } 385 336 … … 475 426 case IPC_M_DATA_READ: { 476 427 size_t size = IPC_GET_ARG2(call->data); 428 if (size <= 0) 429 return ELIMIT; 477 430 if (size > DATA_XFER_LIMIT) { 478 431 int flags = IPC_GET_ARG3(call->data); … … 506 459 break; 507 460 } 508 case IPC_M_STATE_CHANGE_AUTHORIZE: {509 phone_t *sender_phone;510 task_t *other_task_s;511 512 if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK)513 return ENOENT;514 515 mutex_lock(&sender_phone->lock);516 if (sender_phone->state != IPC_PHONE_CONNECTED) {517 mutex_unlock(&sender_phone->lock);518 return EINVAL;519 }520 521 other_task_s = sender_phone->callee->task;522 523 mutex_unlock(&sender_phone->lock);524 525 /* Remember the third party task hash. */526 IPC_SET_ARG5(call->data, (sysarg_t) other_task_s);527 break;528 }529 461 #ifdef CONFIG_UDEBUG 530 case IPC_M_DEBUG :462 case IPC_M_DEBUG_ALL: 531 463 return udebug_request_preprocess(call, phone); 532 464 #endif … … 563 495 /* 564 496 * This must be an affirmative answer to IPC_M_DATA_READ 565 * or IPC_M_DEBUG /UDEBUG_M_MEM_READ...497 * or IPC_M_DEBUG_ALL/UDEBUG_M_MEM_READ... 566 498 * 567 499 */ … … 599 531 600 532 switch (IPC_GET_IMETHOD(call->data)) { 601 case IPC_M_DEBUG :533 case IPC_M_DEBUG_ALL: 602 534 return -1; 603 535 default:
Note:
See TracChangeset
for help on using the changeset viewer.