Changeset bb97118 in mainline
- Timestamp:
- 2019-02-06T13:25:12Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eb13ef8
- Parents:
- d066259
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-02 13:29:26)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-06 13:25:12)
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
abi/include/abi/cap.h
rd066259 rbb97118 36 36 #define ABI_CAP_H_ 37 37 38 #include <stdbool.h> 39 #include <stdint.h> 40 38 41 #define CAP_NIL 0 39 40 #define CAP_HANDLE_VALID(handle) ((handle) != CAP_NIL)41 #define CAP_HANDLE_RAW(handle) ((intptr_t) (handle))42 42 43 43 typedef void *cap_handle_t; … … 55 55 } *cap_waitq_handle_t; 56 56 57 static inline bool cap_handle_valid(cap_handle_t handle) 58 { 59 return handle != CAP_NIL; 60 } 61 62 static inline intptr_t cap_handle_raw(cap_handle_t handle) 63 { 64 return (intptr_t) handle; 65 } 66 57 67 #endif 58 68 -
kernel/generic/src/cap/cap.c
rd066259 rbb97118 98 98 { 99 99 cap_t *cap = hash_table_get_inst(item, cap_t, caps_link); 100 return hash_mix( CAP_HANDLE_RAW(cap->handle));100 return hash_mix(cap_handle_raw(cap->handle)); 101 101 } 102 102 … … 104 104 { 105 105 cap_handle_t *handle = (cap_handle_t *) key; 106 return hash_mix( CAP_HANDLE_RAW(*handle));106 return hash_mix(cap_handle_raw(*handle)); 107 107 } 108 108 … … 232 232 assert(mutex_locked(&task->cap_info->lock)); 233 233 234 if (( CAP_HANDLE_RAW(handle) < CAPS_START) ||235 ( CAP_HANDLE_RAW(handle) > CAPS_LAST))234 if ((cap_handle_raw(handle) < CAPS_START) || 235 (cap_handle_raw(handle) > CAPS_LAST)) 236 236 return NULL; 237 237 ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle); … … 383 383 void cap_free(task_t *task, cap_handle_t handle) 384 384 { 385 assert( CAP_HANDLE_RAW(handle) >= CAPS_START);386 assert( CAP_HANDLE_RAW(handle) <= CAPS_LAST);385 assert(cap_handle_raw(handle) >= CAPS_START); 386 assert(cap_handle_raw(handle) <= CAPS_LAST); 387 387 388 388 mutex_lock(&task->cap_info->lock); … … 392 392 393 393 hash_table_remove_item(&task->cap_info->caps, &cap->caps_link); 394 ra_free(task->cap_info->handles, CAP_HANDLE_RAW(handle), 1);394 ra_free(task->cap_info->handles, cap_handle_raw(handle), 1); 395 395 slab_free(cap_cache, cap); 396 396 mutex_unlock(&task->cap_info->lock); -
kernel/generic/src/ipc/ipc.c
rd066259 rbb97118 931 931 mutex_lock(&phone->lock); 932 932 if (phone->state != IPC_PHONE_FREE) { 933 printf("%-11d %7" PRIun " ", (int) CAP_HANDLE_RAW(cap->handle),933 printf("%-11d %7" PRIun " ", (int) cap_handle_raw(cap->handle), 934 934 atomic_load(&phone->active_calls)); 935 935 -
kernel/generic/src/ipc/ops/conctmeto.c
rd066259 rbb97118 68 68 cap_phone_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(call->data); 69 69 70 if ( CAP_HANDLE_RAW(phandle) < 0)70 if (cap_handle_raw(phandle) < 0) 71 71 return EOK; 72 72 … … 113 113 114 114 if (IPC_GET_RETVAL(answer->data)) { 115 if ( CAP_HANDLE_RAW(phandle) >= 0) {115 if (cap_handle_raw(phandle) >= 0) { 116 116 /* 117 117 * Cleanup the unpublished capability and drop -
kernel/generic/src/ipc/ops/concttome.c
rd066259 rbb97118 52 52 } 53 53 call->priv = (sysarg_t) pobj; 54 IPC_SET_ARG5(call->data, CAP_HANDLE_RAW(phandle));54 IPC_SET_ARG5(call->data, cap_handle_raw(phandle)); 55 55 return 0; 56 56 } … … 61 61 kobject_t *pobj = (kobject_t *) answer->priv; 62 62 63 if ( CAP_HANDLE_VALID(phandle)) {63 if (cap_handle_valid(phandle)) { 64 64 kobject_put(pobj); 65 65 cap_free(TASK, phandle); … … 77 77 /* The connection was not accepted */ 78 78 answer_cleanup(answer, olddata); 79 } else if ( CAP_HANDLE_VALID(phandle)) {79 } else if (cap_handle_valid(phandle)) { 80 80 /* 81 81 * The connection was accepted -
kernel/generic/src/ipc/sysipc.c
rd066259 rbb97118 841 841 842 842 error: 843 if ( CAP_HANDLE_VALID(handle))843 if (cap_handle_valid(handle)) 844 844 cap_free(TASK, handle); 845 845 -
uspace/app/trace/ipcp.c
rd066259 rbb97118 75 75 { 76 76 cap_call_handle_t *chandle = (cap_call_handle_t *) key; 77 return CAP_HANDLE_RAW(*chandle);77 return cap_handle_raw(*chandle); 78 78 } 79 79 … … 81 81 { 82 82 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 83 return CAP_HANDLE_RAW(hs->call_handle);83 return cap_handle_raw(hs->call_handle); 84 84 } 85 85 … … 104 104 // XXX: there is no longer a limit on the number of phones as phones are 105 105 // now handled using capabilities 106 if ( CAP_HANDLE_RAW(phone) < 0 || CAP_HANDLE_RAW(phone) >= MAX_PHONE)106 if (cap_handle_raw(phone) < 0 || cap_handle_raw(phone) >= MAX_PHONE) 107 107 return; 108 connections[ CAP_HANDLE_RAW(phone)].server = server;109 connections[ CAP_HANDLE_RAW(phone)].proto = proto;110 have_conn[ CAP_HANDLE_RAW(phone)] = 1;108 connections[cap_handle_raw(phone)].server = server; 109 connections[cap_handle_raw(phone)].proto = proto; 110 have_conn[cap_handle_raw(phone)] = 1; 111 111 } 112 112 113 113 void ipcp_connection_clear(cap_phone_handle_t phone) 114 114 { 115 have_conn[ CAP_HANDLE_RAW(phone)] = 0;116 connections[ CAP_HANDLE_RAW(phone)].server = 0;117 connections[ CAP_HANDLE_RAW(phone)].proto = NULL;115 have_conn[cap_handle_raw(phone)] = 0; 116 connections[cap_handle_raw(phone)].server = 0; 117 connections[cap_handle_raw(phone)].proto = NULL; 118 118 } 119 119 … … 184 184 int i; 185 185 186 if (have_conn[ CAP_HANDLE_RAW(phandle)])187 proto = connections[ CAP_HANDLE_RAW(phandle)].proto;186 if (have_conn[cap_handle_raw(phandle)]) 187 proto = connections[cap_handle_raw(phandle)].proto; 188 188 else 189 189 proto = NULL; -
uspace/drv/bus/usb/ohci/hc.c
rd066259 rbb97118 514 514 515 515 /* Enable interrupts */ 516 if ( CAP_HANDLE_VALID(instance->base.irq_handle)) {516 if (cap_handle_valid(instance->base.irq_handle)) { 517 517 OHCI_WR(instance->registers->interrupt_enable, 518 518 OHCI_USED_INTERRUPTS); -
uspace/drv/bus/usb/uhci/hc.c
rd066259 rbb97118 295 295 pio_write_32(®isters->flbaseadd, pa); 296 296 297 if ( CAP_HANDLE_VALID(instance->base.irq_handle)) {297 if (cap_handle_valid(instance->base.irq_handle)) { 298 298 /* Enable all interrupts, but resume interrupt */ 299 299 pio_write_16(&instance->registers->usbintr, -
uspace/drv/bus/usb/xhci/hc.c
rd066259 rbb97118 494 494 XHCI_REG_WR(intr0, XHCI_INTR_ERSTBA, erstba_phys); 495 495 496 if ( CAP_HANDLE_VALID(hc->base.irq_handle)) {496 if (cap_handle_valid(hc->base.irq_handle)) { 497 497 XHCI_REG_SET(intr0, XHCI_INTR_IE, 1); 498 498 XHCI_REG_SET(hc->op_regs, XHCI_OP_INTE, 1); -
uspace/drv/char/msim-con/msim-con.c
rd066259 rbb97118 156 156 return EOK; 157 157 error: 158 if ( CAP_HANDLE_VALID(con->irq_handle))158 if (cap_handle_valid(con->irq_handle)) 159 159 async_irq_unsubscribe(con->irq_handle); 160 160 if (bound) -
uspace/drv/char/pc-lpt/pc-lpt.c
rd066259 rbb97118 173 173 return EOK; 174 174 error: 175 if ( CAP_HANDLE_VALID(lpt->irq_handle))175 if (cap_handle_valid(lpt->irq_handle)) 176 176 async_irq_unsubscribe(lpt->irq_handle); 177 177 if (bound) -
uspace/lib/c/generic/async/client.c
rd066259 rbb97118 1260 1260 { 1261 1261 return async_req_5_0(exch, IPC_M_STATE_CHANGE_AUTHORIZE, 1262 arg1, arg2, arg3, 0, CAP_HANDLE_RAW(other_exch->phone));1262 arg1, arg2, arg3, 0, cap_handle_raw(other_exch->phone)); 1263 1263 } 1264 1264 -
uspace/lib/c/generic/async/server.c
rd066259 rbb97118 1735 1735 1736 1736 if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) || 1737 ! CAP_HANDLE_VALID((phandle))) {1737 !cap_handle_valid((phandle))) { 1738 1738 async_answer_0(&call, EINVAL); 1739 1739 return NULL; … … 1779 1779 1780 1780 if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) || 1781 ! CAP_HANDLE_VALID((phandle)))1781 !cap_handle_valid((phandle))) 1782 1782 return NULL; 1783 1783 … … 1813 1813 assert(call); 1814 1814 1815 return async_answer_1(call, EOK, CAP_HANDLE_RAW(other_exch->phone));1815 return async_answer_1(call, EOK, cap_handle_raw(other_exch->phone)); 1816 1816 } 1817 1817 -
uspace/lib/c/generic/ipc.c
rd066259 rbb97118 71 71 { 72 72 return __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, 73 CAP_HANDLE_RAW(phandle), imethod, arg1, arg2, arg3,73 cap_handle_raw(phandle), imethod, arg1, arg2, arg3, 74 74 (sysarg_t) label); 75 75 } … … 106 106 107 107 return __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, 108 CAP_HANDLE_RAW(phandle), (sysarg_t) &data,108 cap_handle_raw(phandle), (sysarg_t) &data, 109 109 (sysarg_t) label); 110 110 } … … 130 130 { 131 131 return (errno_t) __SYSCALL6(SYS_IPC_ANSWER_FAST, 132 CAP_HANDLE_RAW(chandle), (sysarg_t) retval, arg1, arg2, arg3, arg4);132 cap_handle_raw(chandle), (sysarg_t) retval, arg1, arg2, arg3, arg4); 133 133 } 134 134 … … 160 160 161 161 return (errno_t) __SYSCALL2(SYS_IPC_ANSWER_SLOW, 162 CAP_HANDLE_RAW(chandle), (sysarg_t) &data);162 cap_handle_raw(chandle), (sysarg_t) &data); 163 163 } 164 164 … … 186 186 errno_t ipc_hangup(cap_phone_handle_t phandle) 187 187 { 188 return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, CAP_HANDLE_RAW(phandle));188 return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, cap_handle_raw(phandle)); 189 189 } 190 190 … … 210 210 { 211 211 return (errno_t) __SYSCALL6(SYS_IPC_FORWARD_FAST, 212 CAP_HANDLE_RAW(chandle), CAP_HANDLE_RAW(phandle), imethod, arg1,212 cap_handle_raw(chandle), cap_handle_raw(phandle), imethod, arg1, 213 213 arg2, mode); 214 214 } … … 228 228 229 229 return (errno_t) __SYSCALL4(SYS_IPC_FORWARD_SLOW, 230 CAP_HANDLE_RAW(chandle), CAP_HANDLE_RAW(phandle), (sysarg_t) &data,230 cap_handle_raw(chandle), cap_handle_raw(phandle), (sysarg_t) &data, 231 231 mode); 232 232 } -
uspace/lib/c/generic/irq.c
rd066259 rbb97118 83 83 { 84 84 return (errno_t) __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE, 85 CAP_HANDLE_RAW(cap));85 cap_handle_raw(cap)); 86 86 } 87 87 -
uspace/lib/hound/src/protocol.c
rd066259 rbb97118 158 158 async_exch_t *exch = async_exchange_begin(sess); 159 159 const errno_t ret = async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER, 160 CAP_HANDLE_RAW(id));160 cap_handle_raw(id)); 161 161 async_exchange_end(exch); 162 162 return ret; … … 315 315 }; 316 316 317 return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, CAP_HANDLE_RAW(id),317 return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, cap_handle_raw(id), 318 318 flags, c.arg, bsize); 319 319 } … … 431 431 async_answer_0(&call, ret); 432 432 } else { 433 async_answer_1(&call, EOK, CAP_HANDLE_RAW(context));433 async_answer_1(&call, EOK, cap_handle_raw(context)); 434 434 } 435 435 break;
Note:
See TracChangeset
for help on using the changeset viewer.