Changeset e68765e in mainline
- Timestamp:
- 2017-08-20T16:58:10Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88db88d
- Parents:
- 3f74275
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cap/cap.h
r3f74275 re68765e 59 59 typedef struct cap { 60 60 cap_type_t type; 61 int handle; 62 61 63 bool (* can_reclaim)(struct cap *); 62 64 … … 74 76 void caps_task_init(struct task *); 75 77 76 extern void cap_initialize(cap_t * );78 extern void cap_initialize(cap_t *, int); 77 79 extern cap_t *cap_get(struct task *, int, cap_type_t); 78 80 extern cap_t *cap_get_current(int, cap_type_t); … … 80 82 extern void cap_free(struct task *, int); 81 83 82 extern int cap_get_handle(struct task *, cap_t *);83 84 84 #endif 85 85 -
kernel/generic/src/cap/cap.c
r3f74275 re68765e 39 39 #include <mm/slab.h> 40 40 41 void cap_initialize(cap_t *cap )41 void cap_initialize(cap_t *cap, int handle) 42 42 { 43 43 cap->type = CAP_TYPE_INVALID; 44 cap->handle = handle; 44 45 cap->can_reclaim = NULL; 45 46 } … … 53 54 { 54 55 for (int i = 0; i < MAX_CAPS; i++) 55 cap_initialize(&task->caps[i] );56 cap_initialize(&task->caps[i], i); 56 57 } 57 58 … … 84 85 if (cap->type > CAP_TYPE_ALLOCATED) { 85 86 if (cap->can_reclaim && cap->can_reclaim(cap)) 86 cap_initialize(cap );87 cap_initialize(cap, handle); 87 88 } 88 89 if (cap->type == CAP_TYPE_INVALID) { … … 104 105 105 106 irq_spinlock_lock(&task->lock, true); 106 cap_initialize(&task->caps[handle] );107 cap_initialize(&task->caps[handle], handle); 107 108 irq_spinlock_unlock(&task->lock, true); 108 }109 110 int cap_get_handle(task_t *task, cap_t *cap)111 {112 return cap - task->caps;113 109 } 114 110 -
kernel/generic/src/ipc/ipc.c
r3f74275 re68765e 913 913 for_each_cap(task, cap, CAP_TYPE_PHONE) { 914 914 phone_t *phone = &cap->phone; 915 int cap_handle = cap_get_handle(task, cap);916 915 917 916 if (SYNCH_FAILED(mutex_trylock(&phone->lock))) { 918 printf("%-11d (mutex busy)\n", cap _handle);917 printf("%-11d (mutex busy)\n", cap->handle); 919 918 continue; 920 919 } 921 920 922 921 if (phone->state != IPC_PHONE_FREE) { 923 printf("%-11d %7" PRIun " ", cap _handle,922 printf("%-11d %7" PRIun " ", cap->handle, 924 923 atomic_get(&phone->active_calls)); 925 924 -
kernel/generic/src/proc/task.c
r3f74275 re68765e 627 627 phone_t *phone = &cap->phone; 628 628 if (phone->callee) 629 printf(" %d:%p", cap_get_handle(task, cap), 630 phone->callee); 629 printf(" %d:%p", cap->handle, phone->callee); 631 630 } 632 631 printf("\n");
Note:
See TracChangeset
for help on using the changeset viewer.