Changeset 13a638d in mainline
- Timestamp:
- 2009-04-06T19:32:22Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3636964
- Parents:
- 149d14e5
- Location:
- kernel
- Files:
-
- 6 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
r149d14e5 r13a638d 162 162 generic/src/ddi/device.c \ 163 163 generic/src/debug/symtab.c \ 164 generic/src/event/event.c \165 164 generic/src/interrupt/interrupt.c \ 166 165 generic/src/main/main.c \ … … 215 214 generic/src/ipc/ipcrsc.c \ 216 215 generic/src/ipc/irq.c \ 216 generic/src/ipc/event.c \ 217 217 generic/src/security/cap.c \ 218 218 generic/src/sysinfo/sysinfo.c -
kernel/generic/include/ipc/event.h
r149d14e5 r13a638d 36 36 #define KERN_EVENT_H_ 37 37 38 #include < event/event_types.h>38 #include <ipc/event_types.h> 39 39 #include <arch/types.h> 40 40 #include <synch/spinlock.h> -
kernel/generic/src/console/cmd.c
r149d14e5 r13a638d 65 65 #include <ipc/ipc.h> 66 66 #include <ipc/irq.h> 67 #include < event/event.h>67 #include <ipc/event.h> 68 68 #include <symtab.h> 69 69 #include <errno.h> -
kernel/generic/src/console/console.c
r149d14e5 r13a638d 42 42 #include <ddi/irq.h> 43 43 #include <ddi/ddi.h> 44 #include < event/event.h>44 #include <ipc/event.h> 45 45 #include <ipc/irq.h> 46 46 #include <arch.h> … … 53 53 #include <string.h> 54 54 55 #define KLOG_ SIZE PAGE_SIZE56 #define KLOG_LENGTH (KLOG_ SIZE / sizeof(wchar_t))55 #define KLOG_PAGES 4 56 #define KLOG_LENGTH (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t)) 57 57 #define KLOG_LATENCY 8 58 58 … … 96 96 97 97 ASSERT((uintptr_t) faddr % FRAME_SIZE == 0); 98 ASSERT(KLOG_SIZE % FRAME_SIZE == 0);99 98 100 99 klog_parea.pbase = (uintptr_t) faddr; … … 103 102 104 103 sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr); 105 sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(sizeof(klog)));104 sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES); 106 105 107 106 spinlock_lock(&klog_lock); -
kernel/generic/src/ipc/event.c
r149d14e5 r13a638d 32 32 /** 33 33 * @file 34 * @brief 34 * @brief Kernel event notifications. 35 35 */ 36 36 37 #include < event/event.h>38 #include < event/event_types.h>37 #include <ipc/event.h> 38 #include <ipc/event_types.h> 39 39 #include <mm/slab.h> 40 40 #include <arch/types.h> … … 50 50 * likelyhood of cacheline ping-pong. 51 51 */ 52 static event_t *events[EVENT_END];52 static event_t events[EVENT_END]; 53 53 54 54 /** Initialize kernel events. */ 55 55 void event_init(void) 56 56 { 57 int i;58 57 unsigned int i; 58 59 59 for (i = 0; i < EVENT_END; i++) { 60 events[i] = (event_t *) malloc(sizeof(event_t), 0); 61 spinlock_initialize(&events[i]->lock, "event.lock"); 62 events[i]->answerbox = NULL; 63 events[i]->counter = 0; 64 events[i]->method = 0; 60 spinlock_initialize(&events[i].lock, "event.lock"); 61 events[i].answerbox = NULL; 62 events[i].counter = 0; 63 events[i].method = 0; 65 64 } 66 65 } 67 66 68 67 static int 69 event_subscribe(event_type_t e , unative_t method, answerbox_t *answerbox)68 event_subscribe(event_type_t evno, unative_t method, answerbox_t *answerbox) 70 69 { 71 if (e >= EVENT_END)70 if (evno >= EVENT_END) 72 71 return ELIMIT; 73 74 int res = EEXISTS;75 event_t *event = events[e];76 77 spinlock_lock(&event->lock);78 if ( !event->answerbox) {79 event ->answerbox = answerbox;80 event ->method = method;81 event ->counter = 0;72 73 spinlock_lock(&events[evno].lock); 74 75 int res; 76 77 if (events[evno].answerbox == NULL) { 78 events[evno].answerbox = answerbox; 79 events[evno].method = method; 80 events[evno].counter = 0; 82 81 res = EOK; 83 } 84 spinlock_unlock(&event->lock); 85 82 } else 83 res = EEXISTS; 84 85 spinlock_unlock(&events[evno].lock); 86 86 87 return res; 87 88 } … … 93 94 } 94 95 95 bool event_is_subscribed(event_type_t e )96 bool event_is_subscribed(event_type_t evno) 96 97 { 97 98 bool res; 98 99 ASSERT(e < EVENT_END); 100 spinlock_lock(&events[e]->lock); 101 res = events[e]->answerbox != NULL; 102 spinlock_unlock(&events[e]->lock); 103 99 100 ASSERT(evno < EVENT_END); 101 102 spinlock_lock(&events[evno].lock); 103 res = events[evno].answerbox != NULL; 104 spinlock_unlock(&events[evno].lock); 105 104 106 return res; 105 107 } … … 108 110 void event_cleanup_answerbox(answerbox_t *answerbox) 109 111 { 110 int i;111 112 unsigned int i; 113 112 114 for (i = 0; i < EVENT_END; i++) { 113 spinlock_lock(&events[i] ->lock);114 if (events[i] ->answerbox == answerbox) {115 events[i] ->answerbox = NULL;116 events[i] ->counter = 0;117 events[i] ->method = 0;115 spinlock_lock(&events[i].lock); 116 if (events[i].answerbox == answerbox) { 117 events[i].answerbox = NULL; 118 events[i].counter = 0; 119 events[i].method = 0; 118 120 } 119 spinlock_unlock(&events[i] ->lock);121 spinlock_unlock(&events[i].lock); 120 122 } 121 123 } 122 124 123 125 void 124 event_notify(event_type_t e , unative_t a1, unative_t a2, unative_t a3,126 event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3, 125 127 unative_t a4, unative_t a5) 126 128 { 127 ASSERT(e < EVENT_END);128 event_t *event = events[e];129 spinlock_lock(&event ->lock);130 if (event ->answerbox) {129 ASSERT(evno < EVENT_END); 130 131 spinlock_lock(&events[evno].lock); 132 if (events[evno].answerbox != NULL) { 131 133 call_t *call = ipc_call_alloc(FRAME_ATOMIC); 132 134 if (call) { 133 135 call->flags |= IPC_CALL_NOTIF; 134 call->priv = ++event ->counter;135 IPC_SET_METHOD(call->data, event ->method);136 call->priv = ++events[evno].counter; 137 IPC_SET_METHOD(call->data, events[evno].method); 136 138 IPC_SET_ARG1(call->data, a1); 137 139 IPC_SET_ARG2(call->data, a2); … … 139 141 IPC_SET_ARG4(call->data, a4); 140 142 IPC_SET_ARG5(call->data, a5); 141 142 spinlock_lock(&event ->answerbox->irq_lock);143 list_append(&call->link, &event ->answerbox->irq_notifs);144 spinlock_unlock(&event ->answerbox->irq_lock);145 146 waitq_wakeup(&event ->answerbox->wq, WAKEUP_FIRST);143 144 spinlock_lock(&events[evno].answerbox->irq_lock); 145 list_append(&call->link, &events[evno].answerbox->irq_notifs); 146 spinlock_unlock(&events[evno].answerbox->irq_lock); 147 148 waitq_wakeup(&events[evno].answerbox->wq, WAKEUP_FIRST); 147 149 } 148 150 } 149 spinlock_unlock(&event ->lock);151 spinlock_unlock(&events[evno].lock); 150 152 } 151 153 -
kernel/generic/src/ipc/ipc.c
r149d14e5 r13a638d 45 45 #include <ipc/ipc.h> 46 46 #include <ipc/kbox.h> 47 #include < event/event.h>47 #include <ipc/event.h> 48 48 #include <errno.h> 49 49 #include <mm/slab.h> … … 52 52 #include <memstr.h> 53 53 #include <debug.h> 54 55 56 54 #include <print.h> 57 55 #include <console/console.h> -
kernel/generic/src/main/main.c
r149d14e5 r13a638d 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Main initialization kernel function for all processors. 36 36 * 37 37 * During kernel boot, all processors, after architecture dependent … … 83 83 #include <ddi/ddi.h> 84 84 #include <main/main.h> 85 #include < event/event.h>85 #include <ipc/event.h> 86 86 87 87 /** Global configuration structure. */ -
kernel/generic/src/syscall/syscall.c
r149d14e5 r13a638d 49 49 #include <synch/smc.h> 50 50 #include <ddi/ddi.h> 51 #include < event/event.h>51 #include <ipc/event.h> 52 52 #include <security/cap.h> 53 53 #include <sysinfo/sysinfo.h>
Note:
See TracChangeset
for help on using the changeset viewer.