Changes in kernel/generic/src/ipc/sysipc.c [fa3b8e4:f6bffee] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
rfa3b8e4 rf6bffee 49 49 #include <syscall/copy.h> 50 50 #include <security/cap.h> 51 #include <console/console.h> 51 52 #include <mm/as.h> 52 53 #include <print.h> … … 68 69 * 69 70 */ 70 static int phone_get( unative_t phoneid, phone_t **phone)71 static int phone_get(sysarg_t phoneid, phone_t **phone) 71 72 { 72 73 if (phoneid >= IPC_MAX_PHONES) … … 77 78 } 78 79 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 */ 88 static inline bool method_is_system(sysarg_t imethod) 89 { 90 if (imethod <= IPC_M_LAST_SYSTEM) 89 91 return true; 90 92 … … 92 94 } 93 95 94 /** Decide if the message with this method is forwardable.95 * 96 * - some system messages may be forwarded, for some of them97 * it is useless98 * 99 * @param method Method to be decided.100 * 101 * @return true if themethod is forwardable.102 * 103 */ 104 static inline bool method_is_forwardable( unative_tmethod)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 */ 106 static inline bool method_is_forwardable(sysarg_t imethod) 107 { 108 switch (imethod) { 107 109 case IPC_M_CONNECTION_CLONE: 108 110 case IPC_M_CONNECT_ME: … … 115 117 } 116 118 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 altered120 * 121 * @param method Method to be decided.122 * 123 * @return true if themethod is immutable on forward.124 * 125 */ 126 static inline bool method_is_immutable( unative_tmethod)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 */ 128 static inline bool method_is_immutable(sysarg_t imethod) 129 { 130 switch (imethod) { 129 131 case IPC_M_SHARE_OUT: 130 132 case IPC_M_SHARE_IN: … … 152 154 static inline bool answer_need_old(call_t *call) 153 155 { 154 switch (IPC_GET_ METHOD(call->data)) {156 switch (IPC_GET_IMETHOD(call->data)) { 155 157 case IPC_M_CONNECTION_CLONE: 156 158 case IPC_M_CONNECT_ME: … … 196 198 return 0; 197 199 198 if (IPC_GET_ METHOD(*olddata) == IPC_M_CONNECTION_CLONE) {200 if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECTION_CLONE) { 199 201 int phoneid = IPC_GET_ARG1(*olddata); 200 202 phone_t *phone = &TASK->phones[phoneid]; … … 218 220 mutex_unlock(&phone->lock); 219 221 } 220 } else if (IPC_GET_ METHOD(*olddata) == IPC_M_CONNECT_ME) {222 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME) { 221 223 phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata); 222 224 … … 237 239 mutex_unlock(&phone->lock); 238 240 } 239 } else if (IPC_GET_ METHOD(*olddata) == IPC_M_CONNECT_TO_ME) {241 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_TO_ME) { 240 242 int phoneid = IPC_GET_ARG5(*olddata); 241 243 … … 246 248 /* The connection was accepted */ 247 249 phone_connect(phoneid, &answer->sender->answerbox); 250 /* Set 'task hash' as arg4 of response */ 251 IPC_SET_ARG4(answer->data, (sysarg_t) TASK); 248 252 /* Set 'phone hash' as arg5 of response */ 249 253 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) { 253 257 /* If the users accepted call, connect */ 254 258 if (IPC_GET_RETVAL(answer->data) == EOK) { … … 256 260 &TASK->answerbox); 257 261 } 258 } else if (IPC_GET_ METHOD(*olddata) == IPC_M_SHARE_OUT) {262 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_OUT) { 259 263 if (!IPC_GET_RETVAL(answer->data)) { 260 264 /* Accepted, handle as_area receipt */ … … 270 274 return rc; 271 275 } 272 } else if (IPC_GET_ METHOD(*olddata) == IPC_M_SHARE_IN) {276 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_IN) { 273 277 if (!IPC_GET_RETVAL(answer->data)) { 274 278 irq_spinlock_lock(&answer->sender->lock, true); … … 281 285 IPC_SET_RETVAL(answer->data, rc); 282 286 } 283 } else if (IPC_GET_ METHOD(*olddata) == IPC_M_DATA_READ) {287 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_READ) { 284 288 ASSERT(!answer->buffer); 285 289 if (!IPC_GET_RETVAL(answer->data)) { … … 310 314 } 311 315 } 312 } else if (IPC_GET_ METHOD(*olddata) == IPC_M_DATA_WRITE) {316 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_WRITE) { 313 317 ASSERT(answer->buffer); 314 318 if (!IPC_GET_RETVAL(answer->data)) { … … 363 367 static int request_preprocess(call_t *call, phone_t *phone) 364 368 { 365 switch (IPC_GET_ METHOD(call->data)) {369 switch (IPC_GET_IMETHOD(call->data)) { 366 370 case IPC_M_CONNECTION_CLONE: { 367 371 phone_t *cloned_phone; … … 399 403 } 400 404 case IPC_M_CONNECT_ME: 401 IPC_SET_ARG5(call->data, ( unative_t) phone);405 IPC_SET_ARG5(call->data, (sysarg_t) phone); 402 406 break; 403 407 case IPC_M_CONNECT_ME_TO: { … … 407 411 408 412 /* 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]); 410 414 call->flags |= IPC_CALL_CONN_ME_TO; 411 415 call->priv = newphid; … … 422 426 case IPC_M_DATA_READ: { 423 427 size_t size = IPC_GET_ARG2(call->data); 424 if ( (size <= 0 || (size > DATA_XFER_LIMIT)))428 if (size <= 0) 425 429 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 } 427 437 break; 428 438 } … … 431 441 size_t size = IPC_GET_ARG2(call->data); 432 442 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 } 435 451 436 452 call->buffer = (uint8_t *) malloc(size, 0); … … 503 519 static int process_request(answerbox_t *box, call_t *call) 504 520 { 505 if (IPC_GET_ METHOD(call->data) == IPC_M_CONNECT_TO_ME) {521 if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME) { 506 522 int phoneid = phone_alloc(TASK); 507 523 if (phoneid < 0) { /* Failed to allocate phone */ … … 514 530 } 515 531 516 switch (IPC_GET_ METHOD(call->data)) {532 switch (IPC_GET_IMETHOD(call->data)) { 517 533 case IPC_M_DEBUG_ALL: 518 534 return -1; … … 530 546 * 531 547 * @param phoneid Phone handle for the call. 532 * @param method Method of the call.548 * @param imethod Interface and method of the call. 533 549 * @param arg1 Service-defined payload argument. 534 550 * @param arg2 Service-defined payload argument. 535 551 * @param arg3 Service-defined payload argument. 536 * @param data Address of user space structure where the reply call will552 * @param data Address of user-space structure where the reply call will 537 553 * be stored. 538 554 * … … 541 557 * 542 558 */ 543 unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_tmethod,544 unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)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) 545 561 { 546 562 phone_t *phone; 547 563 if (phone_get(phoneid, &phone) != EOK) 548 564 return ENOENT; 549 565 550 566 call_t *call = ipc_call_alloc(0); 551 IPC_SET_ METHOD(call->data,method);567 IPC_SET_IMETHOD(call->data, imethod); 552 568 IPC_SET_ARG1(call->data, arg1); 553 569 IPC_SET_ARG2(call->data, arg2); … … 579 595 580 596 process_answer(call); 581 582 597 } else 583 598 IPC_SET_RETVAL(call->data, res); … … 593 608 /** Make a synchronous IPC call allowing to transmit the entire payload. 594 609 * 595 * @param phoneid 596 * @param question Userspace address of call data with the request.597 * @param reply Userspace address of call data where to store the598 * 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. 599 614 * 600 615 * @return Zero on success or an error code. 601 616 * 602 617 */ 603 unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,618 sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *request, 604 619 ipc_data_t *reply) 605 620 { … … 607 622 if (phone_get(phoneid, &phone) != EOK) 608 623 return ENOENT; 609 624 610 625 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, 612 627 sizeof(call->data.args)); 613 628 if (rc != 0) { 614 629 ipc_call_free(call); 615 return ( unative_t) rc;630 return (sysarg_t) rc; 616 631 } 617 632 … … 644 659 } 645 660 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. 647 665 * 648 666 * @return 0 if limit not reached or -1 if limit exceeded. 649 667 * 650 668 */ 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); 669 static int check_call_limit(phone_t *phone) 670 { 671 if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS) 655 672 return -1; 656 }657 673 658 674 return 0; … … 665 681 * 666 682 * @param phoneid Phone handle for the call. 667 * @param method Method of the call.683 * @param imethod Interface and method of the call. 668 684 * @param arg1 Service-defined payload argument. 669 685 * @param arg2 Service-defined payload argument. … … 677 693 * 678 694 */ 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 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 { 685 698 phone_t *phone; 686 699 if (phone_get(phoneid, &phone) != EOK) 687 700 return IPC_CALLRET_FATAL; 688 701 702 if (check_call_limit(phone)) 703 return IPC_CALLRET_TEMPORARY; 704 689 705 call_t *call = ipc_call_alloc(0); 690 IPC_SET_ METHOD(call->data,method);706 IPC_SET_IMETHOD(call->data, imethod); 691 707 IPC_SET_ARG1(call->data, arg1); 692 708 IPC_SET_ARG2(call->data, arg2); … … 707 723 ipc_backsend_err(phone, call, res); 708 724 709 return ( unative_t) call;725 return (sysarg_t) call; 710 726 } 711 727 … … 718 734 * 719 735 */ 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 736 sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data) 737 { 725 738 phone_t *phone; 726 739 if (phone_get(phoneid, &phone) != EOK) 727 740 return IPC_CALLRET_FATAL; 741 742 if (check_call_limit(phone)) 743 return IPC_CALLRET_TEMPORARY; 728 744 729 745 call_t *call = ipc_call_alloc(0); … … 732 748 if (rc != 0) { 733 749 ipc_call_free(call); 734 return ( unative_t) rc;750 return (sysarg_t) rc; 735 751 } 736 752 … … 742 758 ipc_backsend_err(phone, call, res); 743 759 744 return ( unative_t) call;760 return (sysarg_t) call; 745 761 } 746 762 … … 751 767 * @param callid Hash of the call to forward. 752 768 * @param phoneid Phone handle to use for forwarding. 753 * @param method Newmethod to use for the forwarded call.769 * @param imethod New interface and method to use for the forwarded call. 754 770 * @param arg1 New value of the first argument for the forwarded call. 755 771 * @param arg2 New value of the second argument for the forwarded call. … … 767 783 * 768 784 */ 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)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) 772 788 { 773 789 call_t *call = get_call(callid); … … 784 800 } 785 801 786 if (!method_is_forwardable(IPC_GET_ METHOD(call->data))) {802 if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) { 787 803 IPC_SET_RETVAL(call->data, EFORWARD); 788 804 ipc_answer(&TASK->answerbox, call); … … 791 807 792 808 /* 793 * Userspace is not allowed to change method of system methods on794 * 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. 797 813 */ 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) 801 817 phone_dealloc(IPC_GET_ARG5(call->data)); 802 818 803 IPC_SET_ARG1(call->data, method);819 IPC_SET_ARG1(call->data, imethod); 804 820 IPC_SET_ARG2(call->data, arg1); 805 821 IPC_SET_ARG3(call->data, arg2); … … 813 829 } 814 830 } else { 815 IPC_SET_ METHOD(call->data,method);831 IPC_SET_IMETHOD(call->data, imethod); 816 832 IPC_SET_ARG1(call->data, arg1); 817 833 IPC_SET_ARG2(call->data, arg2); … … 829 845 /** Forward a received call to another destination - fast version. 830 846 * 831 * In case the original method is a system method, ARG1, ARG2 and ARG3 are832 * overwritten in the forwarded message with the new method and the new833 * arg1 and arg2, respectively. Otherwise the METHOD, ARG1 and ARG2 are834 * rewritten with the new method, arg1 and arg2, respectively. Also note there835 * is a set of immutable methods, for which the new method and arguments are not836 * 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. 837 853 * 838 854 * @param callid Hash of the call to forward. 839 855 * @param phoneid Phone handle to use for forwarding. 840 * @param method Newmethod to use for the forwarded call.856 * @param imethod New interface and method to use for the forwarded call. 841 857 * @param arg1 New value of the first argument for the forwarded call. 842 858 * @param arg2 New value of the second argument for the forwarded call. … … 846 862 * 847 863 */ 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,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, 852 868 0, mode, false); 853 869 } … … 856 872 * 857 873 * 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 system860 * methods, it additionally stores the new value of arg3 to ARG4. For non-system861 * 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. 863 879 * 864 880 * @param callid Hash of the call to forward. … … 870 886 * 871 887 */ 872 unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,888 sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid, 873 889 ipc_data_t *data, unsigned int mode) 874 890 { … … 877 893 sizeof(newdata.args)); 878 894 if (rc != 0) 879 return ( unative_t) rc;895 return (sysarg_t) rc; 880 896 881 897 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), 883 899 IPC_GET_ARG2(newdata), IPC_GET_ARG3(newdata), 884 900 IPC_GET_ARG4(newdata), IPC_GET_ARG5(newdata), mode, true); … … 900 916 * 901 917 */ 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)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) 904 920 { 905 921 /* Do not answer notification callids */ … … 945 961 * 946 962 */ 947 unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data)963 sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data) 948 964 { 949 965 /* Do not answer notification callids */ … … 982 998 * 983 999 */ 984 unative_t sys_ipc_hangup(unative_t phoneid)1000 sysarg_t sys_ipc_hangup(sysarg_t phoneid) 985 1001 { 986 1002 phone_t *phone; … … 1008 1024 * 1009 1025 */ 1010 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,1026 sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, 1011 1027 unsigned int flags) 1012 1028 { … … 1037 1053 ipc_call_free(call); 1038 1054 1039 return (( unative_t) call) | IPC_CALLID_NOTIFICATION;1055 return ((sysarg_t) call) | IPC_CALLID_NOTIFICATION; 1040 1056 } 1041 1057 … … 1046 1062 ipc_call_free(call); 1047 1063 goto restart; 1048 } else {1049 /*1050 * Decrement the counter of active calls only if the1051 * 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);1055 1064 } 1056 1065 … … 1058 1067 ipc_call_free(call); 1059 1068 1060 return (( unative_t) call) | IPC_CALLID_ANSWERED;1069 return ((sysarg_t) call) | IPC_CALLID_ANSWERED; 1061 1070 } 1062 1071 … … 1086 1095 } 1087 1096 1088 return ( unative_t) call;1097 return (sysarg_t) call; 1089 1098 } 1090 1099 … … 1092 1101 * 1093 1102 */ 1094 unative_t sys_ipc_poke(void)1103 sysarg_t sys_ipc_poke(void) 1095 1104 { 1096 1105 waitq_unsleep(&TASK->answerbox.wq); … … 1100 1109 /** Connect an IRQ handler to a task. 1101 1110 * 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. 1106 1115 * 1107 1116 * @return EPERM or a return code returned by ipc_irq_register(). 1108 1117 * 1109 1118 */ 1110 unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_tmethod,1119 sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t imethod, 1111 1120 irq_code_t *ucode) 1112 1121 { … … 1114 1123 return EPERM; 1115 1124 1116 return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);1125 return ipc_irq_register(&TASK->answerbox, inr, devno, imethod, ucode); 1117 1126 } 1118 1127 … … 1125 1134 * 1126 1135 */ 1127 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)1136 sysarg_t sys_unregister_irq(inr_t inr, devno_t devno) 1128 1137 { 1129 1138 if (!(cap_get(TASK) & CAP_IRQ_REG)) … … 1135 1144 } 1136 1145 1137 #i nclude <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) 1140 1149 * 1141 1150 * @return Phone id on success, or negative error code. 1142 1151 * 1143 1152 */ 1144 unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)1153 sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid) 1145 1154 { 1146 1155 #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)); 1149 1158 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); 1155 1162 #else 1156 return ( unative_t) ENOTSUP;1163 return (sysarg_t) ENOTSUP; 1157 1164 #endif 1158 1165 } 1159 1166 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 1160 1187 /** @} 1161 1188 */
Note:
See TracChangeset
for help on using the changeset viewer.