Changeset 357b5f5 in mainline for kernel/generic/src/ipc/sysipc.c


Ignore:
Timestamp:
2011-01-23T20:09:13Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fdb9982c
Parents:
cead2aa (diff), 7e36c8d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    rcead2aa r357b5f5  
    4949#include <syscall/copy.h>
    5050#include <security/cap.h>
     51#include <console/console.h>
    5152#include <mm/as.h>
    5253#include <print.h>
     
    6869 *
    6970 */
    70 static int phone_get(unative_t phoneid, phone_t **phone)
     71static int phone_get(sysarg_t phoneid, phone_t **phone)
    7172{
    7273        if (phoneid >= IPC_MAX_PHONES)
     
    7778}
    7879
    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  */
    86 static inline bool method_is_system(unative_t method)
    87 {
    88         if (method <= IPC_M_LAST_SYSTEM)
     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 */
     88static inline bool method_is_system(sysarg_t imethod)
     89{
     90        if (imethod <= IPC_M_LAST_SYSTEM)
    8991                return true;
    9092       
     
    9294}
    9395
    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  */
    104 static inline bool method_is_forwardable(unative_t method)
    105 {
    106         switch (method) {
     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 */
     106static inline bool method_is_forwardable(sysarg_t imethod)
     107{
     108        switch (imethod) {
    107109        case IPC_M_CONNECTION_CLONE:
    108110        case IPC_M_CONNECT_ME:
     
    115117}
    116118
    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  */
    126 static inline bool method_is_immutable(unative_t method)
    127 {
    128         switch (method) {
     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 */
     128static inline bool method_is_immutable(sysarg_t imethod)
     129{
     130        switch (imethod) {
    129131        case IPC_M_SHARE_OUT:
    130132        case IPC_M_SHARE_IN:
     
    152154static inline bool answer_need_old(call_t *call)
    153155{
    154         switch (IPC_GET_METHOD(call->data)) {
     156        switch (IPC_GET_IMETHOD(call->data)) {
    155157        case IPC_M_CONNECTION_CLONE:
    156158        case IPC_M_CONNECT_ME:
     
    196198                return 0;
    197199       
    198         if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
     200        if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
    199201                int phoneid = IPC_GET_ARG1(*olddata);
    200202                phone_t *phone = &TASK->phones[phoneid];
     
    218220                        mutex_unlock(&phone->lock);
    219221                }
    220         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME) {
     222        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME) {
    221223                phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata);
    222224               
     
    237239                        mutex_unlock(&phone->lock);
    238240                }
    239         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
     241        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
    240242                int phoneid = IPC_GET_ARG5(*olddata);
    241243               
     
    248250                        /* Set 'phone hash' as arg5 of response */
    249251                        IPC_SET_ARG5(answer->data,
    250                             (unative_t) &TASK->phones[phoneid]);
    251                 }
    252         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
     252                            (sysarg_t) &TASK->phones[phoneid]);
     253                }
     254        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
    253255                /* If the users accepted call, connect */
    254256                if (IPC_GET_RETVAL(answer->data) == EOK) {
     
    256258                            &TASK->answerbox);
    257259                }
    258         } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_OUT) {
     260        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_OUT) {
    259261                if (!IPC_GET_RETVAL(answer->data)) {
    260262                        /* Accepted, handle as_area receipt */
     
    270272                        return rc;
    271273                }
    272         } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_IN) {
     274        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_IN) {
    273275                if (!IPC_GET_RETVAL(answer->data)) {
    274276                        irq_spinlock_lock(&answer->sender->lock, true);
     
    281283                        IPC_SET_RETVAL(answer->data, rc);
    282284                }
    283         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_READ) {
     285        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_READ) {
    284286                ASSERT(!answer->buffer);
    285287                if (!IPC_GET_RETVAL(answer->data)) {
     
    310312                        }
    311313                }
    312         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) {
     314        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_WRITE) {
    313315                ASSERT(answer->buffer);
    314316                if (!IPC_GET_RETVAL(answer->data)) {
     
    363365static int request_preprocess(call_t *call, phone_t *phone)
    364366{
    365         switch (IPC_GET_METHOD(call->data)) {
     367        switch (IPC_GET_IMETHOD(call->data)) {
    366368        case IPC_M_CONNECTION_CLONE: {
    367369                phone_t *cloned_phone;
     
    399401        }
    400402        case IPC_M_CONNECT_ME:
    401                 IPC_SET_ARG5(call->data, (unative_t) phone);
     403                IPC_SET_ARG5(call->data, (sysarg_t) phone);
    402404                break;
    403405        case IPC_M_CONNECT_ME_TO: {
     
    407409               
    408410                /* Set arg5 for server */
    409                 IPC_SET_ARG5(call->data, (unative_t) &TASK->phones[newphid]);
     411                IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]);
    410412                call->flags |= IPC_CALL_CONN_ME_TO;
    411413                call->priv = newphid;
     
    503505static int process_request(answerbox_t *box, call_t *call)
    504506{
    505         if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME) {
     507        if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME) {
    506508                int phoneid = phone_alloc(TASK);
    507509                if (phoneid < 0) { /* Failed to allocate phone */
     
    514516        }
    515517       
    516         switch (IPC_GET_METHOD(call->data)) {
     518        switch (IPC_GET_IMETHOD(call->data)) {
    517519        case IPC_M_DEBUG_ALL:
    518520                return -1;
     
    530532 *
    531533 * @param phoneid Phone handle for the call.
    532  * @param method  Method of the call.
     534 * @param imethod Interface and method of the call.
    533535 * @param arg1    Service-defined payload argument.
    534536 * @param arg2    Service-defined payload argument.
    535537 * @param arg3    Service-defined payload argument.
    536  * @param data    Address of userspace structure where the reply call will
     538 * @param data    Address of user-space structure where the reply call will
    537539 *                be stored.
    538540 *
     
    541543 *
    542544 */
    543 unative_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)
     545sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t imethod,
     546    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data)
    545547{
    546548        phone_t *phone;
    547549        if (phone_get(phoneid, &phone) != EOK)
    548550                return ENOENT;
    549 
     551       
    550552        call_t *call = ipc_call_alloc(0);
    551         IPC_SET_METHOD(call->data, method);
     553        IPC_SET_IMETHOD(call->data, imethod);
    552554        IPC_SET_ARG1(call->data, arg1);
    553555        IPC_SET_ARG2(call->data, arg2);
     
    579581               
    580582                process_answer(call);
    581                
    582583        } else
    583584                IPC_SET_RETVAL(call->data, res);
     
    593594/** Make a synchronous IPC call allowing to transmit the entire payload.
    594595 *
    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.
     596 * @param phoneid Phone handle for the call.
     597 * @param request User-space address of call data with the request.
     598 * @param reply   User-space address of call data where to store the
     599 *                answer.
    599600 *
    600601 * @return Zero on success or an error code.
    601602 *
    602603 */
    603 unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
     604sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *request,
    604605    ipc_data_t *reply)
    605606{
     
    607608        if (phone_get(phoneid, &phone) != EOK)
    608609                return ENOENT;
    609 
     610       
    610611        call_t *call = ipc_call_alloc(0);
    611         int rc = copy_from_uspace(&call->data.args, &question->args,
     612        int rc = copy_from_uspace(&call->data.args, &request->args,
    612613            sizeof(call->data.args));
    613614        if (rc != 0) {
    614615                ipc_call_free(call);
    615                 return (unative_t) rc;
     616                return (sysarg_t) rc;
    616617        }
    617618       
     
    644645}
    645646
    646 /** Check that the task did not exceed the allowed limit of asynchronous calls.
     647/** Check that the task did not exceed the allowed limit of asynchronous calls
     648 * made over a phone.
     649 *
     650 * @param phone Phone to check the limit against.
    647651 *
    648652 * @return 0 if limit not reached or -1 if limit exceeded.
    649653 *
    650654 */
    651 static int check_call_limit(void)
    652 {
    653         if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
    654                 atomic_dec(&TASK->active_calls);
     655static int check_call_limit(phone_t *phone)
     656{
     657        if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
    655658                return -1;
    656         }
    657659       
    658660        return 0;
     
    665667 *
    666668 * @param phoneid Phone handle for the call.
    667  * @param method  Method of the call.
     669 * @param imethod Interface and method of the call.
    668670 * @param arg1    Service-defined payload argument.
    669671 * @param arg2    Service-defined payload argument.
     
    677679 *
    678680 */
    679 unative_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        
     681sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t imethod,
     682    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
     683{
    685684        phone_t *phone;
    686685        if (phone_get(phoneid, &phone) != EOK)
    687686                return IPC_CALLRET_FATAL;
    688687       
     688        if (check_call_limit(phone))
     689                return IPC_CALLRET_TEMPORARY;
     690       
    689691        call_t *call = ipc_call_alloc(0);
    690         IPC_SET_METHOD(call->data, method);
     692        IPC_SET_IMETHOD(call->data, imethod);
    691693        IPC_SET_ARG1(call->data, arg1);
    692694        IPC_SET_ARG2(call->data, arg2);
     
    707709                ipc_backsend_err(phone, call, res);
    708710       
    709         return (unative_t) call;
     711        return (sysarg_t) call;
    710712}
    711713
     
    718720 *
    719721 */
    720 unative_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        
     722sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data)
     723{
    725724        phone_t *phone;
    726725        if (phone_get(phoneid, &phone) != EOK)
    727726                return IPC_CALLRET_FATAL;
     727
     728        if (check_call_limit(phone))
     729                return IPC_CALLRET_TEMPORARY;
    728730
    729731        call_t *call = ipc_call_alloc(0);
     
    732734        if (rc != 0) {
    733735                ipc_call_free(call);
    734                 return (unative_t) rc;
     736                return (sysarg_t) rc;
    735737        }
    736738       
     
    742744                ipc_backsend_err(phone, call, res);
    743745       
    744         return (unative_t) call;
     746        return (sysarg_t) call;
    745747}
    746748
     
    751753 * @param callid  Hash of the call to forward.
    752754 * @param phoneid Phone handle to use for forwarding.
    753  * @param method  New method to use for the forwarded call.
     755 * @param imethod New interface and method to use for the forwarded call.
    754756 * @param arg1    New value of the first argument for the forwarded call.
    755757 * @param arg2    New value of the second argument for the forwarded call.
     
    767769 *
    768770 */
    769 static 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)
     771static sysarg_t sys_ipc_forward_common(sysarg_t callid, sysarg_t phoneid,
     772    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     773    sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
    772774{
    773775        call_t *call = get_call(callid);
     
    784786        }
    785787       
    786         if (!method_is_forwardable(IPC_GET_METHOD(call->data))) {
     788        if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) {
    787789                IPC_SET_RETVAL(call->data, EFORWARD);
    788790                ipc_answer(&TASK->answerbox, call);
     
    791793       
    792794        /*
    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.
     795         * Userspace is not allowed to change interface and method of system
     796         * methods on forward, allow changing ARG1, ARG2, ARG3 and ARG4 by
     797         * means of method, arg1, arg2 and arg3.
     798         * If the interface and method is immutable, don't change anything.
    797799         */
    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)
     800        if (!method_is_immutable(IPC_GET_IMETHOD(call->data))) {
     801                if (method_is_system(IPC_GET_IMETHOD(call->data))) {
     802                        if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
    801803                                phone_dealloc(IPC_GET_ARG5(call->data));
    802804                       
    803                         IPC_SET_ARG1(call->data, method);
     805                        IPC_SET_ARG1(call->data, imethod);
    804806                        IPC_SET_ARG2(call->data, arg1);
    805807                        IPC_SET_ARG3(call->data, arg2);
     
    813815                        }
    814816                } else {
    815                         IPC_SET_METHOD(call->data, method);
     817                        IPC_SET_IMETHOD(call->data, imethod);
    816818                        IPC_SET_ARG1(call->data, arg1);
    817819                        IPC_SET_ARG2(call->data, arg2);
     
    829831/** Forward a received call to another destination - fast version.
    830832 *
    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.
     833 * In case the original interface and method is a system method, ARG1, ARG2
     834 * and ARG3 are overwritten in the forwarded message with the new method and
     835 * the new arg1 and arg2, respectively. Otherwise the IMETHOD, ARG1 and ARG2
     836 * are rewritten with the new interface and method, arg1 and arg2, respectively.
     837 * Also note there is a set of immutable methods, for which the new method and
     838 * arguments are not set and these values are ignored.
    837839 *
    838840 * @param callid  Hash of the call to forward.
    839841 * @param phoneid Phone handle to use for forwarding.
    840  * @param method  New method to use for the forwarded call.
     842 * @param imethod New interface and method to use for the forwarded call.
    841843 * @param arg1    New value of the first argument for the forwarded call.
    842844 * @param arg2    New value of the second argument for the forwarded call.
     
    846848 *
    847849 */
    848 unative_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,
     850sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid,
     851    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
     852{
     853        return sys_ipc_forward_common(callid, phoneid, imethod, arg1, arg2, 0, 0,
    852854            0, mode, false);
    853855}
     
    856858 *
    857859 * This function is the slow verision of the sys_ipc_forward_fast interface.
    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.
     860 * It can copy all five new arguments and the new interface and method from
     861 * the userspace. It naturally extends the functionality of the fast version.
     862 * For system methods, it additionally stores the new value of arg3 to ARG4.
     863 * For non-system methods, it additionally stores the new value of arg3, arg4
     864 * and arg5, respectively, to ARG3, ARG4 and ARG5, respectively.
    863865 *
    864866 * @param callid  Hash of the call to forward.
     
    870872 *
    871873 */
    872 unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
     874sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid,
    873875    ipc_data_t *data, unsigned int mode)
    874876{
     
    877879            sizeof(newdata.args));
    878880        if (rc != 0)
    879                 return (unative_t) rc;
     881                return (sysarg_t) rc;
    880882       
    881883        return sys_ipc_forward_common(callid, phoneid,
    882             IPC_GET_METHOD(newdata), IPC_GET_ARG1(newdata),
     884            IPC_GET_IMETHOD(newdata), IPC_GET_ARG1(newdata),
    883885            IPC_GET_ARG2(newdata), IPC_GET_ARG3(newdata),
    884886            IPC_GET_ARG4(newdata), IPC_GET_ARG5(newdata), mode, true);
     
    900902 *
    901903 */
    902 unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
    903     unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
     904sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval,
     905    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    904906{
    905907        /* Do not answer notification callids */
     
    945947 *
    946948 */
    947 unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data)
     949sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data)
    948950{
    949951        /* Do not answer notification callids */
     
    982984 *
    983985 */
    984 unative_t sys_ipc_hangup(unative_t phoneid)
     986sysarg_t sys_ipc_hangup(sysarg_t phoneid)
    985987{
    986988        phone_t *phone;
     
    10081010 *
    10091011 */
    1010 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     1012sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
    10111013    unsigned int flags)
    10121014{
     
    10371039                ipc_call_free(call);
    10381040               
    1039                 return ((unative_t) call) | IPC_CALLID_NOTIFICATION;
     1041                return ((sysarg_t) call) | IPC_CALLID_NOTIFICATION;
    10401042        }
    10411043       
     
    10461048                        ipc_call_free(call);
    10471049                        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);
    10551050                }
    10561051               
     
    10581053                ipc_call_free(call);
    10591054               
    1060                 return ((unative_t) call) | IPC_CALLID_ANSWERED;
     1055                return ((sysarg_t) call) | IPC_CALLID_ANSWERED;
    10611056        }
    10621057       
     
    10861081        }
    10871082       
    1088         return (unative_t) call;
     1083        return (sysarg_t) call;
    10891084}
    10901085
     
    10921087 *
    10931088 */
    1094 unative_t sys_ipc_poke(void)
     1089sysarg_t sys_ipc_poke(void)
    10951090{
    10961091        waitq_unsleep(&TASK->answerbox.wq);
     
    11001095/** Connect an IRQ handler to a task.
    11011096 *
    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.
     1097 * @param inr     IRQ number.
     1098 * @param devno   Device number.
     1099 * @param imethod Interface and method to be associated with the notification.
     1100 * @param ucode   Uspace pointer to the top-half pseudocode.
    11061101 *
    11071102 * @return EPERM or a return code returned by ipc_irq_register().
    11081103 *
    11091104 */
    1110 unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
     1105sysarg_t sys_ipc_register_irq(inr_t inr, devno_t devno, sysarg_t imethod,
    11111106    irq_code_t *ucode)
    11121107{
     
    11141109                return EPERM;
    11151110       
    1116         return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
     1111        return ipc_irq_register(&TASK->answerbox, inr, devno, imethod, ucode);
    11171112}
    11181113
     
    11251120 *
    11261121 */
    1127 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
     1122sysarg_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
    11281123{
    11291124        if (!(cap_get(TASK) & CAP_IRQ_REG))
     
    11351130}
    11361131
    1137 #include <console/console.h>
    1138 
    1139 /** Syscall connect to a task by id.
     1132#ifdef __32_BITS__
     1133
     1134/** Syscall connect to a task by ID (32 bits)
    11401135 *
    11411136 * @return Phone id on success, or negative error code.
    11421137 *
    11431138 */
    1144 unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
     1139sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid)
    11451140{
    11461141#ifdef CONFIG_UDEBUG
    1147         sysarg64_t taskid_arg;
    1148         int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
     1142        sysarg64_t taskid;
     1143        int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
    11491144        if (rc != 0)
    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);
     1145                return (sysarg_t) rc;
     1146       
     1147        return ipc_connect_kbox((task_id_t) taskid);
    11551148#else
    1156         return (unative_t) ENOTSUP;
     1149        return (sysarg_t) ENOTSUP;
    11571150#endif
    11581151}
    11591152
     1153#endif  /* __32_BITS__ */
     1154
     1155#ifdef __64_BITS__
     1156
     1157/** Syscall connect to a task by ID (64 bits)
     1158 *
     1159 * @return Phone id on success, or negative error code.
     1160 *
     1161 */
     1162sysarg_t sys_ipc_connect_kbox(sysarg_t taskid)
     1163{
     1164#ifdef CONFIG_UDEBUG
     1165        return ipc_connect_kbox((task_id_t) taskid);
     1166#else
     1167        return (sysarg_t) ENOTSUP;
     1168#endif
     1169}
     1170
     1171#endif  /* __64_BITS__ */
     1172
    11601173/** @}
    11611174 */
Note: See TracChangeset for help on using the changeset viewer.