Ignore:
File:
1 edited

Legend:

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

    rf6bffee rfa3b8e4  
    4949#include <syscall/copy.h>
    5050#include <security/cap.h>
    51 #include <console/console.h>
    5251#include <mm/as.h>
    5352#include <print.h>
     
    6968 *
    7069 */
    71 static int phone_get(sysarg_t phoneid, phone_t **phone)
     70static int phone_get(unative_t phoneid, phone_t **phone)
    7271{
    7372        if (phoneid >= IPC_MAX_PHONES)
     
    7877}
    7978
    80 /** Decide if the interface and method is a system method.
    81  *
    82  * @param imethod Interface and method to be decided.
    83  *
    84  * @return True if the interface and method is a system
    85  *         interface and method.
    86  *
    87  */
    88 static inline bool method_is_system(sysarg_t imethod)
    89 {
    90         if (imethod <= IPC_M_LAST_SYSTEM)
     79/** Decide if the method is a system method.
     80 *
     81 * @param method Method to be decided.
     82 *
     83 * @return true if the method is a system method.
     84 *
     85 */
     86static inline bool method_is_system(unative_t method)
     87{
     88        if (method <= IPC_M_LAST_SYSTEM)
    9189                return true;
    9290       
     
    9492}
    9593
    96 /** Decide if the message with this interface and method is forwardable.
    97  *
    98  * Some system messages may be forwarded, for some of them
    99  * it is useless.
    100  *
    101  * @param imethod Interface and method to be decided.
    102  *
    103  * @return True if the interface and method is forwardable.
    104  *
    105  */
    106 static inline bool method_is_forwardable(sysarg_t imethod)
    107 {
    108         switch (imethod) {
     94/** Decide if the message with this method is forwardable.
     95 *
     96 * - some system messages may be forwarded, for some of them
     97 *   it is useless
     98 *
     99 * @param method Method to be decided.
     100 *
     101 * @return true if the method is forwardable.
     102 *
     103 */
     104static inline bool method_is_forwardable(unative_t method)
     105{
     106        switch (method) {
    109107        case IPC_M_CONNECTION_CLONE:
    110108        case IPC_M_CONNECT_ME:
     
    117115}
    118116
    119 /** Decide if the message with this interface and method is immutable on forward.
    120  *
    121  * Some system messages may be forwarded but their content cannot be altered.
    122  *
    123  * @param imethod Interface and method to be decided.
    124  *
    125  * @return True if the interface and method is immutable on forward.
    126  *
    127  */
    128 static inline bool method_is_immutable(sysarg_t imethod)
    129 {
    130         switch (imethod) {
     117/** Decide if the message with this method is immutable on forward.
     118 *
     119 * - some system messages may be forwarded but their content cannot be altered
     120 *
     121 * @param method Method to be decided.
     122 *
     123 * @return true if the method is immutable on forward.
     124 *
     125 */
     126static inline bool method_is_immutable(unative_t method)
     127{
     128        switch (method) {
    131129        case IPC_M_SHARE_OUT:
    132130        case IPC_M_SHARE_IN:
     
    154152static inline bool answer_need_old(call_t *call)
    155153{
    156         switch (IPC_GET_IMETHOD(call->data)) {
     154        switch (IPC_GET_METHOD(call->data)) {
    157155        case IPC_M_CONNECTION_CLONE:
    158156        case IPC_M_CONNECT_ME:
     
    198196                return 0;
    199197       
    200         if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
     198        if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
    201199                int phoneid = IPC_GET_ARG1(*olddata);
    202200                phone_t *phone = &TASK->phones[phoneid];
     
    220218                        mutex_unlock(&phone->lock);
    221219                }
    222         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME) {
     220        } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME) {
    223221                phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata);
    224222               
     
    239237                        mutex_unlock(&phone->lock);
    240238                }
    241         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
     239        } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
    242240                int phoneid = IPC_GET_ARG5(*olddata);
    243241               
     
    248246                        /* The connection was accepted */
    249247                        phone_connect(phoneid, &answer->sender->answerbox);
    250                         /* Set 'task hash' as arg4 of response */
    251                         IPC_SET_ARG4(answer->data, (sysarg_t) TASK);
    252248                        /* Set 'phone hash' as arg5 of response */
    253249                        IPC_SET_ARG5(answer->data,
    254                             (sysarg_t) &TASK->phones[phoneid]);
    255                 }
    256         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
     250                            (unative_t) &TASK->phones[phoneid]);
     251                }
     252        } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
    257253                /* If the users accepted call, connect */
    258254                if (IPC_GET_RETVAL(answer->data) == EOK) {
     
    260256                            &TASK->answerbox);
    261257                }
    262         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_OUT) {
     258        } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_OUT) {
    263259                if (!IPC_GET_RETVAL(answer->data)) {
    264260                        /* Accepted, handle as_area receipt */
     
    274270                        return rc;
    275271                }
    276         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_IN) {
     272        } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_IN) {
    277273                if (!IPC_GET_RETVAL(answer->data)) {
    278274                        irq_spinlock_lock(&answer->sender->lock, true);
     
    285281                        IPC_SET_RETVAL(answer->data, rc);
    286282                }
    287         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_READ) {
     283        } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_READ) {
    288284                ASSERT(!answer->buffer);
    289285                if (!IPC_GET_RETVAL(answer->data)) {
     
    314310                        }
    315311                }
    316         } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_WRITE) {
     312        } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) {
    317313                ASSERT(answer->buffer);
    318314                if (!IPC_GET_RETVAL(answer->data)) {
     
    367363static int request_preprocess(call_t *call, phone_t *phone)
    368364{
    369         switch (IPC_GET_IMETHOD(call->data)) {
     365        switch (IPC_GET_METHOD(call->data)) {
    370366        case IPC_M_CONNECTION_CLONE: {
    371367                phone_t *cloned_phone;
     
    403399        }
    404400        case IPC_M_CONNECT_ME:
    405                 IPC_SET_ARG5(call->data, (sysarg_t) phone);
     401                IPC_SET_ARG5(call->data, (unative_t) phone);
    406402                break;
    407403        case IPC_M_CONNECT_ME_TO: {
     
    411407               
    412408                /* Set arg5 for server */
    413                 IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]);
     409                IPC_SET_ARG5(call->data, (unative_t) &TASK->phones[newphid]);
    414410                call->flags |= IPC_CALL_CONN_ME_TO;
    415411                call->priv = newphid;
     
    426422        case IPC_M_DATA_READ: {
    427423                size_t size = IPC_GET_ARG2(call->data);
    428                 if (size <= 0)
     424                if ((size <= 0 || (size > DATA_XFER_LIMIT)))
    429425                        return ELIMIT;
    430                 if (size > DATA_XFER_LIMIT) {
    431                         int flags = IPC_GET_ARG3(call->data);
    432                         if (flags & IPC_XF_RESTRICT)
    433                                 IPC_SET_ARG2(call->data, DATA_XFER_LIMIT);
    434                         else
    435                                 return ELIMIT;
    436                 }
     426               
    437427                break;
    438428        }
     
    441431                size_t size = IPC_GET_ARG2(call->data);
    442432               
    443                 if (size > DATA_XFER_LIMIT) {
    444                         int flags = IPC_GET_ARG3(call->data);
    445                         if (flags & IPC_XF_RESTRICT) {
    446                                 size = DATA_XFER_LIMIT;
    447                                 IPC_SET_ARG2(call->data, size);
    448                         } else
    449                                 return ELIMIT;
    450                 }
     433                if (size > DATA_XFER_LIMIT)
     434                        return ELIMIT;
    451435               
    452436                call->buffer = (uint8_t *) malloc(size, 0);
     
    519503static int process_request(answerbox_t *box, call_t *call)
    520504{
    521         if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME) {
     505        if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME) {
    522506                int phoneid = phone_alloc(TASK);
    523507                if (phoneid < 0) { /* Failed to allocate phone */
     
    530514        }
    531515       
    532         switch (IPC_GET_IMETHOD(call->data)) {
     516        switch (IPC_GET_METHOD(call->data)) {
    533517        case IPC_M_DEBUG_ALL:
    534518                return -1;
     
    546530 *
    547531 * @param phoneid Phone handle for the call.
    548  * @param imethod Interface and method of the call.
     532 * @param method  Method of the call.
    549533 * @param arg1    Service-defined payload argument.
    550534 * @param arg2    Service-defined payload argument.
    551535 * @param arg3    Service-defined payload argument.
    552  * @param data    Address of user-space structure where the reply call will
     536 * @param data    Address of userspace structure where the reply call will
    553537 *                be stored.
    554538 *
     
    557541 *
    558542 */
    559 sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t imethod,
    560     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data)
     543unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method,
     544    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
    561545{
    562546        phone_t *phone;
    563547        if (phone_get(phoneid, &phone) != EOK)
    564548                return ENOENT;
    565        
     549
    566550        call_t *call = ipc_call_alloc(0);
    567         IPC_SET_IMETHOD(call->data, imethod);
     551        IPC_SET_METHOD(call->data, method);
    568552        IPC_SET_ARG1(call->data, arg1);
    569553        IPC_SET_ARG2(call->data, arg2);
     
    595579               
    596580                process_answer(call);
     581               
    597582        } else
    598583                IPC_SET_RETVAL(call->data, res);
     
    608593/** Make a synchronous IPC call allowing to transmit the entire payload.
    609594 *
    610  * @param phoneid Phone handle for the call.
    611  * @param request User-space address of call data with the request.
    612  * @param reply   User-space address of call data where to store the
    613  *                answer.
     595 * @param phoneid  Phone handle for the call.
     596 * @param question Userspace address of call data with the request.
     597 * @param reply    Userspace address of call data where to store the
     598 *                 answer.
    614599 *
    615600 * @return Zero on success or an error code.
    616601 *
    617602 */
    618 sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *request,
     603unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
    619604    ipc_data_t *reply)
    620605{
     
    622607        if (phone_get(phoneid, &phone) != EOK)
    623608                return ENOENT;
    624        
     609
    625610        call_t *call = ipc_call_alloc(0);
    626         int rc = copy_from_uspace(&call->data.args, &request->args,
     611        int rc = copy_from_uspace(&call->data.args, &question->args,
    627612            sizeof(call->data.args));
    628613        if (rc != 0) {
    629614                ipc_call_free(call);
    630                 return (sysarg_t) rc;
     615                return (unative_t) rc;
    631616        }
    632617       
     
    659644}
    660645
    661 /** Check that the task did not exceed the allowed limit of asynchronous calls
    662  * made over a phone.
    663  *
    664  * @param phone Phone to check the limit against.
     646/** Check that the task did not exceed the allowed limit of asynchronous calls.
    665647 *
    666648 * @return 0 if limit not reached or -1 if limit exceeded.
    667649 *
    668650 */
    669 static int check_call_limit(phone_t *phone)
    670 {
    671         if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
     651static int check_call_limit(void)
     652{
     653        if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
     654                atomic_dec(&TASK->active_calls);
    672655                return -1;
     656        }
    673657       
    674658        return 0;
     
    681665 *
    682666 * @param phoneid Phone handle for the call.
    683  * @param imethod Interface and method of the call.
     667 * @param method  Method of the call.
    684668 * @param arg1    Service-defined payload argument.
    685669 * @param arg2    Service-defined payload argument.
     
    693677 *
    694678 */
    695 sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t imethod,
    696     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    697 {
     679unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
     680    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
     681{
     682        if (check_call_limit())
     683                return IPC_CALLRET_TEMPORARY;
     684       
    698685        phone_t *phone;
    699686        if (phone_get(phoneid, &phone) != EOK)
    700687                return IPC_CALLRET_FATAL;
    701688       
    702         if (check_call_limit(phone))
    703                 return IPC_CALLRET_TEMPORARY;
    704        
    705689        call_t *call = ipc_call_alloc(0);
    706         IPC_SET_IMETHOD(call->data, imethod);
     690        IPC_SET_METHOD(call->data, method);
    707691        IPC_SET_ARG1(call->data, arg1);
    708692        IPC_SET_ARG2(call->data, arg2);
     
    723707                ipc_backsend_err(phone, call, res);
    724708       
    725         return (sysarg_t) call;
     709        return (unative_t) call;
    726710}
    727711
     
    734718 *
    735719 */
    736 sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data)
    737 {
     720unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data)
     721{
     722        if (check_call_limit())
     723                return IPC_CALLRET_TEMPORARY;
     724       
    738725        phone_t *phone;
    739726        if (phone_get(phoneid, &phone) != EOK)
    740727                return IPC_CALLRET_FATAL;
    741 
    742         if (check_call_limit(phone))
    743                 return IPC_CALLRET_TEMPORARY;
    744728
    745729        call_t *call = ipc_call_alloc(0);
     
    748732        if (rc != 0) {
    749733                ipc_call_free(call);
    750                 return (sysarg_t) rc;
     734                return (unative_t) rc;
    751735        }
    752736       
     
    758742                ipc_backsend_err(phone, call, res);
    759743       
    760         return (sysarg_t) call;
     744        return (unative_t) call;
    761745}
    762746
     
    767751 * @param callid  Hash of the call to forward.
    768752 * @param phoneid Phone handle to use for forwarding.
    769  * @param imethod New interface and method to use for the forwarded call.
     753 * @param method  New method to use for the forwarded call.
    770754 * @param arg1    New value of the first argument for the forwarded call.
    771755 * @param arg2    New value of the second argument for the forwarded call.
     
    783767 *
    784768 */
    785 static sysarg_t sys_ipc_forward_common(sysarg_t callid, sysarg_t phoneid,
    786     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    787     sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
     769static unative_t sys_ipc_forward_common(unative_t callid, unative_t phoneid,
     770    unative_t method, unative_t arg1, unative_t arg2, unative_t arg3,
     771    unative_t arg4, unative_t arg5, unsigned int mode, bool slow)
    788772{
    789773        call_t *call = get_call(callid);
     
    800784        }
    801785       
    802         if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) {
     786        if (!method_is_forwardable(IPC_GET_METHOD(call->data))) {
    803787                IPC_SET_RETVAL(call->data, EFORWARD);
    804788                ipc_answer(&TASK->answerbox, call);
     
    807791       
    808792        /*
    809          * Userspace is not allowed to change interface and method of system
    810          * methods on forward, allow changing ARG1, ARG2, ARG3 and ARG4 by
    811          * means of method, arg1, arg2 and arg3.
    812          * If the interface and method is immutable, don't change anything.
     793         * Userspace is not allowed to change method of system methods on
     794         * forward, allow changing ARG1, ARG2, ARG3 and ARG4 by means of method,
     795         * arg1, arg2 and arg3.
     796         * If the method is immutable, don't change anything.
    813797         */
    814         if (!method_is_immutable(IPC_GET_IMETHOD(call->data))) {
    815                 if (method_is_system(IPC_GET_IMETHOD(call->data))) {
    816                         if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
     798        if (!method_is_immutable(IPC_GET_METHOD(call->data))) {
     799                if (method_is_system(IPC_GET_METHOD(call->data))) {
     800                        if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME)
    817801                                phone_dealloc(IPC_GET_ARG5(call->data));
    818802                       
    819                         IPC_SET_ARG1(call->data, imethod);
     803                        IPC_SET_ARG1(call->data, method);
    820804                        IPC_SET_ARG2(call->data, arg1);
    821805                        IPC_SET_ARG3(call->data, arg2);
     
    829813                        }
    830814                } else {
    831                         IPC_SET_IMETHOD(call->data, imethod);
     815                        IPC_SET_METHOD(call->data, method);
    832816                        IPC_SET_ARG1(call->data, arg1);
    833817                        IPC_SET_ARG2(call->data, arg2);
     
    845829/** Forward a received call to another destination - fast version.
    846830 *
    847  * In case the original interface and method is a system method, ARG1, ARG2
    848  * and ARG3 are overwritten in the forwarded message with the new method and
    849  * the new arg1 and arg2, respectively. Otherwise the IMETHOD, ARG1 and ARG2
    850  * are rewritten with the new interface and method, arg1 and arg2, respectively.
    851  * Also note there is a set of immutable methods, for which the new method and
    852  * arguments are not set and these values are ignored.
     831 * In case the original method is a system method, ARG1, ARG2 and ARG3 are
     832 * overwritten in the forwarded message with the new method and the new
     833 * arg1 and arg2, respectively. Otherwise the METHOD, ARG1 and ARG2 are
     834 * rewritten with the new method, arg1 and arg2, respectively. Also note there
     835 * is a set of immutable methods, for which the new method and arguments are not
     836 * set and these values are ignored.
    853837 *
    854838 * @param callid  Hash of the call to forward.
    855839 * @param phoneid Phone handle to use for forwarding.
    856  * @param imethod New interface and method to use for the forwarded call.
     840 * @param method  New method to use for the forwarded call.
    857841 * @param arg1    New value of the first argument for the forwarded call.
    858842 * @param arg2    New value of the second argument for the forwarded call.
     
    862846 *
    863847 */
    864 sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid,
    865     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
    866 {
    867         return sys_ipc_forward_common(callid, phoneid, imethod, arg1, arg2, 0, 0,
     848unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
     849    unative_t method, unative_t arg1, unative_t arg2, unsigned int mode)
     850{
     851        return sys_ipc_forward_common(callid, phoneid, method, arg1, arg2, 0, 0,
    868852            0, mode, false);
    869853}
     
    872856 *
    873857 * This function is the slow verision of the sys_ipc_forward_fast interface.
    874  * It can copy all five new arguments and the new interface and method from
    875  * the userspace. It naturally extends the functionality of the fast version.
    876  * For system methods, it additionally stores the new value of arg3 to ARG4.
    877  * For non-system methods, it additionally stores the new value of arg3, arg4
    878  * and arg5, respectively, to ARG3, ARG4 and ARG5, respectively.
     858 * It can copy all five new arguments and the new method from the userspace.
     859 * It naturally extends the functionality of the fast version. For system
     860 * methods, it additionally stores the new value of arg3 to ARG4. For non-system
     861 * methods, it additionally stores the new value of arg3, arg4 and arg5,
     862 * respectively, to ARG3, ARG4 and ARG5, respectively.
    879863 *
    880864 * @param callid  Hash of the call to forward.
     
    886870 *
    887871 */
    888 sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid,
     872unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
    889873    ipc_data_t *data, unsigned int mode)
    890874{
     
    893877            sizeof(newdata.args));
    894878        if (rc != 0)
    895                 return (sysarg_t) rc;
     879                return (unative_t) rc;
    896880       
    897881        return sys_ipc_forward_common(callid, phoneid,
    898             IPC_GET_IMETHOD(newdata), IPC_GET_ARG1(newdata),
     882            IPC_GET_METHOD(newdata), IPC_GET_ARG1(newdata),
    899883            IPC_GET_ARG2(newdata), IPC_GET_ARG3(newdata),
    900884            IPC_GET_ARG4(newdata), IPC_GET_ARG5(newdata), mode, true);
     
    916900 *
    917901 */
    918 sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval,
    919     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
     902unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
     903    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
    920904{
    921905        /* Do not answer notification callids */
     
    961945 *
    962946 */
    963 sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data)
     947unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data)
    964948{
    965949        /* Do not answer notification callids */
     
    998982 *
    999983 */
    1000 sysarg_t sys_ipc_hangup(sysarg_t phoneid)
     984unative_t sys_ipc_hangup(unative_t phoneid)
    1001985{
    1002986        phone_t *phone;
     
    10241008 *
    10251009 */
    1026 sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     1010unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
    10271011    unsigned int flags)
    10281012{
     
    10531037                ipc_call_free(call);
    10541038               
    1055                 return ((sysarg_t) call) | IPC_CALLID_NOTIFICATION;
     1039                return ((unative_t) call) | IPC_CALLID_NOTIFICATION;
    10561040        }
    10571041       
     
    10621046                        ipc_call_free(call);
    10631047                        goto restart;
     1048                } else {
     1049                        /*
     1050                         * Decrement the counter of active calls only if the
     1051                         * call is not an answer to IPC_M_PHONE_HUNGUP,
     1052                         * which doesn't contribute to the counter.
     1053                         */
     1054                        atomic_dec(&TASK->active_calls);
    10641055                }
    10651056               
     
    10671058                ipc_call_free(call);
    10681059               
    1069                 return ((sysarg_t) call) | IPC_CALLID_ANSWERED;
     1060                return ((unative_t) call) | IPC_CALLID_ANSWERED;
    10701061        }
    10711062       
     
    10951086        }
    10961087       
    1097         return (sysarg_t) call;
     1088        return (unative_t) call;
    10981089}
    10991090
     
    11011092 *
    11021093 */
    1103 sysarg_t sys_ipc_poke(void)
     1094unative_t sys_ipc_poke(void)
    11041095{
    11051096        waitq_unsleep(&TASK->answerbox.wq);
     
    11091100/** Connect an IRQ handler to a task.
    11101101 *
    1111  * @param inr     IRQ number.
    1112  * @param devno   Device number.
    1113  * @param imethod Interface and method to be associated with the notification.
    1114  * @param ucode   Uspace pointer to the top-half pseudocode.
     1102 * @param inr    IRQ number.
     1103 * @param devno  Device number.
     1104 * @param method Method to be associated with the notification.
     1105 * @param ucode  Uspace pointer to the top-half pseudocode.
    11151106 *
    11161107 * @return EPERM or a return code returned by ipc_irq_register().
    11171108 *
    11181109 */
    1119 sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t imethod,
     1110unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
    11201111    irq_code_t *ucode)
    11211112{
     
    11231114                return EPERM;
    11241115       
    1125         return ipc_irq_register(&TASK->answerbox, inr, devno, imethod, ucode);
     1116        return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
    11261117}
    11271118
     
    11341125 *
    11351126 */
    1136 sysarg_t sys_unregister_irq(inr_t inr, devno_t devno)
     1127unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
    11371128{
    11381129        if (!(cap_get(TASK) & CAP_IRQ_REG))
     
    11441135}
    11451136
    1146 #ifdef __32_BITS__
    1147 
    1148 /** Syscall connect to a task by ID (32 bits)
     1137#include <console/console.h>
     1138
     1139/** Syscall connect to a task by id.
    11491140 *
    11501141 * @return Phone id on success, or negative error code.
    11511142 *
    11521143 */
    1153 sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid)
     1144unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
    11541145{
    11551146#ifdef CONFIG_UDEBUG
    1156         sysarg64_t taskid;
    1157         int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
     1147        sysarg64_t taskid_arg;
     1148        int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
    11581149        if (rc != 0)
    1159                 return (sysarg_t) rc;
    1160        
    1161         return ipc_connect_kbox((task_id_t) taskid);
     1150                return (unative_t) rc;
     1151       
     1152        LOG("sys_ipc_connect_kbox(%" PRIu64 ")", taskid_arg.value);
     1153       
     1154        return ipc_connect_kbox(taskid_arg.value);
    11621155#else
    1163         return (sysarg_t) ENOTSUP;
     1156        return (unative_t) ENOTSUP;
    11641157#endif
    11651158}
    11661159
    1167 #endif  /* __32_BITS__ */
    1168 
    1169 #ifdef __64_BITS__
    1170 
    1171 /** Syscall connect to a task by ID (64 bits)
    1172  *
    1173  * @return Phone id on success, or negative error code.
    1174  *
    1175  */
    1176 sysarg_t sys_ipc_connect_kbox(sysarg_t taskid)
    1177 {
    1178 #ifdef CONFIG_UDEBUG
    1179         return ipc_connect_kbox((task_id_t) taskid);
    1180 #else
    1181         return (sysarg_t) ENOTSUP;
    1182 #endif
    1183 }
    1184 
    1185 #endif  /* __64_BITS__ */
    1186 
    11871160/** @}
    11881161 */
Note: See TracChangeset for help on using the changeset viewer.