Changeset cf2af94 in mainline for kernel/generic/include
- Timestamp:
- 2011-02-09T11:46:47Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cb15135a
- Parents:
- a49c4002 (diff), 0b37882 (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:
-
- 29 edited
-
adt/hash_table.h (modified) (3 diffs)
-
console/console.h (modified) (1 diff)
-
console/kconsole.h (modified) (1 diff)
-
ddi/ddi.h (modified) (3 diffs)
-
ddi/device.h (modified) (1 diff)
-
ddi/irq.h (modified) (5 diffs)
-
debug.h (modified) (2 diffs)
-
interrupt.h (modified) (1 diff)
-
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)
-
mm/as.h (modified) (4 diffs)
-
mm/frame.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) (4 diffs)
-
synch/futex.h (modified) (1 diff)
-
synch/smc.h (modified) (1 diff)
-
syscall/syscall.h (modified) (7 diffs)
-
sysinfo/abi.h (modified) (1 diff)
-
sysinfo/sysinfo.h (modified) (5 diffs)
-
time/clock.h (modified) (1 diff)
-
typedefs.h (modified) (1 diff)
-
udebug/udebug.h (modified) (5 diffs)
-
udebug/udebug_ops.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/hash_table.h
ra49c4002 rcf2af94 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/console/console.h
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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/ddi/ddi.h
ra49c4002 rcf2af94 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_interrupt_enable(int irq, int enable); 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 /* … … 61 61 extern int ddi_iospace_enable_arch(task_t *, uintptr_t, size_t); 62 62 63 64 63 #endif 65 64 -
kernel/generic/include/ddi/device.h
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 60 60 extern void fault_if_from_uspace(istate_t *, const char *, ...) 61 61 PRINTF_ATTRIBUTE(2, 3); 62 extern istate_t *istate_get(thread_t *); 62 63 extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t); 63 64 extern void exc_dispatch(unsigned int, istate_t *); -
kernel/generic/include/ipc/event.h
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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 /** Kernel IPC interfaces 119 * 120 */ 121 #define IPC_IF_KERNEL 0 122 122 123 /** System-specific methods - only through special syscalls 123 * These methods have special behaviour 124 * 125 * These methods have special behaviour. These methods also 126 * have the implicit kernel interface 0. 124 127 * 125 128 */ … … 162 165 * error is sent back to caller. Otherwise 163 166 * the call is accepted and the response is sent back. 164 * - the allocated phoneid is passed to userspace 167 * - the hash of the client task is passed to userspace 168 * (on the receiving side) as ARG4 of the call. 169 * - the hash of the allocated phone is passed to userspace 165 170 * (on the receiving side) as ARG5 of the call. 166 171 * … … 315 320 316 321 typedef struct { 317 unative_t args[IPC_CALL_LEN]; 322 sysarg_t args[IPC_CALL_LEN]; 323 /** Task which made or forwarded the call with IPC_FF_ROUTE_FROM_ME. */ 324 struct task *task; 325 /** Phone which made or last masqueraded this call. */ 318 326 phone_t *phone; 319 327 } ipc_data_t; … … 330 338 * The caller box is different from sender->answerbox 331 339 * for synchronous calls. 332 *333 340 */ 334 341 answerbox_t *callerbox; 335 342 336 343 /** Private data to internal IPC. */ 337 unative_t priv;344 sysarg_t priv; 338 345 339 346 /** Data passed from/to userspace. */ … … 347 354 * cases, we must keep it aside so that the answer is processed 348 355 * correctly. 349 *350 356 */ 351 357 phone_t *caller_phone; … … 372 378 373 379 extern void ipc_cleanup(void); 374 extern void ipc_backsend_err(phone_t *, call_t *, unative_t);380 extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t); 375 381 extern void ipc_answerbox_slam_phones(answerbox_t *, bool); 376 382 extern void ipc_cleanup_call_list(link_t *); -
kernel/generic/include/ipc/ipcrsc.h
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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/mm/as.h
ra49c4002 rcf2af94 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 … … 199 201 typedef struct { 200 202 mutex_t lock; 203 201 204 /** Containing address space. */ 202 205 as_t *as; 203 206 204 /** 205 * Flags related to the memory represented by the address space area. 206 */ 207 /** Memory flags. */ 207 208 unsigned int flags; 208 209 209 /** A ttributes related to the address space area itself. */210 /** Address space area attributes. */ 210 211 unsigned int attributes; 211 /** Size of this area in multiples of PAGE_SIZE. */ 212 213 /** Number of pages in the area. */ 212 214 size_t pages; 215 216 /** Number of resident pages in the area. */ 217 size_t resident; 218 213 219 /** Base address of this area. */ 214 220 uintptr_t base; 221 215 222 /** Map of used space. */ 216 223 btree_t used_space; 217 224 218 225 /** 219 * If the address space area has been shared, this pointer will220 * referencethe share info structure.226 * If the address space area is shared. this is 227 * a reference to the share info structure. 221 228 */ 222 229 share_info_t *sh_info; … … 261 268 extern bool as_area_check_access(as_area_t *, pf_access_t); 262 269 extern size_t as_area_get_size(uintptr_t); 263 extern int used_space_insert(as_area_t *, uintptr_t, size_t); 264 extern int used_space_remove(as_area_t *, uintptr_t, size_t); 265 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); 266 272 267 273 /* Interface to be implemented by architectures. */ … … 303 309 304 310 /* Address space area related syscalls. */ 305 extern unative_t sys_as_area_create(uintptr_t, size_t, unsigned int); 306 extern unative_t sys_as_area_resize(uintptr_t, size_t, unsigned int); 307 extern unative_t sys_as_area_change_flags(uintptr_t, unsigned int); 308 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); 309 316 310 317 /* Introspection functions. */ -
kernel/generic/include/mm/frame.h
ra49c4002 rcf2af94 144 144 145 145 #define IS_BUDDY_ORDER_OK(index, order) \ 146 ((~((( unative_t) -1) << (order)) & (index)) == 0)146 ((~(((sysarg_t) -1) << (order)) & (index)) == 0) 147 147 #define IS_BUDDY_LEFT_BLOCK(zone, frame) \ 148 148 (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0) -
kernel/generic/include/proc/program.h
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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)68 #define CAP_IO_MANAGER (1 << 2) 70 69 71 70 /** 72 71 * CAP_IRQ_REG entitles its holder to register IRQ handlers. 73 72 */ 74 #define CAP_IRQ_REG (1<<3)73 #define CAP_IRQ_REG (1 << 3) 75 74 76 75 typedef uint32_t cap_t; 77 76 78 extern unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps); 79 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__ */ 80 90 81 91 #endif -
kernel/generic/include/synch/futex.h
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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/syscall/syscall.h
ra49c4002 rcf2af94 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_INTERRUPT_ENABLE, 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 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
ra49c4002 rcf2af94 73 73 typedef volatile uint32_t ioport32_t; 74 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__ */ 81 75 82 #endif 76 83 -
kernel/generic/include/udebug/udebug.h
ra49c4002 rcf2af94 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_ops.h
ra49c4002 rcf2af94 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.
