Changeset 27d293a in mainline
- Timestamp:
- 2007-12-31T16:46:43Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 215e375
- Parents:
- 3115355
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r3115355 r27d293a 160 160 * - ARG1 - dst as_area base adress 161 161 */ 162 #define IPC_M_ AS_AREA_SEND4162 #define IPC_M_SHARE_OUT 4 163 163 164 164 /** Receive as_area over IPC. … … 172 172 * - ARG2 - flags that will be used for sharing 173 173 */ 174 #define IPC_M_ AS_AREA_RECV5174 #define IPC_M_SHARE_IN 5 175 175 176 176 /** Send data to another address space over IPC. -
kernel/generic/src/ipc/sysipc.c
r3115355 r27d293a 113 113 { 114 114 switch (method) { 115 case IPC_M_ AS_AREA_SEND:116 case IPC_M_ AS_AREA_RECV:115 case IPC_M_SHARE_OUT: 116 case IPC_M_SHARE_IN: 117 117 case IPC_M_DATA_WRITE: 118 118 case IPC_M_DATA_READ: … … 142 142 case IPC_M_CONNECT_TO_ME: 143 143 case IPC_M_CONNECT_ME_TO: 144 case IPC_M_ AS_AREA_SEND:145 case IPC_M_ AS_AREA_RECV:144 case IPC_M_SHARE_OUT: 145 case IPC_M_SHARE_IN: 146 146 case IPC_M_DATA_WRITE: 147 147 case IPC_M_DATA_READ: … … 200 200 &TASK->answerbox); 201 201 } 202 } else if (IPC_GET_METHOD(*olddata) == IPC_M_ AS_AREA_SEND) {202 } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_OUT) { 203 203 if (!IPC_GET_RETVAL(answer->data)) { 204 204 /* Accepted, handle as_area receipt */ … … 219 219 return rc; 220 220 } 221 } else if (IPC_GET_METHOD(*olddata) == IPC_M_ AS_AREA_RECV) {221 } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_IN) { 222 222 if (!IPC_GET_RETVAL(answer->data)) { 223 223 ipl_t ipl; … … 314 314 call->priv = newphid; 315 315 break; 316 case IPC_M_ AS_AREA_SEND:316 case IPC_M_SHARE_OUT: 317 317 size = as_area_get_size(IPC_GET_ARG1(call->data)); 318 318 if (!size) -
uspace/app/klog/klog.c
r3115355 r27d293a 64 64 65 65 mapping = as_get_mappable_page(PAGE_SIZE); 66 res = ipc_ call_sync_3_0(PHONE_NS, IPC_M_AS_AREA_RECV,67 (sysarg_t) mapping, PAGE_SIZE,SERVICE_MEM_KLOG);66 res = ipc_share_in_send_1_0(PHONE_NS, mapping, PAGE_SIZE, 67 SERVICE_MEM_KLOG); 68 68 if (res) { 69 69 printf("Failed to initialize klog memarea\n"); -
uspace/lib/libc/generic/ipc.c
r3115355 r27d293a 667 667 } 668 668 669 /** Wrapper for making IPC_M_SHARE_IN calls. 670 * 671 * @param phoneid Phone that will be used to contact the receiving side. 672 * @param dst Destination address space area base. 673 * @param size Size of the destination address space area. 674 * @param arg User defined argument. 675 * @param flags Storage where the received flags will be stored. Can be 676 * NULL. 677 * 678 * @return Zero on success or a negative error code from errno.h. 679 */ 680 int ipc_share_in_send(int phoneid, void *dst, size_t size, ipcarg_t arg, 681 int *flags) 682 { 683 int res; 684 sysarg_t tmp_flags; 685 res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst, 686 (ipcarg_t) size, arg, NULL, &tmp_flags); 687 if (flags) 688 *flags = tmp_flags; 689 return res; 690 } 691 692 /** Wrapper for receiving the IPC_M_SHARE_IN calls. 693 * 694 * This wrapper only makes it more comfortable to receive IPC_M_SHARE_IN calls 695 * so that the user doesn't have to remember the meaning of each IPC argument. 696 * 697 * So far, this wrapper is to be used from within a connection fibril. 698 * 699 * @param callid Storage where the hash of the IPC_M_SHARE_IN call will 700 * be stored. 701 * @param size Destination address space area size. 702 * 703 * @return Non-zero on success, zero on failure. 704 */ 705 int ipc_share_in_receive(ipc_callid_t *callid, size_t *size) 706 { 707 ipc_call_t data; 708 709 assert(callid); 710 assert(size); 711 712 *callid = async_get_call(&data); 713 if (IPC_GET_METHOD(data) != IPC_M_SHARE_IN) 714 return 0; 715 *size = (size_t) IPC_GET_ARG2(data); 716 return 1; 717 } 718 719 /** Wrapper for answering the IPC_M_SHARE_IN calls. 720 * 721 * This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls 722 * so that the user doesn't have to remember the meaning of each IPC argument. 723 * 724 * @param callid Hash of the IPC_M_DATA_READ call to answer. 725 * @param src Source address space base. 726 * @param flags Flags to be used for sharing. Bits can be only cleared. 727 * 728 * @return Zero on success or a value from @ref errno.h on failure. 729 */ 730 int ipc_share_in_deliver(ipc_callid_t callid, void *src, int flags) 731 { 732 return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) flags); 733 } 734 735 /** Wrapper for making IPC_M_SHARE_OUT calls. 736 * 737 * @param phoneid Phone that will be used to contact the receiving side. 738 * @param src Source address space area base address. 739 * @param flags Flags to be used for sharing. Bits can be only cleared. 740 * 741 * @return Zero on success or a negative error code from errno.h. 742 */ 743 int ipc_share_out_send(int phoneid, void *src, int flags) 744 { 745 return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0, 746 (ipcarg_t) flags); 747 } 748 749 /** Wrapper for receiving the IPC_M_SHARE_OUT calls. 750 * 751 * This wrapper only makes it more comfortable to receive IPC_M_SHARE_OUT calls 752 * so that the user doesn't have to remember the meaning of each IPC argument. 753 * 754 * So far, this wrapper is to be used from within a connection fibril. 755 * 756 * @param callid Storage where the hash of the IPC_M_SHARE_OUT call will 757 * be stored. 758 * @param size Storage where the source address space area size will be 759 * stored. 760 * @param flags Storage where the sharing flags will be stored. 761 * 762 * @return Non-zero on success, zero on failure. 763 */ 764 int ipc_share_out_receive(ipc_callid_t *callid, size_t *size, int *flags) 765 { 766 ipc_call_t data; 767 768 assert(callid); 769 assert(size); 770 assert(flags); 771 772 *callid = async_get_call(&data); 773 if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE) 774 return 0; 775 *size = (size_t) IPC_GET_ARG2(data); 776 *flags = (int) IPC_GET_ARG3(data); 777 return 1; 778 } 779 780 /** Wrapper for answering the IPC_M_SHARE_OUT calls. 781 * 782 * This wrapper only makes it more comfortable to answer IPC_M_SHARE_OUT calls 783 * so that the user doesn't have to remember the meaning of each IPC argument. 784 * 785 * @param callid Hash of the IPC_M_DATA_WRITE call to answer. 786 * @param dst Destination address space area base address. 787 * 788 * @return Zero on success or a value from @ref errno.h on failure. 789 */ 790 int ipc_share_out_deliver(ipc_callid_t callid, void *dst) 791 { 792 return ipc_answer_1(callid, EOK, (ipcarg_t) dst); 793 } 794 795 669 796 /** Wrapper for making IPC_M_DATA_READ calls. 670 797 * -
uspace/lib/libc/generic/time.c
r3115355 r27d293a 136 136 void *mapping; 137 137 sysarg_t s1, s2; 138 sysarg_t rights;138 int rights; 139 139 int res; 140 140 … … 142 142 mapping = as_get_mappable_page(PAGE_SIZE); 143 143 /* Get the mapping of kernel clock */ 144 res = ipc_call_sync_3_2(PHONE_NS, IPC_M_AS_AREA_RECV, 145 (sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_REALTIME, NULL, 146 &rights); 144 res = ipc_share_in_send_1_1(PHONE_NS, mapping, PAGE_SIZE, 145 SERVICE_MEM_REALTIME, &rights); 147 146 if (res) { 148 147 printf("Failed to initialize timeofday memarea\n"); -
uspace/lib/libc/include/ipc/ipc.h
r3115355 r27d293a 263 263 264 264 265 /* 266 * User-friendly wrappers for ipc_share_in_send(). 267 */ 268 #define ipc_share_in_send_0_0(phoneid, dst, size) \ 269 ipc_share_in_send((phoneid), (dst), (size), 0, NULL) 270 #define ipc_share_in_send_0_1(phoneid, dst, size, flags) \ 271 ipc_share_in_send((phoneid), (dst), (size), 0, (flags)) 272 #define ipc_share_in_send_1_0(phoneid, dst, size, arg) \ 273 ipc_share_in_send((phoneid), (dst), (size), (arg), NULL) 274 #define ipc_share_in_send_1_1(phoneid, dst, size, arg, flags) \ 275 ipc_share_in_send((phoneid), (dst), (size), (arg), (flags)) 276 277 extern int ipc_share_in_send(int phoneid, void *dst, size_t size, ipcarg_t arg, 278 int *flags); 279 extern int ipc_share_in_receive(ipc_callid_t *callid, size_t *size); 280 extern int ipc_share_in_deliver(ipc_callid_t callid, void *src, int flags); 281 extern int ipc_share_out_send(int phoneid, void *src, int flags); 282 extern int ipc_share_out_receive(ipc_callid_t *callid, size_t *size, int *flags); 283 extern int ipc_share_out_deliver(ipc_callid_t callid, void *dst); 265 284 extern int ipc_data_read_send(int phoneid, void *dst, size_t size); 266 285 extern int ipc_data_read_receive(ipc_callid_t *callid, size_t *size); -
uspace/lib/libfs/libfs.c
r3115355 r27d293a 95 95 * Request sharing the Path Lookup Buffer with VFS. 96 96 */ 97 rc = ipc_call_sync_2_0(vfs_phone, IPC_M_AS_AREA_RECV, 98 (ipcarg_t) reg->plb_ro, PLB_SIZE); 97 rc = ipc_share_in_send_0_0(vfs_phone, reg->plb_ro, PLB_SIZE); 99 98 if (rc) { 100 99 async_wait_for(req, NULL); -
uspace/srv/console/console.c
r3115355 r27d293a 538 538 PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 539 539 if (!interbuffer) { 540 if ( async_req_3_0(fb_info.phone, IPC_M_AS_AREA_SEND,541 (ipcarg_t) interbuffer, 0, AS_AREA_READ) != 0) {540 if (ipc_share_out_send(fb_info.phone, interbuffer, 541 AS_AREA_READ) != EOK) { 542 542 munmap(interbuffer, 543 543 sizeof(keyfield_t) * fb_info.cols * fb_info.rows); -
uspace/srv/console/gcons.c
r3115355 r27d293a 326 326 if (rc) 327 327 goto exit; 328 rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, 329 PROTO_READ); 328 rc = ipc_share_out_send(fbphone, shm, PROTO_READ); 330 329 if (rc) 331 330 goto drop; … … 388 387 if (rc) 389 388 goto exit; 390 rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, 391 PROTO_READ); 389 rc = ipc_share_out_send(fbphone, shm, PROTO_READ); 392 390 if (rc) 393 391 goto drop; -
uspace/srv/fb/ega.c
r3115355 r27d293a 209 209 ipc_answer_0(callid, EOK); 210 210 return; /* Exit thread */ 211 case IPC_M_ AS_AREA_SEND:211 case IPC_M_SHARE_OUT: 212 212 /* We accept one area for data interchange */ 213 213 intersize = IPC_GET_ARG2(call); -
uspace/srv/fb/fb.c
r3115355 r27d293a 748 748 749 749 switch (IPC_GET_METHOD(*call)) { 750 case IPC_M_ AS_AREA_SEND:750 case IPC_M_SHARE_OUT: 751 751 /* We accept one area for data interchange */ 752 752 if (IPC_GET_ARG1(*call) == shm_id) { -
uspace/srv/ns/ns.c
r3115355 r27d293a 118 118 callid = ipc_wait_for_call(&call); 119 119 switch (IPC_GET_METHOD(call)) { 120 case IPC_M_ AS_AREA_RECV:120 case IPC_M_SHARE_IN: 121 121 switch (IPC_GET_ARG3(call)) { 122 122 case SERVICE_MEM_REALTIME: -
uspace/srv/rd/rd.c
r3115355 r27d293a 104 104 * Now we wait for the client to send us its communication as_area. 105 105 */ 106 callid = async_get_call(&call);107 if ( IPC_GET_METHOD(call) == IPC_M_AS_AREA_SEND) {108 if ( IPC_GET_ARG1(call) >= (ipcarg_t)BLOCK_SIZE) {106 size_t size; 107 if (ipc_share_out_receive(&callid, &size, NULL)) { 108 if (size >= BLOCK_SIZE) { 109 109 /* 110 110 * The client sends an as_area that can absorb the whole 111 111 * block. 112 112 */ 113 ipc_answer_1(callid, EOK, (uintptr_t)fs_va);113 (void) ipc_share_out_deliver(callid, fs_va); 114 114 } else { 115 115 /* -
uspace/srv/vfs/vfs_register.c
r3115355 r27d293a 271 271 * The client will want us to send him the address space area with PLB. 272 272 */ 273 callid = async_get_call(&call); 274 if ( IPC_GET_METHOD(call) != IPC_M_AS_AREA_RECV) {273 274 if (!ipc_share_in_receive(&callid, &size)) { 275 275 dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call)); 276 276 list_remove(&fs_info->fs_link); … … 286 286 * We can only send the client address space area PLB_SIZE bytes long. 287 287 */ 288 size = IPC_GET_ARG2(call);289 288 if (size != PLB_SIZE) { 290 289 dprintf("Client suggests wrong size of PFB, size = %d\n", size); … … 301 300 * Commit to read-only sharing the PLB with the client. 302 301 */ 303 ipc_answer_2(callid, EOK, (ipcarg_t)plb,304 (ipcarg_t) (AS_AREA_READ | AS_AREA_CACHEABLE));302 (void) ipc_share_in_deliver(callid, plb, 303 AS_AREA_READ | AS_AREA_CACHEABLE); 305 304 306 305 dprintf("Sharing PLB.\n");
Note:
See TracChangeset
for help on using the changeset viewer.