Changeset 89c57b6 in mainline for kernel/generic/include
- Timestamp:
- 2011-04-13T14:45:41Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88634420
- Parents:
- cefb126 (diff), 17279ead (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
- 48 edited
- 1 moved
-
adt/avl.h (modified) (3 diffs)
-
adt/hash_table.h (modified) (3 diffs)
-
adt/list.h (modified) (10 diffs)
-
atomic.h (modified) (2 diffs)
-
bitops.h (modified) (3 diffs)
-
config.h (modified) (1 diff)
-
console/console.h (modified) (1 diff)
-
console/kconsole.h (modified) (1 diff)
-
context.h (modified) (2 diffs)
-
cpu.h (modified) (1 diff)
-
ddi/ddi.h (modified) (2 diffs)
-
ddi/device.h (modified) (1 diff)
-
ddi/irq.h (modified) (5 diffs)
-
debug.h (modified) (2 diffs)
-
interrupt.h (modified) (2 diffs)
-
ipc/event.h (modified) (3 diffs)
-
ipc/event_types.h (modified) (1 diff)
-
ipc/ipc.h (modified) (9 diffs)
-
ipc/ipcrsc.h (modified) (1 diff)
-
ipc/irq.h (modified) (2 diffs)
-
ipc/sysipc.h (modified) (1 diff)
-
lib/memfnc.h (moved) (moved from kernel/generic/include/syscall/sysarg64.h ) (2 diffs)
-
macros.h (modified) (4 diffs)
-
main/main.h (modified) (1 diff)
-
main/version.h (modified) (1 diff)
-
memstr.h (modified) (1 diff)
-
mm/as.h (modified) (5 diffs)
-
mm/frame.h (modified) (5 diffs)
-
mm/slab.h (modified) (2 diffs)
-
panic.h (modified) (2 diffs)
-
print.h (modified) (1 diff)
-
proc/program.h (modified) (1 diff)
-
proc/task.h (modified) (3 diffs)
-
proc/thread.h (modified) (4 diffs)
-
security/cap.h (modified) (6 diffs)
-
smp/smp.h (modified) (2 diffs)
-
stacktrace.h (modified) (3 diffs)
-
stdint.h (modified) (1 diff)
-
synch/futex.h (modified) (1 diff)
-
synch/smc.h (modified) (1 diff)
-
synch/spinlock.h (modified) (2 diffs)
-
syscall/syscall.h (modified) (7 diffs)
-
sysinfo/abi.h (modified) (2 diffs)
-
sysinfo/sysinfo.h (modified) (5 diffs)
-
time/clock.h (modified) (1 diff)
-
trace.h (added)
-
typedefs.h (modified) (2 diffs)
-
udebug/udebug.h (modified) (5 diffs)
-
udebug/udebug_ipc.h (modified) (2 diffs)
-
udebug/udebug_ops.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/avl.h
rcefb126 r89c57b6 34 34 35 35 #ifndef KERN_AVLTREE_H_ 36 #define KERN_AVLTREE_H_ 36 #define KERN_AVLTREE_H_ 37 37 38 38 #include <typedefs.h> 39 #include <trace.h> 39 40 40 41 /** … … 110 111 * @param t AVL tree. 111 112 */ 112 static inline void avltree_create(avltree_t *t)113 NO_TRACE static inline void avltree_create(avltree_t *t) 113 114 { 114 115 t->root = NULL; … … 120 121 * @param node Node which is initialized. 121 122 */ 122 static inline void avltree_node_initialize(avltree_node_t *node)123 NO_TRACE static inline void avltree_node_initialize(avltree_node_t *node) 123 124 { 124 125 node->key = 0; -
kernel/generic/include/adt/hash_table.h
rcefb126 r89c57b6 48 48 * @return Index into hash table. 49 49 */ 50 size_t (* hash)( unative_t key[]);50 size_t (* hash)(sysarg_t key[]); 51 51 52 52 /** Hash table item comparison function. … … 57 57 * @return true if the keys match, false otherwise. 58 58 */ 59 bool (*compare)( unative_t key[], size_t keys, link_t *item);59 bool (*compare)(sysarg_t key[], size_t keys, link_t *item); 60 60 61 61 /** Hash table item removal callback. … … 79 79 extern void hash_table_create(hash_table_t *h, size_t m, size_t max_keys, 80 80 hash_table_operations_t *op); 81 extern void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item);82 extern link_t *hash_table_find(hash_table_t *h, unative_t key[]);83 extern void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys);81 extern void hash_table_insert(hash_table_t *h, sysarg_t key[], link_t *item); 82 extern link_t *hash_table_find(hash_table_t *h, sysarg_t key[]); 83 extern void hash_table_remove(hash_table_t *h, sysarg_t key[], size_t keys); 84 84 85 85 #endif -
kernel/generic/include/adt/list.h
rcefb126 r89c57b6 37 37 38 38 #include <typedefs.h> 39 #include <trace.h> 39 40 40 41 /** Doubly linked list head and link type. */ … … 57 58 * @param link Pointer to link_t structure to be initialized. 58 59 */ 59 static inline void link_initialize(link_t *link)60 NO_TRACE static inline void link_initialize(link_t *link) 60 61 { 61 62 link->prev = NULL; … … 69 70 * @param head Pointer to link_t structure representing head of the list. 70 71 */ 71 static inline void list_initialize(link_t *head)72 NO_TRACE static inline void list_initialize(link_t *head) 72 73 { 73 74 head->prev = head; … … 82 83 * @param head Pointer to link_t structure representing head of the list. 83 84 */ 84 static inline void list_prepend(link_t *link, link_t *head)85 NO_TRACE static inline void list_prepend(link_t *link, link_t *head) 85 86 { 86 87 link->next = head->next; … … 97 98 * @param head Pointer to link_t structure representing head of the list. 98 99 */ 99 static inline void list_append(link_t *link, link_t *head)100 NO_TRACE static inline void list_append(link_t *link, link_t *head) 100 101 { 101 102 link->prev = head->prev; … … 112 113 * contained in. 113 114 */ 114 static inline void list_remove(link_t *link)115 NO_TRACE static inline void list_remove(link_t *link) 115 116 { 116 117 link->next->prev = link->prev; … … 125 126 * @param head Pointer to link_t structure representing head of the list. 126 127 */ 127 static inline bool list_empty(link_t *head)128 NO_TRACE static inline bool list_empty(link_t *head) 128 129 { 129 130 return head->next == head ? true : false; … … 143 144 * headless) list. 144 145 */ 145 static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)146 NO_TRACE static inline void headless_list_split_or_concat(link_t *part1, link_t *part2) 146 147 { 147 148 link_t *hlp; … … 164 165 * headless list. 165 166 */ 166 static inline void headless_list_split(link_t *part1, link_t *part2)167 NO_TRACE static inline void headless_list_split(link_t *part1, link_t *part2) 167 168 { 168 169 headless_list_split_or_concat(part1, part2); … … 176 177 * @param part2 Pointer to link_t structure leading the second headless list. 177 178 */ 178 static inline void headless_list_concat(link_t *part1, link_t *part2)179 NO_TRACE static inline void headless_list_concat(link_t *part1, link_t *part2) 179 180 { 180 181 headless_list_split_or_concat(part1, part2); -
kernel/generic/include/atomic.h
rcefb126 r89c57b6 40 40 #include <verify.h> 41 41 42 ATOMIC static inline void atomic_set(atomic_t *val, atomic_count_t i)42 NO_TRACE ATOMIC static inline void atomic_set(atomic_t *val, atomic_count_t i) 43 43 WRITES(&val->count) 44 44 REQUIRES_EXTENT_MUTABLE(val) … … 47 47 } 48 48 49 ATOMIC static inline atomic_count_t atomic_get(atomic_t *val)49 NO_TRACE ATOMIC static inline atomic_count_t atomic_get(atomic_t *val) 50 50 REQUIRES_EXTENT_MUTABLE(val) 51 51 { -
kernel/generic/include/bitops.h
rcefb126 r89c57b6 36 36 #define KERN_BITOPS_H_ 37 37 38 #include <trace.h> 39 38 40 #ifdef __32_BITS__ 39 41 #define fnzb(arg) fnzb32(arg) … … 49 51 * 50 52 */ 51 static inline uint8_t fnzb32(uint32_t arg)53 NO_TRACE static inline uint8_t fnzb32(uint32_t arg) 52 54 { 53 55 uint8_t n = 0; … … 84 86 * 85 87 */ 86 static inline uint8_t fnzb64(uint64_t arg)88 NO_TRACE static inline uint8_t fnzb64(uint64_t arg) 87 89 { 88 90 uint8_t n = 0; -
kernel/generic/include/config.h
rcefb126 r89c57b6 66 66 67 67 typedef struct { 68 size_t cpu_count;/**< Number of processors detected. */68 unsigned int cpu_count; /**< Number of processors detected. */ 69 69 volatile size_t cpu_active; /**< Number of processors that are up and running. */ 70 70 -
kernel/generic/include/console/console.h
rcefb126 r89c57b6 67 67 extern wchar_t getc(indev_t *indev); 68 68 extern size_t gets(indev_t *indev, char *buf, size_t buflen); 69 extern unative_t sys_klog(int fd, const void *buf, size_t size);69 extern sysarg_t sys_klog(int fd, const void *buf, size_t size); 70 70 71 71 extern void grab_console(void); 72 72 extern void release_console(void); 73 73 74 extern unative_t sys_debug_enable_console(void);75 extern unative_t sys_debug_disable_console(void);74 extern sysarg_t sys_debug_enable_console(void); 75 extern sysarg_t sys_debug_disable_console(void); 76 76 77 77 #endif /* KERN_CONSOLE_H_ */ -
kernel/generic/include/console/kconsole.h
rcefb126 r89c57b6 62 62 size_t len; 63 63 /** Integer value. */ 64 unative_t intval;64 sysarg_t intval; 65 65 /** Resulting type of variable arg */ 66 66 cmd_arg_type_t vartype; -
kernel/generic/include/context.h
rcefb126 r89c57b6 37 37 38 38 #include <typedefs.h> 39 #include <trace.h> 39 40 #include <arch/context.h> 40 41 … … 89 90 * 90 91 */ 91 static inline void __attribute__((no_instrument_function)) 92 context_restore(context_t *ctx) 92 NO_TRACE static inline void context_restore(context_t *ctx) 93 93 { 94 94 context_restore_arch(ctx); -
kernel/generic/include/cpu.h
rcefb126 r89c57b6 83 83 * Processor ID assigned by kernel. 84 84 */ 85 size_t id;85 unsigned int id; 86 86 87 87 bool active; -
kernel/generic/include/ddi/ddi.h
rcefb126 r89c57b6 43 43 /** Structure representing contiguous physical memory area. */ 44 44 typedef struct { 45 uintptr_t pbase; /**< Physical base of the area. */ 46 pfn_t frames; /**< Number of frames in the area. */ 45 link_t link; /**< Linked list link */ 47 46 48 link_t link; /**< Linked list link */ 47 uintptr_t pbase; /**< Physical base of the area. */ 48 pfn_t frames; /**< Number of frames in the area. */ 49 bool unpriv; /**< Allow mapping by unprivileged tasks. */ 49 50 } parea_t; 50 51 … … 52 53 extern void ddi_parea_register(parea_t *); 53 54 54 extern unative_t sys_physmem_map(unative_t, unative_t, unative_t, unative_t); 55 extern unative_t sys_iospace_enable(ddi_ioarg_t *); 56 extern unative_t sys_preempt_control(int); 55 extern sysarg_t sys_physmem_map(sysarg_t, sysarg_t, sysarg_t, sysarg_t); 56 extern sysarg_t sys_iospace_enable(ddi_ioarg_t *); 57 57 58 58 /* -
kernel/generic/include/ddi/device.h
rcefb126 r89c57b6 39 39 40 40 extern devno_t device_assign_devno(void); 41 extern unative_t sys_device_assign_devno(void);41 extern sysarg_t sys_device_assign_devno(void); 42 42 43 43 #endif -
kernel/generic/include/ddi/irq.h
rcefb126 r89c57b6 54 54 /** Read 4 bytes from the I/O space. */ 55 55 CMD_PIO_READ_32, 56 56 57 /** Write 1 byte to the I/O space. */ 57 58 CMD_PIO_WRITE_8, … … 62 63 63 64 /** 64 * Perform a bit test on the source argument and store the result into 65 * the destination argument. 65 * Write 1 byte from the source argument 66 * to the I/O space. 67 */ 68 CMD_PIO_WRITE_A_8, 69 /** 70 * Write 2 bytes from the source argument 71 * to the I/O space. 72 */ 73 CMD_PIO_WRITE_A_16, 74 /** 75 * Write 4 bytes from the source argument 76 * to the I/O space. 77 */ 78 CMD_PIO_WRITE_A_32, 79 80 /** 81 * Perform a bit masking on the source argument 82 * and store the result into the destination argument. 66 83 */ 67 84 CMD_BTEST, 68 85 69 86 /** 70 * Predicate the execution of the following N commands by the boolean 71 * value of the source argument. 87 * Predicate the execution of the following 88 * N commands by the boolean value of the source 89 * argument. 72 90 */ 73 91 CMD_PREDICATE, … … 75 93 /** Accept the interrupt. */ 76 94 CMD_ACCEPT, 95 77 96 /** Decline the interrupt. */ 78 97 CMD_DECLINE, … … 122 141 /** Answerbox for notifications. */ 123 142 answerbox_t *answerbox; 124 /** Method to be used for the notification. */125 unative_tmethod;143 /** Interface and method to be used for the notification. */ 144 sysarg_t imethod; 126 145 /** Arguments that will be sent if the IRQ is claimed. */ 127 146 uint32_t scratch[IPC_CALL_LEN]; … … 189 208 extern hash_table_t irq_uspace_hash_table; 190 209 210 extern inr_t last_inr; 211 191 212 extern void irq_init(size_t, size_t); 192 213 extern void irq_initialize(irq_t *); -
kernel/generic/include/debug.h
rcefb126 r89c57b6 55 55 do { \ 56 56 if (!(expr)) \ 57 panic_assert("%s", #expr); \ 57 panic_assert("%s() at %s:%u:\n%s", \ 58 __func__, __FILE__, __LINE__, #expr); \ 58 59 } while (0) 59 60 … … 72 73 do { \ 73 74 if (!(expr)) \ 74 panic_assert("%s, %s", #expr, msg); \ 75 panic_assert("%s() at %s:%u:\n%s, %s", \ 76 __func__, __FILE__, __LINE__, #expr, msg); \ 75 77 } while (0) 76 78 -
kernel/generic/include/interrupt.h
rcefb126 r89c57b6 37 37 38 38 #include <arch/interrupt.h> 39 #include <print.h> 39 40 #include <typedefs.h> 40 41 #include <proc/task.h> … … 57 58 extern exc_table_t exc_table[]; 58 59 59 extern void fault_if_from_uspace(istate_t *, const char *, ...); 60 extern void fault_if_from_uspace(istate_t *, const char *, ...) 61 PRINTF_ATTRIBUTE(2, 3); 62 extern istate_t *istate_get(thread_t *); 60 63 extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t); 61 64 extern void exc_dispatch(unsigned int, istate_t *); -
kernel/generic/include/ipc/event.h
rcefb126 r89c57b6 47 47 /** Answerbox for notifications. */ 48 48 answerbox_t *answerbox; 49 /** Method to be used for the notification. */50 unative_tmethod;49 /** Interface and method to be used for the notification. */ 50 sysarg_t imethod; 51 51 /** Counter. */ 52 52 size_t counter; … … 54 54 55 55 extern void event_init(void); 56 extern unative_t sys_event_subscribe(unative_t, unative_t);56 extern sysarg_t sys_event_subscribe(sysarg_t, sysarg_t); 57 57 extern bool event_is_subscribed(event_type_t); 58 58 extern void event_cleanup_answerbox(answerbox_t *); … … 71 71 event_notify((e), (a1), (a2), (a3), (a4), (a5)) 72 72 73 extern void event_notify(event_type_t, unative_t, unative_t, unative_t,74 unative_t, unative_t);73 extern void event_notify(event_type_t, sysarg_t, sysarg_t, sysarg_t, 74 sysarg_t, sysarg_t); 75 75 76 76 #endif -
kernel/generic/include/ipc/event_types.h
rcefb126 r89c57b6 41 41 /** Returning from kernel console to userspace */ 42 42 EVENT_KCONSOLE, 43 /** A t hread has faulted and will be terminated */43 /** A task/thread has faulted and will be terminated */ 44 44 EVENT_FAULT, 45 45 EVENT_END -
kernel/generic/include/ipc/ipc.h
rcefb126 r89c57b6 43 43 #define IPC_CALL_LEN 6 44 44 45 /** Maximum active async calls per thread */ 46 #ifdef CONFIG_DEBUG 47 #define IPC_MAX_ASYNC_CALLS 4 48 #else 49 #define IPC_MAX_ASYNC_CALLS 4000 50 #endif 45 /** Maximum active async calls per phone */ 46 #define IPC_MAX_ASYNC_CALLS 4 51 47 52 48 /* Flags for calls */ … … 88 84 /* Macros for manipulating calling data */ 89 85 #define IPC_SET_RETVAL(data, retval) ((data).args[0] = (retval)) 90 #define IPC_SET_ METHOD(data, val)((data).args[0] = (val))86 #define IPC_SET_IMETHOD(data, val) ((data).args[0] = (val)) 91 87 #define IPC_SET_ARG1(data, val) ((data).args[1] = (val)) 92 88 #define IPC_SET_ARG2(data, val) ((data).args[2] = (val)) … … 95 91 #define IPC_SET_ARG5(data, val) ((data).args[5] = (val)) 96 92 97 #define IPC_GET_ METHOD(data) ((data).args[0])98 #define IPC_GET_RETVAL(data) ((data).args[0])93 #define IPC_GET_IMETHOD(data) ((data).args[0]) 94 #define IPC_GET_RETVAL(data) ((data).args[0]) 99 95 100 96 #define IPC_GET_ARG1(data) ((data).args[1]) … … 120 116 #define IPC_FF_ROUTE_FROM_ME (1 << 0) 121 117 118 /* Data transfer flags. */ 119 #define IPC_XF_NONE 0 120 121 /** 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 122 129 /** System-specific methods - only through special syscalls 123 * These methods have special behaviour 130 * 131 * These methods have special behaviour. These methods also 132 * have the implicit kernel interface 0. 124 133 * 125 134 */ … … 162 171 * error is sent back to caller. Otherwise 163 172 * the call is accepted and the response is sent back. 164 * - the allocated phoneid is passed to userspace 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 165 176 * (on the receiving side) as ARG5 of the call. 166 177 * … … 315 326 316 327 typedef struct { 317 unative_t args[IPC_CALL_LEN]; 328 sysarg_t args[IPC_CALL_LEN]; 329 /** Task which made or forwarded the call with IPC_FF_ROUTE_FROM_ME. */ 330 struct task *task; 331 /** Phone which made or last masqueraded this call. */ 318 332 phone_t *phone; 319 333 } ipc_data_t; … … 330 344 * The caller box is different from sender->answerbox 331 345 * for synchronous calls. 332 *333 346 */ 334 347 answerbox_t *callerbox; 335 348 336 349 /** Private data to internal IPC. */ 337 unative_t priv;350 sysarg_t priv; 338 351 339 352 /** Data passed from/to userspace. */ … … 347 360 * cases, we must keep it aside so that the answer is processed 348 361 * correctly. 349 *350 362 */ 351 363 phone_t *caller_phone; … … 372 384 373 385 extern void ipc_cleanup(void); 374 extern void ipc_backsend_err(phone_t *, call_t *, unative_t);386 extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t); 375 387 extern void ipc_answerbox_slam_phones(answerbox_t *, bool); 376 388 extern void ipc_cleanup_call_list(link_t *); -
kernel/generic/include/ipc/ipcrsc.h
rcefb126 r89c57b6 39 39 #include <ipc/ipc.h> 40 40 41 extern call_t * get_call( unative_t callid);41 extern call_t * get_call(sysarg_t callid); 42 42 extern int phone_alloc(task_t *t); 43 43 extern void phone_connect(int phoneid, answerbox_t *box); -
kernel/generic/include/ipc/irq.h
rcefb126 r89c57b6 44 44 #include <adt/list.h> 45 45 46 extern int ipc_irq_register(answerbox_t *, inr_t, devno_t, unative_t,46 extern int ipc_irq_register(answerbox_t *, inr_t, devno_t, sysarg_t, 47 47 irq_code_t *); 48 48 … … 75 75 ipc_irq_send_msg((irq), (a1), (a2), (a3), (a4), (a5)) 76 76 77 extern void ipc_irq_send_msg(irq_t *, unative_t, unative_t, unative_t, unative_t,78 unative_t);77 extern void ipc_irq_send_msg(irq_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 78 sysarg_t); 79 79 80 80 #endif -
kernel/generic/include/ipc/sysipc.h
rcefb126 r89c57b6 40 40 #include <typedefs.h> 41 41 42 extern unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, 43 unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data); 44 extern unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question, 45 ipc_data_t *reply); 46 extern unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method, 47 unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4); 48 extern unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data); 49 extern unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, 50 unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4); 51 extern unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data); 52 extern unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, 53 unsigned int nonblocking); 54 extern unative_t sys_ipc_poke(void); 55 extern unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid, 56 unative_t method, unative_t arg1, unative_t arg2, unsigned int mode); 57 extern unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid, 58 ipc_data_t *data, unsigned int mode); 59 extern unative_t sys_ipc_hangup(unative_t phoneid); 60 extern unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, 61 irq_code_t *ucode); 62 extern unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno); 63 extern unative_t sys_ipc_connect_kbox(sysarg64_t *task_id); 42 extern sysarg_t sys_ipc_call_sync_fast(sysarg_t, sysarg_t, sysarg_t, 43 sysarg_t, sysarg_t, ipc_data_t *); 44 extern sysarg_t sys_ipc_call_sync_slow(sysarg_t, ipc_data_t *, ipc_data_t *); 45 extern sysarg_t sys_ipc_call_async_fast(sysarg_t, sysarg_t, sysarg_t, 46 sysarg_t, sysarg_t, sysarg_t); 47 extern sysarg_t sys_ipc_call_async_slow(sysarg_t, ipc_data_t *); 48 extern sysarg_t sys_ipc_answer_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t, 49 sysarg_t, sysarg_t); 50 extern sysarg_t sys_ipc_answer_slow(sysarg_t, ipc_data_t *); 51 extern sysarg_t sys_ipc_wait_for_call(ipc_data_t *, uint32_t, unsigned int); 52 extern sysarg_t sys_ipc_poke(void); 53 extern sysarg_t sys_ipc_forward_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t, 54 sysarg_t, unsigned int); 55 extern sysarg_t sys_ipc_forward_slow(sysarg_t, sysarg_t, ipc_data_t *, 56 unsigned int); 57 extern sysarg_t sys_ipc_hangup(sysarg_t); 58 extern sysarg_t sys_register_irq(inr_t, devno_t, sysarg_t, irq_code_t *); 59 extern sysarg_t sys_unregister_irq(inr_t, devno_t); 60 61 #ifdef __32_BITS__ 62 63 extern sysarg_t sys_ipc_connect_kbox(sysarg64_t *); 64 65 #endif /* __32_BITS__ */ 66 67 #ifdef __64_BITS__ 68 69 extern sysarg_t sys_ipc_connect_kbox(sysarg_t); 70 71 #endif /* __64_BITS__ */ 64 72 65 73 #endif -
kernel/generic/include/lib/memfnc.h
rcefb126 r89c57b6 1 1 /* 2 * Copyright (c) 20 06 Jakub Jermar2 * Copyright (c) 2011 Martin Decky 3 3 * All rights reserved. 4 4 * … … 30 30 * @{ 31 31 */ 32 33 /** 34 * @file 35 * @brief Wrapper for explicit 64-bit arguments passed to syscalls. 32 /** @file 36 33 */ 37 34 38 #ifndef KERN_ SYSARG64_H_39 #define KERN_ SYSARG64_H_35 #ifndef KERN_LIB_MEMFNC_H_ 36 #define KERN_LIB_MEMFNC_H_ 40 37 41 typedef struct { 42 unsigned long long value; 43 } sysarg64_t; 38 #include <typedefs.h> 39 40 extern void *memset(void *, int, size_t); 41 extern void *memcpy(void *, const void *, size_t); 44 42 45 43 #endif -
kernel/generic/include/macros.h
rcefb126 r89c57b6 39 39 40 40 #include <typedefs.h> 41 #include <trace.h> 41 42 42 43 /** Return true if the intervals overlap. … … 46 47 * @param s2 Start address of the second interval. 47 48 * @param sz2 Size of the second interval. 49 * 48 50 */ 49 static inline int __attribute__((no_instrument_function)) 50 overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2)51 NO_TRACE static inline int overlaps(uint64_t s1, uint64_t sz1, uint64_t s2, 52 uint64_t sz2) 51 53 { 52 uint ptr_t e1 = s1 + sz1;53 uint ptr_t e2 = s2 + sz2;54 uint64_t e1 = s1 + sz1; 55 uint64_t e2 = s2 + sz2; 54 56 55 57 return ((s1 < e2) && (s2 < e1)); 58 } 59 60 /** Return true if the second interval is within the first interval. 61 * 62 * @param s1 Start address of the first interval. 63 * @param sz1 Size of the first interval. 64 * @param s2 Start address of the second interval. 65 * @param sz2 Size of the second interval. 66 * 67 */ 68 NO_TRACE static inline int iswithin(uint64_t s1, uint64_t sz1, uint64_t s2, 69 uint64_t sz2) 70 { 71 uint64_t e1 = s1 + sz1; 72 uint64_t e2 = s2 + sz2; 73 74 return ((s1 <= s2) && (e1 >= e2)); 56 75 } 57 76 … … 73 92 74 93 /* Compute overlapping of physical addresses */ 75 #define PA_ overlaps(x, szx, y, szy) \94 #define PA_OVERLAPS(x, szx, y, szy) \ 76 95 overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy)) 77 96 … … 85 104 #define STRING_ARG(arg) #arg 86 105 87 #define LOWER32(arg) (((uint64_t) (arg)) & 0xffffffff)88 #define UPPER32(arg) (((((uint64_t) arg)) >> 32) & 0xffffffff)106 #define LOWER32(arg) (((uint64_t) (arg)) & UINT32_C(0xffffffff)) 107 #define UPPER32(arg) (((((uint64_t) arg)) >> 32) & UINT32_C(0xffffffff)) 89 108 90 109 #define MERGE_LOUP32(lo, up) \ 91 ((((uint64_t) (lo)) & 0xffffffff) \92 | ((((uint64_t) (up)) & 0xffffffff) << 32))110 ((((uint64_t) (lo)) & UINT32_C(0xffffffff)) \ 111 | ((((uint64_t) (up)) & UINT32_C(0xffffffff)) << 32)) 93 112 94 113 /** Pseudorandom generator -
kernel/generic/include/main/main.h
rcefb126 r89c57b6 32 32 /** @file 33 33 */ 34 34 35 35 #ifndef KERN_MAIN_H_ 36 36 #define KERN_MAIN_H_ -
kernel/generic/include/main/version.h
rcefb126 r89c57b6 42 42 /** @} 43 43 */ 44 -
kernel/generic/include/memstr.h
rcefb126 r89c57b6 37 37 38 38 #include <typedefs.h> 39 #include <arch/memstr.h>40 39 41 /* 42 * Architecture independent variants. 43 */ 44 extern void *_memcpy(void *dst, const void *src, size_t cnt); 45 extern void _memsetb(void *dst, size_t cnt, uint8_t x); 46 extern void _memsetw(void *dst, size_t cnt, uint16_t x); 47 extern void *memmove(void *dst, const void *src, size_t cnt); 40 #define memset(dst, val, cnt) __builtin_memset((dst), (val), (cnt)) 41 #define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt)) 42 43 extern void memsetb(void *, size_t, uint8_t); 44 extern void memsetw(void *, size_t, uint16_t); 45 extern void *memmove(void *, const void *, size_t); 48 46 49 47 #endif -
kernel/generic/include/mm/as.h
rcefb126 r89c57b6 115 115 116 116 /** 117 * Number of processors on wich is this address space active. 118 * Protected by asidlock. 117 * Number of processors on which this 118 * address space is active. Protected by 119 * asidlock. 119 120 */ 120 121 size_t cpu_refcount; 121 122 122 /** 123 * Address space identifier. 124 * Constant on architectures that do not support ASIDs. 125 * Protected by asidlock. 123 /** Address space identifier. 124 * 125 * Constant on architectures that do not 126 * support ASIDs. Protected by asidlock. 127 * 126 128 */ 127 129 asid_t asid; 128 130 129 /** Number of references (i.e tasks that reference this as). */131 /** Number of references (i.e. tasks that reference this as). */ 130 132 atomic_t refcount; 131 133 … … 171 173 PF_ACCESS_READ, 172 174 PF_ACCESS_WRITE, 173 PF_ACCESS_EXEC 175 PF_ACCESS_EXEC, 176 PF_ACCESS_UNKNOWN 174 177 } pf_access_t; 175 178 … … 198 201 typedef struct { 199 202 mutex_t lock; 203 200 204 /** Containing address space. */ 201 205 as_t *as; 202 206 203 /** 204 * Flags related to the memory represented by the address space area. 205 */ 207 /** Memory flags. */ 206 208 unsigned int flags; 207 209 208 /** A ttributes related to the address space area itself. */210 /** Address space area attributes. */ 209 211 unsigned int attributes; 210 /** Size of this area in multiples of PAGE_SIZE. */ 212 213 /** Number of pages in the area. */ 211 214 size_t pages; 215 216 /** Number of resident pages in the area. */ 217 size_t resident; 218 212 219 /** Base address of this area. */ 213 220 uintptr_t base; 221 214 222 /** Map of used space. */ 215 223 btree_t used_space; 216 224 217 225 /** 218 * If the address space area has been shared, this pointer will219 * referencethe share info structure.226 * If the address space area is shared. this is 227 * a reference to the share info structure. 220 228 */ 221 229 share_info_t *sh_info; … … 260 268 extern bool as_area_check_access(as_area_t *, pf_access_t); 261 269 extern size_t as_area_get_size(uintptr_t); 262 extern int used_space_insert(as_area_t *, uintptr_t, size_t); 263 extern int used_space_remove(as_area_t *, uintptr_t, size_t); 264 270 extern bool used_space_insert(as_area_t *, uintptr_t, size_t); 271 extern bool used_space_remove(as_area_t *, uintptr_t, size_t); 265 272 266 273 /* Interface to be implemented by architectures. */ … … 302 309 303 310 /* Address space area related syscalls. */ 304 extern unative_t sys_as_area_create(uintptr_t, size_t, unsigned int); 305 extern unative_t sys_as_area_resize(uintptr_t, size_t, unsigned int); 306 extern unative_t sys_as_area_change_flags(uintptr_t, unsigned int); 307 extern unative_t sys_as_area_destroy(uintptr_t); 311 extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int); 312 extern sysarg_t sys_as_area_resize(uintptr_t, size_t, unsigned int); 313 extern sysarg_t sys_as_area_change_flags(uintptr_t, unsigned int); 314 extern sysarg_t sys_as_area_destroy(uintptr_t); 315 extern sysarg_t sys_as_get_unmapped_area(uintptr_t, size_t); 308 316 309 317 /* Introspection functions. */ -
kernel/generic/include/mm/frame.h
rcefb126 r89c57b6 38 38 39 39 #include <typedefs.h> 40 #include <trace.h> 40 41 #include <adt/list.h> 41 42 #include <mm/buddy.h> … … 115 116 extern zones_t zones; 116 117 117 static inline uintptr_t PFN2ADDR(pfn_t frame)118 NO_TRACE static inline uintptr_t PFN2ADDR(pfn_t frame) 118 119 { 119 120 return (uintptr_t) (frame << FRAME_WIDTH); 120 121 } 121 122 122 static inline pfn_t ADDR2PFN(uintptr_t addr)123 NO_TRACE static inline pfn_t ADDR2PFN(uintptr_t addr) 123 124 { 124 125 return (pfn_t) (addr >> FRAME_WIDTH); 125 126 } 126 127 127 static inline size_t SIZE2FRAMES(size_t size)128 NO_TRACE static inline size_t SIZE2FRAMES(size_t size) 128 129 { 129 130 if (!size) … … 132 133 } 133 134 134 static inline size_t FRAMES2SIZE(size_t frames)135 NO_TRACE static inline size_t FRAMES2SIZE(size_t frames) 135 136 { 136 137 return (size_t) (frames << FRAME_WIDTH); 137 138 } 138 139 139 static inline bool zone_flags_available(zone_flags_t flags)140 NO_TRACE static inline bool zone_flags_available(zone_flags_t flags) 140 141 { 141 142 return ((flags & (ZONE_RESERVED | ZONE_FIRMWARE)) == 0); … … 143 144 144 145 #define IS_BUDDY_ORDER_OK(index, order) \ 145 ((~((( unative_t) -1) << (order)) & (index)) == 0)146 ((~(((sysarg_t) -1) << (order)) & (index)) == 0) 146 147 #define IS_BUDDY_LEFT_BLOCK(zone, frame) \ 147 148 (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0) … … 166 167 extern void frame_set_parent(pfn_t, void *, size_t); 167 168 extern void frame_mark_unavailable(pfn_t, size_t); 168 extern uintptr_t zone_conf_size(size_t);169 extern size_t zone_conf_size(size_t); 169 170 extern bool zone_merge(size_t, size_t); 170 171 extern void zone_merge_all(void); -
kernel/generic/include/mm/slab.h
rcefb126 r89c57b6 126 126 extern void slab_cache_destroy(slab_cache_t *); 127 127 128 extern void * slab_alloc(slab_cache_t *, unsigned int); 128 extern void *slab_alloc(slab_cache_t *, unsigned int) 129 __attribute__((malloc)); 129 130 extern void slab_free(slab_cache_t *, void *); 130 131 extern size_t slab_reclaim(unsigned int); … … 138 139 139 140 /* malloc support */ 140 extern void *malloc(size_t, unsigned int); 141 extern void *malloc(size_t, unsigned int) 142 __attribute__((malloc)); 141 143 extern void *realloc(void *, size_t, unsigned int); 142 144 extern void free(void *); -
kernel/generic/include/panic.h
rcefb126 r89c57b6 37 37 38 38 #include <typedefs.h> 39 #include <print.h> 39 40 40 41 #define panic(fmt, ...) \ … … 62 63 63 64 extern void panic_common(panic_category_t, struct istate *, int, 64 uintptr_t, const char *, ...) __attribute__ ((noreturn)); 65 uintptr_t, const char *, ...) __attribute__ ((noreturn)) 66 PRINTF_ATTRIBUTE(5, 6); 65 67 66 68 #endif -
kernel/generic/include/print.h
rcefb126 r89c57b6 39 39 #include <stdarg.h> 40 40 41 #ifndef NVERIFY_PRINTF 42 43 #define PRINTF_ATTRIBUTE(start, end) \ 44 __attribute__((format(gnu_printf, start, end))) 45 46 #else /* NVERIFY_PRINTF */ 47 48 #define PRINTF_ATTRIBUTE(start, end) 49 50 #endif /* NVERIFY_PRINTF */ 51 41 52 #define EOF (-1) 42 53 43 54 extern int puts(const char *s); 44 extern int printf(const char *fmt, ...); 45 extern int snprintf(char *str, size_t size, const char *fmt, ...); 55 extern int printf(const char *fmt, ...) 56 PRINTF_ATTRIBUTE(1, 2); 57 extern int snprintf(char *str, size_t size, const char *fmt, ...) 58 PRINTF_ATTRIBUTE(3, 4); 46 59 47 60 extern int vprintf(const char *fmt, va_list ap); -
kernel/generic/include/proc/program.h
rcefb126 r89c57b6 59 59 extern void program_ready(program_t *); 60 60 61 extern unative_t sys_program_spawn_loader(char *, size_t);61 extern sysarg_t sys_program_spawn_loader(char *, size_t); 62 62 63 63 #endif -
kernel/generic/include/proc/task.h
rcefb126 r89c57b6 93 93 phone_t phones[IPC_MAX_PHONES]; 94 94 stats_ipc_t ipc_info; /**< IPC statistics */ 95 /**96 * Active asynchronous messages. It is used for limiting uspace to97 * certain extent.98 */99 atomic_t active_calls;100 95 /** List of synchronous answerboxes. */ 101 96 link_t sync_box_head; … … 136 131 extern task_t *task_find_by_id(task_id_t); 137 132 extern int task_kill(task_id_t); 133 extern void task_kill_self(bool) __attribute__((noreturn)); 138 134 extern void task_get_accounting(task_t *, uint64_t *, uint64_t *); 139 135 extern void task_print_list(bool); … … 150 146 #endif 151 147 152 extern unative_t sys_task_get_id(task_id_t *); 153 extern unative_t sys_task_set_name(const char *, size_t); 148 #ifdef __32_BITS__ 149 extern sysarg_t sys_task_get_id(sysarg64_t *); 150 #endif 151 152 #ifdef __64_BITS__ 153 extern sysarg_t sys_task_get_id(void); 154 #endif 155 156 extern sysarg_t sys_task_set_name(const char *, size_t); 157 extern sysarg_t sys_task_kill(task_id_t *); 158 extern sysarg_t sys_task_exit(sysarg_t); 154 159 155 160 #endif -
kernel/generic/include/proc/thread.h
rcefb126 r89c57b6 91 91 92 92 /** Function implementing the thread. */ 93 void (* thread_code)(void *);93 void (*thread_code)(void *); 94 94 /** Argument passed to thread_code() function. */ 95 95 void *thread_arg; 96 96 97 97 /** 98 * From here, the stored context is restored when the thread is99 * scheduled.98 * From here, the stored context is restored 99 * when the thread is scheduled. 100 100 */ 101 101 context_t saved_context; 102 /** 103 * From here, the stored timeout context is restored when sleep times 104 * out. 102 103 /** 104 * From here, the stored timeout context 105 * is restored when sleep times out. 105 106 */ 106 107 context_t sleep_timeout_context; 107 /** 108 * From here, the stored interruption context is restored when sleep is 109 * interrupted. 108 109 /** 110 * From here, the stored interruption context 111 * is restored when sleep is interrupted. 110 112 */ 111 113 context_t sleep_interruption_context; … … 125 127 */ 126 128 bool in_copy_from_uspace; 129 127 130 /** 128 131 * True if this thread is executing copy_to_uspace(). … … 187 190 188 191 #ifdef CONFIG_UDEBUG 192 /** 193 * If true, the scheduler will print a stack trace 194 * to the kernel console upon scheduling this thread. 195 */ 196 bool btrace; 197 189 198 /** Debugging stuff */ 190 199 udebug_thread_t udebug; … … 237 246 extern bool thread_exists(thread_t *); 238 247 248 #ifdef CONFIG_UDEBUG 249 extern void thread_stack_trace(thread_id_t); 250 #endif 251 239 252 /** Fpu context slab cache. */ 240 253 extern slab_cache_t *fpu_context_slab; 241 254 242 255 /* Thread syscall prototypes. */ 243 extern unative_t sys_thread_create(uspace_arg_t *, char *, size_t,256 extern sysarg_t sys_thread_create(uspace_arg_t *, char *, size_t, 244 257 thread_id_t *); 245 extern unative_t sys_thread_exit(int);246 extern unative_t sys_thread_get_id(thread_id_t *);247 extern unative_t sys_thread_usleep(uint32_t);258 extern sysarg_t sys_thread_exit(int); 259 extern sysarg_t sys_thread_get_id(thread_id_t *); 260 extern sysarg_t sys_thread_usleep(uint32_t); 248 261 249 262 #endif -
kernel/generic/include/security/cap.h
rcefb126 r89c57b6 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 35 35 /** 36 36 * @file 37 * @brief Capabilities definitions.37 * @brief Capabilities definitions. 38 38 * 39 39 * Capabilities represent virtual rights that entitle their … … 48 48 #define __CAP_H__ 49 49 50 #include <syscall/sysarg64.h>51 50 #include <typedefs.h> 52 51 … … 55 54 * privilege to/from other tasks. 56 55 */ 57 #define CAP_CAP (1<<0)56 #define CAP_CAP (1 << 0) 58 57 59 58 /** … … 61 60 * to other tasks. 62 61 */ 63 #define CAP_MEM_MANAGER (1<<1)62 #define CAP_MEM_MANAGER (1 << 1) 64 63 65 64 /** … … 67 66 * to other tasks. 68 67 */ 69 #define CAP_IO_MANAGER (1<<2) 70 71 /** 72 * CAP_PREEMPT_CONTROL allows its holder to disable/enable preemption. 73 */ 74 #define CAP_PREEMPT_CONTROL (1<<3) 68 #define CAP_IO_MANAGER (1 << 2) 75 69 76 70 /** 77 71 * CAP_IRQ_REG entitles its holder to register IRQ handlers. 78 72 */ 79 #define CAP_IRQ_REG (1<<4)73 #define CAP_IRQ_REG (1 << 3) 80 74 81 75 typedef uint32_t cap_t; 82 76 83 extern unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps); 84 extern unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps); 77 #ifdef __32_BITS__ 78 79 extern sysarg_t sys_cap_grant(sysarg64_t *, cap_t); 80 extern sysarg_t sys_cap_revoke(sysarg64_t *, cap_t); 81 82 #endif /* __32_BITS__ */ 83 84 #ifdef __64_BITS__ 85 86 extern sysarg_t sys_cap_grant(sysarg_t, cap_t); 87 extern sysarg_t sys_cap_revoke(sysarg_t, cap_t); 88 89 #endif /* __64_BITS__ */ 85 90 86 91 #endif -
kernel/generic/include/smp/smp.h
rcefb126 r89c57b6 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 41 41 42 42 #ifdef CONFIG_SMP 43 43 44 extern void smp_init(void); 44 45 extern void kmp(void *arg); 45 #else 46 47 #else /* CONFIG_SMP */ 48 46 49 #define smp_init() 50 47 51 #endif /* CONFIG_SMP */ 48 52 -
kernel/generic/include/stacktrace.h
rcefb126 r89c57b6 42 42 43 43 typedef struct { 44 bool (* frame_pointer_validate)(uintptr_t); 45 bool (* frame_pointer_prev)(uintptr_t, uintptr_t *); 46 bool (* return_address_get)(uintptr_t, uintptr_t *); 44 uintptr_t fp; 45 uintptr_t pc; 46 struct istate *istate; 47 } stack_trace_context_t; 48 49 typedef struct { 50 bool (* stack_trace_context_validate)(stack_trace_context_t *); 51 bool (* frame_pointer_prev)(stack_trace_context_t *, uintptr_t *); 52 bool (* return_address_get)(stack_trace_context_t *, uintptr_t *); 47 53 bool (* symbol_resolve)(uintptr_t, const char **, uintptr_t *); 48 54 } stack_trace_ops_t; … … 53 59 extern void stack_trace(void); 54 60 extern void stack_trace_istate(struct istate *); 55 extern void stack_trace_ fp_pc(stack_trace_ops_t *, uintptr_t, uintptr_t);61 extern void stack_trace_ctx(stack_trace_ops_t *, stack_trace_context_t *); 56 62 57 63 /* … … 61 67 extern uintptr_t program_counter_get(void); 62 68 63 extern bool kernel_ frame_pointer_validate(uintptr_t);64 extern bool kernel_frame_pointer_prev( uintptr_t, uintptr_t *);65 extern bool kernel_return_address_get( uintptr_t, uintptr_t *);69 extern bool kernel_stack_trace_context_validate(stack_trace_context_t *); 70 extern bool kernel_frame_pointer_prev(stack_trace_context_t *, uintptr_t *); 71 extern bool kernel_return_address_get(stack_trace_context_t *, uintptr_t *); 66 72 67 extern bool uspace_ frame_pointer_validate(uintptr_t);68 extern bool uspace_frame_pointer_prev( uintptr_t, uintptr_t *);69 extern bool uspace_return_address_get( uintptr_t, uintptr_t *);73 extern bool uspace_stack_trace_context_validate(stack_trace_context_t *); 74 extern bool uspace_frame_pointer_prev(stack_trace_context_t *, uintptr_t *); 75 extern bool uspace_return_address_get(stack_trace_context_t *, uintptr_t *); 70 76 71 77 #endif -
kernel/generic/include/stdint.h
rcefb126 r89c57b6 36 36 #define KERN_STDINT_H_ 37 37 38 #define INT8_MIN (0x80)39 #define INT8_MAX (0x7F)38 #define INT8_MIN INT8_C(0x80) 39 #define INT8_MAX INT8_C(0x7F) 40 40 41 #define UINT8_MIN (0u)42 #define UINT8_MAX (0xFFu)41 #define UINT8_MIN UINT8_C(0) 42 #define UINT8_MAX UINT8_C(0xFF) 43 43 44 #define INT16_MIN (0x8000)45 #define INT16_MAX (0x7FFF)44 #define INT16_MIN INT16_C(0x8000) 45 #define INT16_MAX INT16_C(0x7FFF) 46 46 47 #define UINT16_MIN (0u)48 #define UINT16_MAX (0xFFFFu)47 #define UINT16_MIN UINT16_C(0) 48 #define UINT16_MAX UINT16_C(0xFFFF) 49 49 50 #define INT32_MIN (0x80000000l)51 #define INT32_MAX (0x7FFFFFFFl)50 #define INT32_MIN INT32_C(0x80000000) 51 #define INT32_MAX INT32_C(0x7FFFFFFF) 52 52 53 #define UINT32_MIN (0ul)54 #define UINT32_MAX (0xFFFFFFFFul)53 #define UINT32_MIN UINT32_C(0) 54 #define UINT32_MAX UINT32_C(0xFFFFFFFF) 55 55 56 #define INT64_MIN (0x8000000000000000ll)57 #define INT64_MAX (0x7FFFFFFFFFFFFFFFll)56 #define INT64_MIN INT64_C(0x8000000000000000) 57 #define INT64_MAX INT64_C(0x7FFFFFFFFFFFFFFF) 58 58 59 #define UINT64_MIN (0ull)60 #define UINT64_MAX (0xFFFFFFFFFFFFFFFFull)59 #define UINT64_MIN UINT64_C(0) 60 #define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) 61 61 62 62 #endif -
kernel/generic/include/synch/futex.h
rcefb126 r89c57b6 52 52 53 53 extern void futex_init(void); 54 extern unative_t sys_futex_sleep(uintptr_t);55 extern unative_t sys_futex_wakeup(uintptr_t);54 extern sysarg_t sys_futex_sleep(uintptr_t); 55 extern sysarg_t sys_futex_wakeup(uintptr_t); 56 56 57 57 extern void futex_cleanup(void); -
kernel/generic/include/synch/smc.h
rcefb126 r89c57b6 36 36 #define KERN_SMC_H_ 37 37 38 extern unative_t sys_smc_coherence(uintptr_t va, size_t size);38 extern sysarg_t sys_smc_coherence(uintptr_t va, size_t size); 39 39 40 40 #endif -
kernel/generic/include/synch/spinlock.h
rcefb126 r89c57b6 124 124 * 125 125 */ 126 static inline void spinlock_unlock_nondebug(spinlock_t *lock)126 NO_TRACE static inline void spinlock_unlock_nondebug(spinlock_t *lock) 127 127 { 128 128 /* … … 146 146 if ((pname)++ > (value)) { \ 147 147 (pname) = 0; \ 148 printf("Deadlock probe %s: exceeded threshold %u\n" ,\148 printf("Deadlock probe %s: exceeded threshold %u\n" \ 149 149 "cpu%u: function=%s, line=%u\n", \ 150 150 #pname, (value), CPU->id, __func__, __LINE__); \ -
kernel/generic/include/syscall/syscall.h
rcefb126 r89c57b6 38 38 typedef enum { 39 39 SYS_KLOG = 0, 40 SYS_TLS_SET = 1, /* Hardcoded in AMD64, IA32 uspace - fibril.S*/40 SYS_TLS_SET = 1, /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */ 41 41 42 42 SYS_THREAD_CREATE, … … 47 47 SYS_TASK_GET_ID, 48 48 SYS_TASK_SET_NAME, 49 SYS_TASK_KILL, 50 SYS_TASK_EXIT, 49 51 SYS_PROGRAM_SPAWN_LOADER, 50 52 … … 57 59 SYS_AS_AREA_CHANGE_FLAGS, 58 60 SYS_AS_AREA_DESTROY, 61 SYS_AS_GET_UNMAPPED_AREA, 59 62 60 63 SYS_IPC_CALL_SYNC_FAST, … … 69 72 SYS_IPC_POKE, 70 73 SYS_IPC_HANGUP, 71 SYS_IPC_REGISTER_IRQ, 72 SYS_IPC_UNREGISTER_IRQ, 74 SYS_IPC_CONNECT_KBOX, 73 75 74 76 SYS_EVENT_SUBSCRIBE, … … 80 82 SYS_PHYSMEM_MAP, 81 83 SYS_IOSPACE_ENABLE, 82 SYS_PREEMPT_CONTROL, 84 SYS_REGISTER_IRQ, 85 SYS_UNREGISTER_IRQ, 83 86 84 87 SYS_SYSINFO_GET_TAG, … … 90 93 SYS_DEBUG_DISABLE_CONSOLE, 91 94 92 SYS_IPC_CONNECT_KBOX,93 95 SYSCALL_END 94 96 } syscall_t; … … 98 100 #include <typedefs.h> 99 101 100 typedef unative_t (*syshandler_t)(unative_t, unative_t, unative_t, unative_t,101 unative_t, unative_t);102 typedef sysarg_t (*syshandler_t)(sysarg_t, sysarg_t, sysarg_t, sysarg_t, 103 sysarg_t, sysarg_t); 102 104 103 105 extern syshandler_t syscall_table[SYSCALL_END]; 104 extern unative_t syscall_handler(unative_t, unative_t, unative_t, unative_t,105 unative_t, unative_t, unative_t);106 extern unative_t sys_tls_set(unative_t);106 extern sysarg_t syscall_handler(sysarg_t, sysarg_t, sysarg_t, sysarg_t, 107 sysarg_t, sysarg_t, sysarg_t); 108 extern sysarg_t sys_tls_set(sysarg_t); 107 109 108 110 #endif -
kernel/generic/include/sysinfo/abi.h
rcefb126 r89c57b6 66 66 */ 67 67 typedef struct { 68 size_t id;/**< CPU ID as stored by kernel */68 unsigned int id; /**< CPU ID as stored by kernel */ 69 69 bool active; /**< CPU is activate */ 70 70 uint16_t frequency_mhz; /**< Frequency in MHz */ … … 104 104 char name[TASK_NAME_BUFLEN]; /**< Task name (in kernel) */ 105 105 size_t virtmem; /**< Size of VAS (bytes) */ 106 size_t resmem; /**< Size of resident (used) memory (bytes) */ 106 107 size_t threads; /**< Number of threads */ 107 108 uint64_t ucycles; /**< Number of CPU cycles in user space */ -
kernel/generic/include/sysinfo/sysinfo.h
rcefb126 r89c57b6 65 65 66 66 /** Gerated numeric value function */ 67 typedef unative_t (*sysinfo_fn_val_t)(struct sysinfo_item *);67 typedef sysarg_t (*sysinfo_fn_val_t)(struct sysinfo_item *); 68 68 69 69 /** Generated binary data function */ … … 82 82 */ 83 83 typedef union { 84 unative_t val;/**< Constant numberic value */84 sysarg_t val; /**< Constant numberic value */ 85 85 sysinfo_fn_val_t fn_val; /**< Generated numeric value function */ 86 86 sysinfo_fn_data_t fn_data; /**< Generated binary data function */ … … 99 99 sysinfo_item_val_type_t tag; /**< Return value type */ 100 100 union { 101 unative_t val;/**< Numberic value */101 sysarg_t val; /**< Numberic value */ 102 102 sysinfo_data_t data; /**< Binary data */ 103 103 }; … … 130 130 } sysinfo_item_t; 131 131 132 extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, unative_t);132 extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, sysarg_t); 133 133 extern void sysinfo_set_item_data(const char *, sysinfo_item_t **, void *, 134 134 size_t); … … 145 145 extern void sysinfo_dump(sysinfo_item_t *); 146 146 147 extern unative_t sys_sysinfo_get_tag(void *, size_t);148 extern unative_t sys_sysinfo_get_value(void *, size_t, void *);149 extern unative_t sys_sysinfo_get_data_size(void *, size_t, void *);150 extern unative_t sys_sysinfo_get_data(void *, size_t, void *, size_t);147 extern sysarg_t sys_sysinfo_get_tag(void *, size_t); 148 extern sysarg_t sys_sysinfo_get_value(void *, size_t, void *); 149 extern sysarg_t sys_sysinfo_get_data_size(void *, size_t, void *); 150 extern sysarg_t sys_sysinfo_get_data(void *, size_t, void *, size_t, size_t *); 151 151 152 152 #endif -
kernel/generic/include/time/clock.h
rcefb126 r89c57b6 42 42 /** Uptime structure */ 43 43 typedef struct { 44 unative_t seconds1;45 unative_t useconds;46 unative_t seconds2;44 sysarg_t seconds1; 45 sysarg_t useconds; 46 sysarg_t seconds2; 47 47 } uptime_t; 48 48 -
kernel/generic/include/typedefs.h
rcefb126 r89c57b6 40 40 #include <arch/types.h> 41 41 42 #define NULL 042 #define NULL ((void *) 0) 43 43 44 44 #define false 0 … … 69 69 typedef int32_t devno_t; 70 70 71 typedef int32_t wchar_t;72 73 71 typedef volatile uint8_t ioport8_t; 74 72 typedef volatile uint16_t ioport16_t; 75 73 typedef volatile uint32_t ioport32_t; 74 75 #ifdef __32_BITS__ 76 77 /** Explicit 64-bit arguments passed to syscalls. */ 78 typedef uint64_t sysarg64_t; 79 80 #endif /* __32_BITS__ */ 76 81 77 82 #endif -
kernel/generic/include/udebug/udebug.h
rcefb126 r89c57b6 36 36 #define KERN_UDEBUG_H_ 37 37 38 #define UDEBUG_EVMASK(event) (1 << ((event) - 1)) 39 40 typedef enum { /* udebug_method_t */ 41 42 /** Start debugging the recipient. 43 * 44 * Causes all threads in the receiving task to stop. When they 45 * are all stoped, an answer with retval 0 is generated. 46 * 47 */ 48 UDEBUG_M_BEGIN = 1, 49 50 /** Finish debugging the recipient. 51 * 52 * Answers all pending GO and GUARD messages. 53 * 54 */ 55 UDEBUG_M_END, 56 57 /** Set which events should be captured. */ 58 UDEBUG_M_SET_EVMASK, 59 60 /** Make sure the debugged task is still there. 61 * 62 * This message is answered when the debugged task dies 63 * or the debugging session ends. 64 * 65 */ 66 UDEBUG_M_GUARD, 67 68 /** Run a thread until a debugging event occurs. 69 * 70 * This message is answered when the thread stops 71 * in a debugging event. 72 * 73 * - ARG2 - id of the thread to run 74 * 75 */ 76 UDEBUG_M_GO, 77 78 /** Stop a thread being debugged. 79 * 80 * Creates a special STOP event in the thread, causing 81 * it to answer a pending GO message (if any). 82 * 83 */ 84 UDEBUG_M_STOP, 85 86 /** Read arguments of a syscall. 87 * 88 * - ARG2 - thread identification 89 * - ARG3 - destination address in the caller's address space 90 * 91 */ 92 UDEBUG_M_ARGS_READ, 93 94 /** Read thread's userspace register state (istate_t). 95 * 96 * - ARG2 - thread identification 97 * - ARG3 - destination address in the caller's address space 98 * 99 * or, on error, retval will be 100 * - ENOENT - thread does not exist 101 * - EBUSY - register state not available 102 */ 103 UDEBUG_M_REGS_READ, 104 105 /** Read the list of the debugged tasks's threads. 106 * 107 * - ARG2 - destination address in the caller's address space 108 * - ARG3 - size of receiving buffer in bytes 109 * 110 * The kernel fills the buffer with a series of sysarg_t values 111 * (thread ids). On answer, the kernel will set: 112 * 113 * - ARG2 - number of bytes that were actually copied 114 * - ARG3 - number of bytes of the complete data 115 * 116 */ 117 UDEBUG_M_THREAD_READ, 118 119 /** Read the name of the debugged task. 120 * 121 * - ARG2 - destination address in the caller's address space 122 * - ARG3 - size of receiving buffer in bytes 123 * 124 * The kernel fills the buffer with a non-terminated string. 125 * 126 * - ARG2 - number of bytes that were actually copied 127 * - ARG3 - number of bytes of the complete data 128 * 129 */ 130 UDEBUG_M_NAME_READ, 131 132 /** Read the list of the debugged task's address space areas. 133 * 134 * - ARG2 - destination address in the caller's address space 135 * - ARG3 - size of receiving buffer in bytes 136 * 137 * The kernel fills the buffer with a series of as_area_info_t structures. 138 * Upon answer, the kernel will set: 139 * 140 * - ARG2 - number of bytes that were actually copied 141 * - ARG3 - number of bytes of the complete data 142 * 143 */ 144 UDEBUG_M_AREAS_READ, 145 146 /** Read the debugged tasks's memory. 147 * 148 * - ARG2 - destination address in the caller's address space 149 * - ARG3 - source address in the recipient's address space 150 * - ARG4 - size of receiving buffer in bytes 151 * 152 */ 153 UDEBUG_M_MEM_READ 154 } udebug_method_t; 155 156 typedef enum { 157 UDEBUG_EVENT_FINISHED = 1, /**< Debuging session has finished */ 158 UDEBUG_EVENT_STOP, /**< Stopped on DEBUG_STOP request */ 159 UDEBUG_EVENT_SYSCALL_B, /**< Before beginning syscall execution */ 160 UDEBUG_EVENT_SYSCALL_E, /**< After finishing syscall execution */ 161 UDEBUG_EVENT_THREAD_B, /**< The task created a new thread */ 162 UDEBUG_EVENT_THREAD_E /**< A thread exited */ 163 } udebug_event_t; 164 165 typedef enum { 166 UDEBUG_EM_FINISHED = UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED), 167 UDEBUG_EM_STOP = UDEBUG_EVMASK(UDEBUG_EVENT_STOP), 168 UDEBUG_EM_SYSCALL_B = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B), 169 UDEBUG_EM_SYSCALL_E = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E), 170 UDEBUG_EM_THREAD_B = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B), 171 UDEBUG_EM_THREAD_E = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E), 172 UDEBUG_EM_ALL = 173 (UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) | 174 UDEBUG_EVMASK(UDEBUG_EVENT_STOP) | 175 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) | 176 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) | 177 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) | 178 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E)) 179 } udebug_evmask_t; 180 181 #ifdef KERNEL 182 38 183 #include <ipc/ipc.h> 39 40 typedef enum { /* udebug_method_t */41 42 /** Start debugging the recipient.43 * Causes all threads in the receiving task to stop. When they44 * are all stoped, an answer with retval 0 is generated.45 */46 UDEBUG_M_BEGIN = 1,47 48 /** Finish debugging the recipient.49 * Answers all pending GO and GUARD messages.50 */51 UDEBUG_M_END,52 53 /** Set which events should be captured.54 */55 UDEBUG_M_SET_EVMASK,56 57 /** Make sure the debugged task is still there.58 * This message is answered when the debugged task dies59 * or the debugging session ends.60 */61 UDEBUG_M_GUARD,62 63 /** Run a thread until a debugging event occurs.64 * This message is answered when the thread stops65 * in a debugging event.66 *67 * - ARG2 - id of the thread to run68 */69 UDEBUG_M_GO,70 71 /** Stop a thread being debugged.72 * Creates a special STOP event in the thread, causing73 * it to answer a pending GO message (if any).74 */75 UDEBUG_M_STOP,76 77 /** Read arguments of a syscall.78 *79 * - ARG2 - thread identification80 * - ARG3 - destination address in the caller's address space81 *82 */83 UDEBUG_M_ARGS_READ,84 85 /** Read thread's userspace register state (istate_t).86 *87 * - ARG2 - thread identification88 * - ARG3 - destination address in the caller's address space89 *90 * or, on error, retval will be91 * - ENOENT - thread does not exist92 * - EBUSY - register state not available93 */94 UDEBUG_M_REGS_READ,95 96 /** Read the list of the debugged tasks's threads.97 *98 * - ARG2 - destination address in the caller's address space99 * - ARG3 - size of receiving buffer in bytes100 *101 * The kernel fills the buffer with a series of sysarg_t values102 * (thread ids). On answer, the kernel will set:103 *104 * - ARG2 - number of bytes that were actually copied105 * - ARG3 - number of bytes of the complete data106 *107 */108 UDEBUG_M_THREAD_READ,109 110 /** Read the name of the debugged task.111 *112 * - ARG2 - destination address in the caller's address space113 * - ARG3 - size of receiving buffer in bytes114 *115 * The kernel fills the buffer with a non-terminated string.116 *117 * - ARG2 - number of bytes that were actually copied118 * - ARG3 - number of bytes of the complete data119 *120 */121 UDEBUG_M_NAME_READ,122 123 /** Read the list of the debugged task's address space areas.124 *125 * - ARG2 - destination address in the caller's address space126 * - ARG3 - size of receiving buffer in bytes127 *128 * The kernel fills the buffer with a series of as_area_info_t structures.129 * Upon answer, the kernel will set:130 *131 * - ARG2 - number of bytes that were actually copied132 * - ARG3 - number of bytes of the complete data133 *134 */135 UDEBUG_M_AREAS_READ,136 137 /** Read the debugged tasks's memory.138 *139 * - ARG2 - destination address in the caller's address space140 * - ARG3 - source address in the recipient's address space141 * - ARG4 - size of receiving buffer in bytes142 *143 */144 UDEBUG_M_MEM_READ,145 146 } udebug_method_t;147 148 149 typedef enum {150 UDEBUG_EVENT_FINISHED = 1, /**< Debuging session has finished */151 UDEBUG_EVENT_STOP, /**< Stopped on DEBUG_STOP request */152 UDEBUG_EVENT_SYSCALL_B, /**< Before beginning syscall execution */153 UDEBUG_EVENT_SYSCALL_E, /**< After finishing syscall execution */154 UDEBUG_EVENT_THREAD_B, /**< The task created a new thread */155 UDEBUG_EVENT_THREAD_E /**< A thread exited */156 } udebug_event_t;157 158 #define UDEBUG_EVMASK(event) (1 << ((event) - 1))159 160 typedef enum {161 UDEBUG_EM_FINISHED = UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED),162 UDEBUG_EM_STOP = UDEBUG_EVMASK(UDEBUG_EVENT_STOP),163 UDEBUG_EM_SYSCALL_B = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B),164 UDEBUG_EM_SYSCALL_E = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E),165 UDEBUG_EM_THREAD_B = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B),166 UDEBUG_EM_THREAD_E = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E),167 UDEBUG_EM_ALL =168 UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) |169 UDEBUG_EVMASK(UDEBUG_EVENT_STOP) |170 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) |171 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) |172 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) |173 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E)174 } udebug_evmask_t;175 176 #ifdef KERNEL177 178 184 #include <synch/mutex.h> 179 185 #include <synch/condvar.h> … … 196 202 mutex_t lock; 197 203 char *lock_owner; 198 204 199 205 udebug_task_state_t dt_state; 200 206 call_t *begin_call; … … 209 215 /** Synchronize debug ops on this thread / access to this structure. */ 210 216 mutex_t lock; 211 217 212 218 waitq_t go_wq; 213 219 call_t *go_call; 214 unative_t syscall_args[6];220 sysarg_t syscall_args[6]; 215 221 istate_t *uspace_state; 216 222 217 223 /** What type of event are we stopped in or 0 if none. */ 218 224 udebug_event_t cur_event; 219 bool go; /**< thread is GO */220 bool stoppable; /**< thread is stoppable */221 bool active; /**< thread is in a debugging session */225 bool go; /**< Thread is GO */ 226 bool stoppable; /**< Thread is stoppable */ 227 bool active; /**< Thread is in a debugging session */ 222 228 condvar_t active_cv; 223 229 } udebug_thread_t; … … 226 232 struct thread; 227 233 228 void udebug_task_init(udebug_task_t *ut); 229 void udebug_thread_initialize(udebug_thread_t *ut); 230 231 void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3, 232 unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc, 233 bool end_variant); 234 235 void udebug_thread_b_event_attach(struct thread *t, struct task *ta); 234 void udebug_task_init(udebug_task_t *); 235 void udebug_thread_initialize(udebug_thread_t *); 236 237 void udebug_syscall_event(sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 238 sysarg_t, sysarg_t, sysarg_t, bool); 239 240 void udebug_thread_b_event_attach(struct thread *, struct task *); 236 241 void udebug_thread_e_event(void); 237 242 … … 241 246 void udebug_before_thread_runs(void); 242 247 243 int udebug_task_cleanup(struct task * ta);248 int udebug_task_cleanup(struct task *); 244 249 void udebug_thread_fault(void); 245 250 -
kernel/generic/include/udebug/udebug_ipc.h
rcefb126 r89c57b6 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 41 41 void udebug_call_receive(call_t *call); 42 42 43 44 43 #endif 45 44 -
kernel/generic/include/udebug/udebug_ops.h
rcefb126 r89c57b6 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 52 52 int udebug_regs_read(thread_t *t, void **buffer); 53 53 54 int udebug_mem_read( unative_t uspace_addr, size_t n, void **buffer);54 int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer); 55 55 56 56 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
