Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/sysipc.c

    r36b16bc rcc574511  
    4040#include <debug.h>
    4141#include <ipc/ipc.h>
    42 #include <abi/ipc/methods.h>
     42#include <ipc/ipc_methods.h>
    4343#include <ipc/sysipc.h>
    4444#include <ipc/irq.h>
    4545#include <ipc/ipcrsc.h>
    46 #include <ipc/event.h>
    4746#include <ipc/kbox.h>
    4847#include <synch/waitq.h>
     
    5453#include <mm/as.h>
    5554#include <print.h>
    56 #include <macros.h>
    5755
    5856/**
     
    136134        case IPC_M_DATA_WRITE:
    137135        case IPC_M_DATA_READ:
    138         case IPC_M_STATE_CHANGE_AUTHORIZE:
    139136                return true;
    140137        default:
     
    167164        case IPC_M_DATA_WRITE:
    168165        case IPC_M_DATA_READ:
    169         case IPC_M_STATE_CHANGE_AUTHORIZE:
    170166                return true;
    171167        default:
     
    253249                        /* The connection was accepted */
    254250                        phone_connect(phoneid, &answer->sender->answerbox);
    255                         /* Set 'task ID' as arg3 and arg4 of response */
    256                         IPC_SET_ARG3(answer->data, LOWER32(TASK->taskid));
    257                         IPC_SET_ARG4(answer->data, UPPER32(TASK->taskid));
     251                        /* Set 'task hash' as arg4 of response */
     252                        IPC_SET_ARG4(answer->data, (sysarg_t) TASK);
    258253                        /* Set 'phone hash' as arg5 of response */
    259254                        IPC_SET_ARG5(answer->data,
     
    339334                free(answer->buffer);
    340335                answer->buffer = NULL;
    341         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_STATE_CHANGE_AUTHORIZE) {
    342                 if (!IPC_GET_RETVAL(answer->data)) {
    343                         /* The recipient authorized the change of state. */
    344                         phone_t *recipient_phone;
    345                         task_t *other_task_s;
    346                         task_t *other_task_r;
    347                         int rc;
    348 
    349                         rc = phone_get(IPC_GET_ARG1(answer->data),
    350                             &recipient_phone);
    351                         if (rc != EOK) {
    352                                 IPC_SET_RETVAL(answer->data, ENOENT);
    353                                 return ENOENT;
    354                         }
    355 
    356                         mutex_lock(&recipient_phone->lock);
    357                         if (recipient_phone->state != IPC_PHONE_CONNECTED) {
    358                                 mutex_unlock(&recipient_phone->lock);
    359                                 IPC_SET_RETVAL(answer->data, EINVAL);
    360                                 return EINVAL;
    361                         }
    362 
    363                         other_task_r = recipient_phone->callee->task;
    364                         other_task_s = (task_t *) IPC_GET_ARG5(*olddata);
    365 
    366                         /*
    367                          * See if both the sender and the recipient meant the
    368                          * same third party task.
    369                          */
    370                         if (other_task_r != other_task_s) {
    371                                 IPC_SET_RETVAL(answer->data, EINVAL);
    372                                 rc = EINVAL;
    373                         } else {
    374                                 rc = event_task_notify_5(other_task_r,
    375                                     EVENT_TASK_STATE_CHANGE, false,
    376                                     IPC_GET_ARG1(*olddata),
    377                                     IPC_GET_ARG2(*olddata),
    378                                     IPC_GET_ARG3(*olddata),
    379                                     LOWER32(olddata->task_id),
    380                                     UPPER32(olddata->task_id));
    381                                 IPC_SET_RETVAL(answer->data, rc);
    382                         }
    383 
    384                         mutex_unlock(&recipient_phone->lock);
    385                         return rc;
    386                 }
    387336        }
    388337       
     
    507456                }
    508457               
    509                 break;
    510         }
    511         case IPC_M_STATE_CHANGE_AUTHORIZE: {
    512                 phone_t *sender_phone;
    513                 task_t *other_task_s;
    514 
    515                 if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK)
    516                         return ENOENT;
    517 
    518                 mutex_lock(&sender_phone->lock);
    519                 if (sender_phone->state != IPC_PHONE_CONNECTED) {
    520                         mutex_unlock(&sender_phone->lock);
    521                         return EINVAL;
    522                 }
    523 
    524                 other_task_s = sender_phone->callee->task;
    525 
    526                 mutex_unlock(&sender_phone->lock);
    527 
    528                 /* Remember the third party task hash. */
    529                 IPC_SET_ARG5(call->data, (sysarg_t) other_task_s);
    530458                break;
    531459        }
Note: See TracChangeset for help on using the changeset viewer.