Changeset 6a44ee4 in mainline for kernel/generic/include
- Timestamp:
- 2011-07-20T15:26:21Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- efcebe1
- Parents:
- 25bef0ff (diff), a701812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/generic/include
- Files:
-
- 1 added
- 20 edited
-
adt/btree.h (modified) (1 diff)
-
adt/hash_table.h (modified) (1 diff)
-
adt/list.h (modified) (13 diffs)
-
console/chardev.h (modified) (2 diffs)
-
console/console.h (modified) (1 diff)
-
console/kconsole.h (modified) (1 diff)
-
cpu.h (modified) (1 diff)
-
ddi/ddi.h (modified) (1 diff)
-
ddi/irq.h (modified) (2 diffs)
-
ipc/ipc.h (modified) (4 diffs)
-
ipc/ipc_methods.h (added)
-
mm/as.h (modified) (2 diffs)
-
mm/buddy.h (modified) (1 diff)
-
mm/page.h (modified) (2 diffs)
-
mm/slab.h (modified) (1 diff)
-
panic.h (modified) (1 diff)
-
proc/scheduler.h (modified) (1 diff)
-
proc/task.h (modified) (2 diffs)
-
proc/thread.h (modified) (3 diffs)
-
synch/waitq.h (modified) (1 diff)
-
syscall/syscall.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/btree.h
r25bef0ff r6a44ee4 89 89 typedef struct { 90 90 btree_node_t *root; /**< B-tree root node pointer. */ 91 li nk_t leaf_head; /**< Leaf-level list head. */91 list_t leaf_list; /**< List of leaves. */ 92 92 } btree_t; 93 93 -
kernel/generic/include/adt/hash_table.h
r25bef0ff r6a44ee4 68 68 /** Hash table structure. */ 69 69 typedef struct { 70 li nk_t *entry;70 list_t *entry; 71 71 size_t entries; 72 72 size_t max_keys; -
kernel/generic/include/adt/list.h
r25bef0ff r6a44ee4 1 1 /* 2 2 * Copyright (c) 2001-2004 Jakub Jermar 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 39 40 #include <trace.h> 40 41 41 /** Doubly linked list head and link type. */42 /** Doubly linked list link. */ 42 43 typedef struct link { 43 44 struct link *prev; /**< Pointer to the previous item in the list. */ … … 45 46 } link_t; 46 47 48 /** Doubly linked list. */ 49 typedef struct list { 50 link_t head; /**< List head. Does not have any data. */ 51 } list_t; 52 47 53 /** Declare and initialize statically allocated list. 48 54 * … … 51 57 */ 52 58 #define LIST_INITIALIZE(name) \ 53 link_t name = { \ 54 .prev = &name, \ 55 .next = &name \ 59 list_t name = { \ 60 .head = { \ 61 .prev = &(name).head, \ 62 .next = &(name).head \ 63 } \ 56 64 } 57 65 … … 60 68 61 69 #define list_foreach(list, iterator) \ 62 for (link_t *iterator = (list).next; \ 63 iterator != &(list); iterator = iterator->next) 70 for (link_t *iterator = (list).head.next; \ 71 iterator != &(list).head; iterator = iterator->next) 72 73 #define assert_link_not_used(link) \ 74 ASSERT((link)->prev == NULL && (link)->next == NULL) 64 75 65 76 /** Initialize doubly-linked circular list link … … 80 91 * Initialize doubly-linked circular list. 81 92 * 82 * @param list Pointer to link_t structure representing the list. 83 * 84 */ 85 NO_TRACE static inline void list_initialize(link_t *list) 86 { 87 list->prev = list; 88 list->next = list; 93 * @param list Pointer to list_t structure. 94 * 95 */ 96 NO_TRACE static inline void list_initialize(list_t *list) 97 { 98 list->head.prev = &list->head; 99 list->head.next = &list->head; 100 } 101 102 /** Insert item before another item in doubly-linked circular list. 103 * 104 */ 105 static inline void list_insert_before(link_t *lnew, link_t *lold) 106 { 107 lnew->next = lold; 108 lnew->prev = lold->prev; 109 lold->prev->next = lnew; 110 lold->prev = lnew; 111 } 112 113 /** Insert item after another item in doubly-linked circular list. 114 * 115 */ 116 static inline void list_insert_after(link_t *lnew, link_t *lold) 117 { 118 lnew->prev = lold; 119 lnew->next = lold->next; 120 lold->next->prev = lnew; 121 lold->next = lnew; 89 122 } 90 123 … … 94 127 * 95 128 * @param link Pointer to link_t structure to be added. 96 * @param list Pointer to link_t structure representing the list. 97 * 98 */ 99 NO_TRACE static inline void list_prepend(link_t *link, link_t *list) 100 { 101 link->next = list->next; 102 link->prev = list; 103 list->next->prev = link; 104 list->next = link; 129 * @param list Pointer to list_t structure. 130 * 131 */ 132 NO_TRACE static inline void list_prepend(link_t *link, list_t *list) 133 { 134 list_insert_after(link, &list->head); 105 135 } 106 136 … … 110 140 * 111 141 * @param link Pointer to link_t structure to be added. 112 * @param list Pointer to link_t structure representing the list. 113 * 114 */ 115 NO_TRACE static inline void list_append(link_t *link, link_t *list) 116 { 117 link->prev = list->prev; 118 link->next = list; 119 list->prev->next = link; 120 list->prev = link; 121 } 122 123 /** Insert item before another item in doubly-linked circular list. 124 * 125 */ 126 static inline void list_insert_before(link_t *link, link_t *list) 127 { 128 list_append(link, list); 129 } 130 131 /** Insert item after another item in doubly-linked circular list. 132 * 133 */ 134 static inline void list_insert_after(link_t *link, link_t *list) 135 { 136 list_prepend(list, link); 142 * @param list Pointer to list_t structure. 143 * 144 */ 145 NO_TRACE static inline void list_append(link_t *link, list_t *list) 146 { 147 list_insert_before(link, &list->head); 137 148 } 138 149 … … 156 167 * Query emptiness of doubly-linked circular list. 157 168 * 158 * @param list Pointer to lin k_t structure representing the list.159 * 160 */ 161 NO_TRACE static inline int list_empty(li nk_t *list)162 { 163 return (list-> next == list);164 } 165 166 /** Get head item of alist.167 * 168 * @param list Pointer to li nk_t structure representing the list.169 * @param list Pointer to lins_t structure. 170 * 171 */ 172 NO_TRACE static inline int list_empty(list_t *list) 173 { 174 return (list->head.next == &list->head); 175 } 176 177 /** Get first item in list. 178 * 179 * @param list Pointer to list_t structure. 169 180 * 170 181 * @return Head item of the list. … … 172 183 * 173 184 */ 174 static inline link_t *list_head(link_t *list) 175 { 176 return ((list->next == list) ? NULL : list->next); 185 static inline link_t *list_first(list_t *list) 186 { 187 return ((list->head.next == &list->head) ? NULL : list->head.next); 188 } 189 190 /** Get last item in list. 191 * 192 * @param list Pointer to list_t structure. 193 * 194 * @return Head item of the list. 195 * @return NULL if the list is empty. 196 * 197 */ 198 static inline link_t *list_last(list_t *list) 199 { 200 return ((list->head.prev == &list->head) ? NULL : list->head.prev); 177 201 } 178 202 … … 231 255 } 232 256 233 /** Get n-th item ofa list.257 /** Get n-th item in a list. 234 258 * 235 259 * @param list Pointer to link_t structure representing the list. … … 240 264 * 241 265 */ 242 static inline link_t *list_nth(li nk_t *list, unsigned int n)266 static inline link_t *list_nth(list_t *list, unsigned int n) 243 267 { 244 268 unsigned int cnt = 0; … … 254 278 } 255 279 256 extern int list_member(const link_t *, const li nk_t *);257 extern void list_concat(li nk_t *, link_t *);258 extern unsigned int list_count(const li nk_t *);280 extern int list_member(const link_t *, const list_t *); 281 extern void list_concat(list_t *, list_t *); 282 extern unsigned int list_count(const list_t *); 259 283 260 284 #endif -
kernel/generic/include/console/chardev.h
r25bef0ff r6a44ee4 73 73 typedef struct { 74 74 /** Write character to output. */ 75 void (* write)(struct outdev *, wchar_t , bool);75 void (* write)(struct outdev *, wchar_t); 76 76 77 77 /** Redraw any previously cached characters. */ … … 88 88 /** Fields suitable for multiplexing. */ 89 89 link_t link; 90 li nk_t list;90 list_t list; 91 91 92 92 /** Implementation of outdev operations. */ -
kernel/generic/include/console/console.h
r25bef0ff r6a44ee4 72 72 extern void release_console(void); 73 73 74 extern sysarg_t sys_debug_enable_console(void); 75 extern sysarg_t sys_debug_disable_console(void); 74 extern sysarg_t sys_debug_activate_console(void); 76 75 77 76 #endif /* KERN_CONSOLE_H_ */ -
kernel/generic/include/console/kconsole.h
r25bef0ff r6a44ee4 91 91 92 92 SPINLOCK_EXTERN(cmd_lock); 93 extern li nk_t cmd_head;93 extern list_t cmd_list; 94 94 95 95 extern void kconsole_init(void); -
kernel/generic/include/cpu.h
r25bef0ff r6a44ee4 59 59 60 60 IRQ_SPINLOCK_DECLARE(timeoutlock); 61 li nk_t timeout_active_head;61 list_t timeout_active_list; 62 62 63 63 /** -
kernel/generic/include/ddi/ddi.h
r25bef0ff r6a44ee4 48 48 pfn_t frames; /**< Number of frames in the area. */ 49 49 bool unpriv; /**< Allow mapping by unprivileged tasks. */ 50 bool mapped; /**< Indicate whether the area is actually 51 mapped. */ 50 52 } parea_t; 51 53 -
kernel/generic/include/ddi/irq.h
r25bef0ff r6a44ee4 77 77 */ 78 78 CMD_PIO_WRITE_A_32, 79 79 80 /** Read 1 byte from the memory space. */ 81 CMD_MEM_READ_8, 82 /** Read 2 bytes from the memory space. */ 83 CMD_MEM_READ_16, 84 /** Read 4 bytes from the memory space. */ 85 CMD_MEM_READ_32, 86 87 /** Write 1 byte to the memory space. */ 88 CMD_MEM_WRITE_8, 89 /** Write 2 bytes to the memory space. */ 90 CMD_MEM_WRITE_16, 91 /** Write 4 bytes to the memory space. */ 92 CMD_MEM_WRITE_32, 93 94 /** Write 1 byte from the source argument to the memory space. */ 95 CMD_MEM_WRITE_A_8, 96 /** Write 2 bytes from the source argument to the memory space. */ 97 CMD_MEM_WRITE_A_16, 98 /** Write 4 bytes from the source argument to the memory space. */ 99 CMD_MEM_WRITE_A_32, 100 80 101 /** 81 102 * Perform a bit masking on the source argument … … 203 224 /** Notification configuration structure. */ 204 225 ipc_notif_cfg_t notif_cfg; 226 227 as_t *driver_as; 205 228 } irq_t; 206 229 -
kernel/generic/include/ipc/ipc.h
r25bef0ff r6a44ee4 100 100 #define IPC_GET_ARG5(data) ((data).args[5]) 101 101 102 /* Well known phone descriptors */103 #define PHONE_NS 0104 105 102 /* Forwarding flags. */ 106 103 #define IPC_FF_NONE 0 … … 117 114 118 115 /* Data transfer flags. */ 119 #define IPC_XF_NONE 0116 #define IPC_XF_NONE 0 120 117 121 118 /** Restrict the transfer size if necessary. */ 122 #define IPC_XF_RESTRICT (1 << 0) 123 124 /** Kernel IPC interfaces 125 * 126 */ 127 #define IPC_IF_KERNEL 0 128 129 /** System-specific methods - only through special syscalls 130 * 131 * These methods have special behaviour. These methods also 132 * have the implicit kernel interface 0. 133 * 134 */ 135 136 /** Clone connection. 137 * 138 * The calling task clones one of its phones for the callee. 139 * 140 * - ARG1 - The caller sets ARG1 to the phone of the cloned connection. 141 * - The callee gets the new phone from ARG1. 142 * 143 * - on answer, the callee acknowledges the new connection by sending EOK back 144 * or the kernel closes it 145 * 146 */ 147 #define IPC_M_CONNECTION_CLONE 1 148 149 /** Protocol for CONNECT - ME 150 * 151 * Through this call, the recipient learns about the new cloned connection. 152 * 153 * - ARG5 - the kernel sets ARG5 to contain the hash of the used phone 154 * - on asnwer, the callee acknowledges the new connection by sending EOK back 155 * or the kernel closes it 156 * 157 */ 158 #define IPC_M_CONNECT_ME 2 159 160 /** Protocol for CONNECT - TO - ME 161 * 162 * Calling process asks the callee to create a callback connection, 163 * so that it can start initiating new messages. 164 * 165 * The protocol for negotiating is: 166 * - sys_connect_to_me - sends a message IPC_M_CONNECT_TO_ME 167 * - recipient - upon receipt tries to allocate new phone 168 * - if it fails, responds with ELIMIT 169 * - passes call to userspace. If userspace 170 * responds with error, phone is deallocated and 171 * error is sent back to caller. Otherwise 172 * the call is accepted and the response is sent back. 173 * - the hash of the client task is passed to userspace 174 * (on the receiving side) as ARG4 of the call. 175 * - the hash of the allocated phone is passed to userspace 176 * (on the receiving side) as ARG5 of the call. 177 * 178 */ 179 #define IPC_M_CONNECT_TO_ME 3 180 181 /** Protocol for CONNECT - ME - TO 182 * 183 * Calling process asks the callee to create for him a new connection. 184 * E.g. the caller wants a name server to connect him to print server. 185 * 186 * The protocol for negotiating is: 187 * - sys_connect_me_to - send a synchronous message to name server 188 * indicating that it wants to be connected to some 189 * service 190 * - arg1/2/3 are user specified, arg5 contains 191 * address of the phone that should be connected 192 * (TODO: it leaks to userspace) 193 * - recipient - if ipc_answer == 0, then accept connection 194 * - otherwise connection refused 195 * - recepient may forward message. 196 * 197 */ 198 #define IPC_M_CONNECT_ME_TO 4 199 200 /** This message is sent to answerbox when the phone is hung up 201 * 202 */ 203 #define IPC_M_PHONE_HUNGUP 5 204 205 /** Send as_area over IPC. 206 * - ARG1 - source as_area base address 207 * - ARG2 - size of source as_area (filled automatically by kernel) 208 * - ARG3 - flags of the as_area being sent 209 * 210 * on answer, the recipient must set: 211 * - ARG1 - dst as_area base adress 212 * 213 */ 214 #define IPC_M_SHARE_OUT 6 215 216 /** Receive as_area over IPC. 217 * - ARG1 - destination as_area base address 218 * - ARG2 - destination as_area size 219 * - ARG3 - user defined argument 220 * 221 * on answer, the recipient must set: 222 * 223 * - ARG1 - source as_area base address 224 * - ARG2 - flags that will be used for sharing 225 * 226 */ 227 #define IPC_M_SHARE_IN 7 228 229 /** Send data to another address space over IPC. 230 * - ARG1 - source address space virtual address 231 * - ARG2 - size of data to be copied, may be overriden by the recipient 232 * 233 * on answer, the recipient must set: 234 * 235 * - ARG1 - final destination address space virtual address 236 * - ARG2 - final size of data to be copied 237 * 238 */ 239 #define IPC_M_DATA_WRITE 8 240 241 /** Receive data from another address space over IPC. 242 * - ARG1 - destination virtual address in the source address space 243 * - ARG2 - size of data to be received, may be cropped by the recipient 244 * 245 * on answer, the recipient must set: 246 * 247 * - ARG1 - source virtual address in the destination address space 248 * - ARG2 - final size of data to be copied 249 * 250 */ 251 #define IPC_M_DATA_READ 9 252 253 /** Debug the recipient. 254 * - ARG1 - specifies the debug method (from udebug_method_t) 255 * - other arguments are specific to the debug method 256 * 257 */ 258 #define IPC_M_DEBUG_ALL 10 259 260 /* Well-known methods */ 261 #define IPC_M_LAST_SYSTEM 511 262 #define IPC_M_PING 512 263 264 /* User methods */ 119 #define IPC_XF_RESTRICT (1 << 0) 120 121 /** User-defined IPC methods */ 265 122 #define IPC_FIRST_USER_METHOD 1024 266 123 … … 309 166 310 167 /** Phones connected to this answerbox. */ 311 li nk_t connected_phones;168 list_t connected_phones; 312 169 /** Received calls. */ 313 li nk_t calls;314 li nk_t dispatched_calls; /* Should be hash table in the future */170 list_t calls; 171 list_t dispatched_calls; /* Should be hash table in the future */ 315 172 316 173 /** Answered calls. */ 317 li nk_t answers;174 list_t answers; 318 175 319 176 IRQ_SPINLOCK_DECLARE(irq_lock); 320 177 321 178 /** Notifications from IRQ handlers. */ 322 li nk_t irq_notifs;179 list_t irq_notifs; 323 180 /** IRQs with notifications to this answerbox. */ 324 li nk_t irq_head;181 list_t irq_list; 325 182 } answerbox_t; 326 183 … … 386 243 extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t); 387 244 extern void ipc_answerbox_slam_phones(answerbox_t *, bool); 388 extern void ipc_cleanup_call_list(li nk_t *);245 extern void ipc_cleanup_call_list(list_t *); 389 246 390 247 extern void ipc_print_task(task_id_t); -
kernel/generic/include/mm/as.h
r25bef0ff r6a44ee4 65 65 #include <arch/mm/as.h> 66 66 #include <arch/mm/asid.h> 67 #include <arch/istate.h> 67 68 #include <typedefs.h> 68 69 #include <synch/spinlock.h> … … 254 255 255 256 extern as_operations_t *as_operations; 256 extern li nk_t inactive_as_with_asid_head;257 extern list_t inactive_as_with_asid_list; 257 258 258 259 extern void as_init(void); -
kernel/generic/include/mm/buddy.h
r25bef0ff r6a44ee4 72 72 /** Maximal order of block which can be stored by buddy system. */ 73 73 uint8_t max_order; 74 li nk_t *order;74 list_t *order; 75 75 buddy_system_operations_t *op; 76 76 /** Pointer to be used by the implementation. */ -
kernel/generic/include/mm/page.h
r25bef0ff r6a44ee4 37 37 38 38 #include <typedefs.h> 39 #include <proc/task.h> 39 40 #include <mm/as.h> 40 41 #include <arch/mm/page.h> … … 65 66 extern uintptr_t hw_map(uintptr_t, size_t); 66 67 68 extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *); 69 67 70 #endif 68 71 -
kernel/generic/include/mm/slab.h
r25bef0ff r6a44ee4 111 111 112 112 /* Slabs */ 113 li nk_t full_slabs; /**< List of full slabs */114 li nk_t partial_slabs; /**< List of partial slabs */113 list_t full_slabs; /**< List of full slabs */ 114 list_t partial_slabs; /**< List of partial slabs */ 115 115 SPINLOCK_DECLARE(slablock); 116 116 /* Magazines */ 117 li nk_t magazines; /**< List o full magazines */117 list_t magazines; /**< List o full magazines */ 118 118 SPINLOCK_DECLARE(maglock); 119 119 -
kernel/generic/include/panic.h
r25bef0ff r6a44ee4 60 60 struct istate; 61 61 62 extern bool silent;62 extern bool console_override; 63 63 64 64 extern void panic_common(panic_category_t, struct istate *, int, -
kernel/generic/include/proc/scheduler.h
r25bef0ff r6a44ee4 48 48 typedef struct { 49 49 IRQ_SPINLOCK_DECLARE(lock); 50 li nk_t rq_head;/**< List of ready threads. */51 size_t n; /**< Number of threads in rq_ready. */50 list_t rq; /**< List of ready threads. */ 51 size_t n; /**< Number of threads in rq_ready. */ 52 52 } runq_t; 53 53 -
kernel/generic/include/proc/task.h
r25bef0ff r6a44ee4 73 73 char name[TASK_NAME_BUFLEN]; 74 74 /** List of threads contained in this task. */ 75 li nk_t th_head;75 list_t threads; 76 76 /** Address space. */ 77 77 as_t *as; … … 94 94 stats_ipc_t ipc_info; /**< IPC statistics */ 95 95 /** List of synchronous answerboxes. */ 96 li nk_t sync_box_head;96 list_t sync_boxes; 97 97 98 98 #ifdef CONFIG_UDEBUG -
kernel/generic/include/proc/thread.h
r25bef0ff r6a44ee4 156 156 int fpu_context_engaged; 157 157 158 /* The thread will not be migrated if nomigrate is non-zero. */ 159 int nomigrate; 160 158 161 /** Thread's state. */ 159 162 state_t state; … … 245 248 extern bool thread_exists(thread_t *); 246 249 250 extern void thread_migration_disable(void); 251 extern void thread_migration_enable(void); 252 247 253 #ifdef CONFIG_UDEBUG 248 254 extern void thread_stack_trace(thread_id_t); … … 258 264 extern sysarg_t sys_thread_get_id(thread_id_t *); 259 265 extern sysarg_t sys_thread_usleep(uint32_t); 266 extern sysarg_t sys_thread_udelay(uint32_t); 260 267 261 268 #endif -
kernel/generic/include/synch/waitq.h
r25bef0ff r6a44ee4 63 63 64 64 /** List of sleeping threads for which there was no missed_wakeup. */ 65 li nk_t head;65 list_t sleepers; 66 66 } waitq_t; 67 67 -
kernel/generic/include/syscall/syscall.h
r25bef0ff r6a44ee4 44 44 SYS_THREAD_GET_ID, 45 45 SYS_THREAD_USLEEP, 46 SYS_THREAD_UDELAY, 46 47 47 48 SYS_TASK_GET_ID, … … 60 61 SYS_AS_AREA_DESTROY, 61 62 SYS_AS_GET_UNMAPPED_AREA, 63 64 SYS_PAGE_FIND_MAPPING, 62 65 63 66 SYS_IPC_CALL_SYNC_FAST, … … 91 94 SYS_SYSINFO_GET_DATA, 92 95 93 SYS_DEBUG_ENABLE_CONSOLE, 94 SYS_DEBUG_DISABLE_CONSOLE, 96 SYS_DEBUG_ACTIVATE_CONSOLE, 95 97 96 98 SYSCALL_END
Note:
See TracChangeset
for help on using the changeset viewer.
