Ignore:
File:
1 edited

Legend:

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

    rfa3b8e4 rf6bffee  
    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               
     
    246248                        /* The connection was accepted */
    247249                        phone_connect(phoneid, &answer->sender->answerbox);
     250                        /* Set 'task hash' as arg4 of response */
     251                        IPC_SET_ARG4(answer->data, (sysarg_t) TASK);
    248252                        /* Set 'phone hash' as arg5 of response */
    249253                        IPC_SET_ARG5(answer->data,
    250                             (unative_t) &TASK->phones[phoneid]);
    251                 }
    252         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
     254                            (sysarg_t) &TASK->phones[phoneid]);
     255                }
     256        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
    253257                /* If the users accepted call, connect */
    254258                if (IPC_GET_RETVAL(answer->data) == EOK) {
     
    256260                            &TASK->answerbox);
    257261                }
    258         } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_OUT) {
     262        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_OUT) {
    259263                if (!IPC_GET_RETVAL(answer->data)) {
    260264                        /* Accepted, handle as_area receipt */
     
    270274                        return rc;
    271275                }
    272         } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_IN) {
     276        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_IN) {
    273277                if (!IPC_GET_RETVAL(answer->data)) {
    274278                        irq_spinlock_lock(&answer->sender->lock, true);
     
    281285                        IPC_SET_RETVAL(answer->data, rc);
    282286                }
    283         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_READ) {
     287        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_READ) {
    284288                ASSERT(!answer->buffer);
    285289                if (!IPC_GET_RETVAL(answer->data)) {
     
    310314                        }
    311315                }
    312         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) {
     316        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_WRITE) {
    313317                ASSERT(answer->buffer);
    314318                if (!IPC_GET_RETVAL(answer->data)) {
     
    363367static int request_preprocess(call_t *call, phone_t *phone)
    364368{
    365         switch (IPC_GET_METHOD(call->data)) {
     369        switch (IPC_GET_IMETHOD(call->data)) {
    366370        case IPC_M_CONNECTION_CLONE: {
    367371                phone_t *cloned_phone;
     
    399403        }
    400404        case IPC_M_CONNECT_ME:
    401                 IPC_SET_ARG5(call->data, (unative_t) phone);
     405                IPC_SET_ARG5(call->data, (sysarg_t) phone);
    402406                break;
    403407        case IPC_M_CONNECT_ME_TO: {
     
    407411               
    408412                /* Set arg5 for server */
    409                 IPC_SET_ARG5(call->data, (unative_t) &TASK->phones[newphid]);
     413                IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]);
    410414                call->flags |= IPC_CALL_CONN_ME_TO;
    411415                call->priv = newphid;
     
    422426        case IPC_M_DATA_READ: {
    423427                size_t size = IPC_GET_ARG2(call->data);
    424                 if ((size <= 0 || (size > DATA_XFER_LIMIT)))
     428                if (size <= 0)
    425429                        return ELIMIT;
    426                
     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                }
    427437                break;
    428438        }
     
    431441                size_t size = IPC_GET_ARG2(call->data);
    432442               
    433                 if (size > DATA_XFER_LIMIT)
    434                         return ELIMIT;
     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                }
    435451               
    436452                call->buffer = (uint8_t *) malloc(size, 0);
     
    503519static int process_request(answerbox_t *box, call_t *call)
    504520{
    505         if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME) {
     521        if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME) {
    506522                int phoneid = phone_alloc(TASK);
    507523                if (phoneid < 0) { /* Failed to allocate phone */
     
    514530        }
    515531       
    516         switch (IPC_GET_METHOD(call->data)) {
     532        switch (IPC_GET_IMETHOD(call->data)) {
    517533        case IPC_M_DEBUG_ALL:
    518534                return -1;
     
    530546 *
    531547 * @param phoneid Phone handle for the call.
    532  * @param method  Method of the call.
     548 * @param imethod Interface and method of the call.
    533549 * @param arg1    Service-defined payload argument.
    534550 * @param arg2    Service-defined payload argument.
    535551 * @param arg3    Service-defined payload argument.
    536  * @param data    Address of userspace structure where the reply call will
     552 * @param data    Address of user-space structure where the reply call will
    537553 *                be stored.
    538554 *
     
    541557 *
    542558 */
    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)
     559sysarg_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)
    545561{
    546562        phone_t *phone;
    547563        if (phone_get(phoneid, &phone) != EOK)
    548564                return ENOENT;
    549 
     565       
    550566        call_t *call = ipc_call_alloc(0);
    551         IPC_SET_METHOD(call->data, method);
     567        IPC_SET_IMETHOD(call->data, imethod);
    552568        IPC_SET_ARG1(call->data, arg1);
    553569        IPC_SET_ARG2(call->data, arg2);
     
    579595               
    580596                process_answer(call);
    581                
    582597        } else
    583598                IPC_SET_RETVAL(call->data, res);
     
    593608/** Make a synchronous IPC call allowing to transmit the entire payload.
    594609 *
    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.
     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.
    599614 *
    600615 * @return Zero on success or an error code.
    601616 *
    602617 */
    603 unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
     618sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *request,
    604619    ipc_data_t *reply)
    605620{
     
    607622        if (phone_get(phoneid, &phone) != EOK)
    608623                return ENOENT;
    609 
     624       
    610625        call_t *call = ipc_call_alloc(0);
    611         int rc = copy_from_uspace(&call->data.args, &question->args,
     626        int rc = copy_from_uspace(&call->data.args, &request->args,
    612627            sizeof(call->data.args));
    613628        if (rc != 0) {
    614629                ipc_call_free(call);
    615                 return (unative_t) rc;
     630                return (sysarg_t) rc;
    616631        }
    617632       
     
    644659}
    645660
    646 /** Check that the task did not exceed the allowed limit of asynchronous calls.
     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.
    647665 *
    648666 * @return 0 if limit not reached or -1 if limit exceeded.
    649667 *
    650668 */
    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);
     669static int check_call_limit(phone_t *phone)
     670{
     671        if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
    655672                return -1;
    656         }
    657673       
    658674        return 0;
     
    665681 *
    666682 * @param phoneid Phone handle for the call.
    667  * @param method  Method of the call.
     683 * @param imethod Interface and method of the call.
    668684 * @param arg1    Service-defined payload argument.
    669685 * @param arg2    Service-defined payload argument.
     
    677693 *
    678694 */
    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        
     695sysarg_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{
    685698        phone_t *phone;
    686699        if (phone_get(phoneid, &phone) != EOK)
    687700                return IPC_CALLRET_FATAL;
    688701       
     702        if (check_call_limit(phone))
     703                return IPC_CALLRET_TEMPORARY;
     704       
    689705        call_t *call = ipc_call_alloc(0);
    690         IPC_SET_METHOD(call->data, method);
     706        IPC_SET_IMETHOD(call->data, imethod);
    691707        IPC_SET_ARG1(call->data, arg1);
    692708        IPC_SET_ARG2(call->data, arg2);
     
    707723                ipc_backsend_err(phone, call, res);
    708724       
    709         return (unative_t) call;
     725        return (sysarg_t) call;
    710726}
    711727
     
    718734 *
    719735 */
    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        
     736sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data)
     737{
    725738        phone_t *phone;
    726739        if (phone_get(phoneid, &phone) != EOK)
    727740                return IPC_CALLRET_FATAL;
     741
     742        if (check_call_limit(phone))
     743                return IPC_CALLRET_TEMPORARY;
    728744
    729745        call_t *call = ipc_call_alloc(0);
     
    732748        if (rc != 0) {
    733749                ipc_call_free(call);
    734                 return (unative_t) rc;
     750                return (sysarg_t) rc;
    735751        }
    736752       
     
    742758                ipc_backsend_err(phone, call, res);
    743759       
    744         return (unative_t) call;
     760        return (sysarg_t) call;
    745761}
    746762
     
    751767 * @param callid  Hash of the call to forward.
    752768 * @param phoneid Phone handle to use for forwarding.
    753  * @param method  New method to use for the forwarded call.
     769 * @param imethod New interface and method to use for the forwarded call.
    754770 * @param arg1    New value of the first argument for the forwarded call.
    755771 * @param arg2    New value of the second argument for the forwarded call.
     
    767783 *
    768784 */
    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)
     785static 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)
    772788{
    773789        call_t *call = get_call(callid);
     
    784800        }
    785801       
    786         if (!method_is_forwardable(IPC_GET_METHOD(call->data))) {
     802        if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) {
    787803                IPC_SET_RETVAL(call->data, EFORWARD);
    788804                ipc_answer(&TASK->answerbox, call);
     
    791807       
    792808        /*
    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.
     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.
    797813         */
    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)
     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)
    801817                                phone_dealloc(IPC_GET_ARG5(call->data));
    802818                       
    803                         IPC_SET_ARG1(call->data, method);
     819                        IPC_SET_ARG1(call->data, imethod);
    804820                        IPC_SET_ARG2(call->data, arg1);
    805821                        IPC_SET_ARG3(call->data, arg2);
     
    813829                        }
    814830                } else {
    815                         IPC_SET_METHOD(call->data, method);
     831                        IPC_SET_IMETHOD(call->data, imethod);
    816832                        IPC_SET_ARG1(call->data, arg1);
    817833                        IPC_SET_ARG2(call->data, arg2);
     
    829845/** Forward a received call to another destination - fast version.
    830846 *
    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.
     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.
    837853 *
    838854 * @param callid  Hash of the call to forward.
    839855 * @param phoneid Phone handle to use for forwarding.
    840  * @param method  New method to use for the forwarded call.
     856 * @param imethod New interface and method to use for the forwarded call.
    841857 * @param arg1    New value of the first argument for the forwarded call.
    842858 * @param arg2    New value of the second argument for the forwarded call.
     
    846862 *
    847863 */
    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,
     864sysarg_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,
    852868            0, mode, false);
    853869}
     
    856872 *
    857873 * 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.
     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.
    863879 *
    864880 * @param callid  Hash of the call to forward.
     
    870886 *
    871887 */
    872 unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
     888sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid,
    873889    ipc_data_t *data, unsigned int mode)
    874890{
     
    877893            sizeof(newdata.args));
    878894        if (rc != 0)
    879                 return (unative_t) rc;
     895                return (sysarg_t) rc;
    880896       
    881897        return sys_ipc_forward_common(callid, phoneid,
    882             IPC_GET_METHOD(newdata), IPC_GET_ARG1(newdata),
     898            IPC_GET_IMETHOD(newdata), IPC_GET_ARG1(newdata),
    883899            IPC_GET_ARG2(newdata), IPC_GET_ARG3(newdata),
    884900            IPC_GET_ARG4(newdata), IPC_GET_ARG5(newdata), mode, true);
     
    900916 *
    901917 */
    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)
     918sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval,
     919    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    904920{
    905921        /* Do not answer notification callids */
     
    945961 *
    946962 */
    947 unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data)
     963sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data)
    948964{
    949965        /* Do not answer notification callids */
     
    982998 *
    983999 */
    984 unative_t sys_ipc_hangup(unative_t phoneid)
     1000sysarg_t sys_ipc_hangup(sysarg_t phoneid)
    9851001{
    9861002        phone_t *phone;
     
    10081024 *
    10091025 */
    1010 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     1026sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
    10111027    unsigned int flags)
    10121028{
     
    10371053                ipc_call_free(call);
    10381054               
    1039                 return ((unative_t) call) | IPC_CALLID_NOTIFICATION;
     1055                return ((sysarg_t) call) | IPC_CALLID_NOTIFICATION;
    10401056        }
    10411057       
     
    10461062                        ipc_call_free(call);
    10471063                        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);
    10551064                }
    10561065               
     
    10581067                ipc_call_free(call);
    10591068               
    1060                 return ((unative_t) call) | IPC_CALLID_ANSWERED;
     1069                return ((sysarg_t) call) | IPC_CALLID_ANSWERED;
    10611070        }
    10621071       
     
    10861095        }
    10871096       
    1088         return (unative_t) call;
     1097        return (sysarg_t) call;
    10891098}
    10901099
     
    10921101 *
    10931102 */
    1094 unative_t sys_ipc_poke(void)
     1103sysarg_t sys_ipc_poke(void)
    10951104{
    10961105        waitq_unsleep(&TASK->answerbox.wq);
     
    11001109/** Connect an IRQ handler to a task.
    11011110 *
    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.
     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.
    11061115 *
    11071116 * @return EPERM or a return code returned by ipc_irq_register().
    11081117 *
    11091118 */
    1110 unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
     1119sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t imethod,
    11111120    irq_code_t *ucode)
    11121121{
     
    11141123                return EPERM;
    11151124       
    1116         return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
     1125        return ipc_irq_register(&TASK->answerbox, inr, devno, imethod, ucode);
    11171126}
    11181127
     
    11251134 *
    11261135 */
    1127 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
     1136sysarg_t sys_unregister_irq(inr_t inr, devno_t devno)
    11281137{
    11291138        if (!(cap_get(TASK) & CAP_IRQ_REG))
     
    11351144}
    11361145
    1137 #include <console/console.h>
    1138 
    1139 /** Syscall connect to a task by id.
     1146#ifdef __32_BITS__
     1147
     1148/** Syscall connect to a task by ID (32 bits)
    11401149 *
    11411150 * @return Phone id on success, or negative error code.
    11421151 *
    11431152 */
    1144 unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
     1153sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid)
    11451154{
    11461155#ifdef CONFIG_UDEBUG
    1147         sysarg64_t taskid_arg;
    1148         int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
     1156        sysarg64_t taskid;
     1157        int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
    11491158        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);
     1159                return (sysarg_t) rc;
     1160       
     1161        return ipc_connect_kbox((task_id_t) taskid);
    11551162#else
    1156         return (unative_t) ENOTSUP;
     1163        return (sysarg_t) ENOTSUP;
    11571164#endif
    11581165}
    11591166
     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 */
     1176sysarg_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
    11601187/** @}
    11611188 */
Note: See TracChangeset for help on using the changeset viewer.