Changeset b3f8fb7 in mainline for kernel/generic/include
- Timestamp:
- 2007-01-28T13:25:49Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e8c1a5
- Parents:
- 1ba41c5
- Location:
- kernel/generic/include
- Files:
-
- 1 added
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/bitmap.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 41 40 #define BITS2BYTES(bits) (bits ? ((((bits)-1)>>3)+1) : 0) -
kernel/generic/include/adt/btree.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <adt/list.h> 41 40 … … 46 45 47 46 /** B-tree node structure. */ 48 struct btree_node {47 typedef struct btree_node { 49 48 /** Number of keys. */ 50 49 count_t keys; … … 66 65 * There is room for storing a subtree pointer for the extra key. 67 66 */ 68 btree_node_t*subtree[BTREE_M + 1];67 struct btree_node *subtree[BTREE_M + 1]; 69 68 70 69 /** Pointer to parent node. Root node has NULL parent. */ 71 btree_node_t*parent;70 struct btree_node *parent; 72 71 73 72 /** Link connecting leaf-level nodes. Defined only when this node is a leaf. */ … … 77 76 link_t bfs_link; 78 77 int depth; 79 } ;78 } btree_node_t; 80 79 81 80 /** B-tree structure. */ 82 struct btree{81 typedef struct { 83 82 btree_node_t *root; /**< B-tree root node pointer. */ 84 83 link_t leaf_head; /**< Leaf-level list head. */ 85 } ;84 } btree_t; 86 85 87 86 extern void btree_init(void); -
kernel/generic/include/adt/fifo.h
r1ba41c5 rb3f8fb7 46 46 #define KERN_FIFO_H_ 47 47 48 #include <typedefs.h>49 48 #include <mm/slab.h> 50 49 -
kernel/generic/include/adt/hash_table.h
r1ba41c5 rb3f8fb7 38 38 #include <adt/list.h> 39 39 #include <arch/types.h> 40 #include <typedefs.h>41 42 /** Hash table structure. */43 struct hash_table {44 link_t *entry;45 count_t entries;46 count_t max_keys;47 hash_table_operations_t *op;48 };49 40 50 41 /** Set of operations for hash table. */ 51 struct hash_table_operations{42 typedef struct { 52 43 /** Hash function. 53 44 * … … 71 62 */ 72 63 void (*remove_callback)(link_t *item); 73 }; 64 } hash_table_operations_t; 65 66 /** Hash table structure. */ 67 typedef struct { 68 link_t *entry; 69 count_t entries; 70 count_t max_keys; 71 hash_table_operations_t *op; 72 } hash_table_t; 74 73 75 74 #define hash_table_get_instance(item, type, member) list_get_instance((item), type, member) -
kernel/generic/include/adt/list.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 41 40 /** Doubly linked list head and link type. */ 42 struct link {43 link_t*prev; /**< Pointer to the previous item in the list. */44 link_t*next; /**< Pointer to the next item in the list. */45 } ;41 typedef struct link { 42 struct link *prev; /**< Pointer to the previous item in the list. */ 43 struct link *next; /**< Pointer to the next item in the list. */ 44 } link_t; 46 45 47 46 /** Declare and initialize statically allocated list. -
kernel/generic/include/arch.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_ARCH_H_ 37 37 38 #include <arch/types.h>39 38 #include <arch/arch.h> 40 #include <typedefs.h> 41 42 #include <cpu.h> 43 #include <arch/cpu.h> 44 #include <arch/asm.h> 39 #include <proc/task.h> 45 40 46 41 #define DEFAULT_CONTEXT 0 -
kernel/generic/include/bitops.h
r1ba41c5 rb3f8fb7 35 35 #ifndef KERN_BITOPS_H_ 36 36 #define KERN_BITOPS_H_ 37 38 #include <typedefs.h>39 37 40 38 -
kernel/generic/include/config.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <arch/mm/page.h> 41 40 -
kernel/generic/include/console/chardev.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_CHARDEV_H_ 37 37 38 #include <typedefs.h>39 38 #include <arch/types.h> 40 39 #include <synch/waitq.h> … … 43 42 #define CHARDEV_BUFLEN 512 44 43 44 struct chardev; 45 45 46 /* Character device operations interface. */ 46 struct chardev_operations{47 void (* suspend)( chardev_t*); /**< Suspend pushing characters. */48 void (* resume)( chardev_t*); /**< Resume pushing characters. */49 void (* write)( chardev_t*, char c); /**< Write character to stream. */47 typedef struct { 48 void (* suspend)(struct chardev *); /**< Suspend pushing characters. */ 49 void (* resume)(struct chardev *); /**< Resume pushing characters. */ 50 void (* write)(struct chardev *, char c); /**< Write character to stream. */ 50 51 /** Read character directly from device, assume interrupts disabled */ 51 char (* read)(chardev_t *); 52 }; 53 54 typedef struct chardev_operations chardev_operations_t; 52 char (* read)(struct chardev *); 53 } chardev_operations_t; 55 54 56 55 /** Character input device. */ 57 struct chardev {56 typedef struct chardev { 58 57 char *name; 59 58 … … 65 64 index_t index; 66 65 void *data; 67 } ;66 } chardev_t; 68 67 69 68 extern void chardev_initialize(char *name, -
kernel/generic/include/console/cmd.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_CMD_H_ 37 37 38 #include < typedefs.h>38 #include <console/kconsole.h> 39 39 40 40 extern void cmd_initialize(cmd_info_t *cmd); -
kernel/generic/include/console/console.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include < typedefs.h>39 #include <console/chardev.h> 40 40 41 41 extern chardev_t *stdin; -
kernel/generic/include/console/kconsole.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_KCONSOLE_H_ 37 37 38 #include <typedefs.h>39 38 #include <adt/list.h> 40 39 #include <synch/spinlock.h> … … 43 42 #define KCONSOLE_HISTORY 10 44 43 45 enum cmd_arg_type{44 typedef enum { 46 45 ARG_TYPE_INVALID = 0, 47 46 ARG_TYPE_INT, 48 47 ARG_TYPE_STRING, 49 48 ARG_TYPE_VAR /**< Variable type - either symbol or string */ 50 } ;49 } cmd_arg_type_t; 51 50 52 51 /** Structure representing one argument of kconsole command line. */ 53 struct cmd_arg{52 typedef struct { 54 53 cmd_arg_type_t type; /**< Type descriptor. */ 55 54 void *buffer; /**< Buffer where to store data. */ … … 57 56 unative_t intval; /**< Integer value */ 58 57 cmd_arg_type_t vartype; /**< Resulting type of variable arg */ 59 } ;58 } cmd_arg_t; 60 59 61 60 /** Structure representing one kconsole command. */ 62 struct cmd_info{61 typedef struct { 63 62 link_t link; /**< Command list link. */ 64 63 SPINLOCK_DECLARE(lock); /**< This lock protects everything below. */ … … 69 68 cmd_arg_t *argv; /**< Argument vector. */ 70 69 void (* help)(void); /**< Function for printing detailed help. */ 71 } ;70 } cmd_info_t; 72 71 73 72 extern spinlock_t cmd_lock; -
kernel/generic/include/context.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <arch/context.h> 41 40 -
kernel/generic/include/cpu.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_CPU_H_ 37 37 38 #include <arch/cpu.h> 39 #include <proc/scheduler.h> 40 #include <synch/spinlock.h> 41 #include <synch/waitq.h> 42 #include <arch/types.h> 43 #include <typedefs.h> 44 #include <arch/context.h> 45 #include <config.h> 46 #include <adt/list.h> 47 #include <mm/tlb.h> 38 #include <proc/thread.h> 48 39 49 40 #define CPU_STACK_SIZE STACK_SIZE 50 51 /** CPU structure.52 *53 * There is one structure like this for every processor.54 */55 typedef struct {56 SPINLOCK_DECLARE(lock);57 58 tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN];59 count_t tlb_messages_count;60 61 context_t saved_context;62 63 atomic_t nrdy;64 runq_t rq[RQ_COUNT];65 volatile count_t needs_relink;66 67 SPINLOCK_DECLARE(timeoutlock);68 link_t timeout_active_head;69 70 count_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here71 so that clock() can react. This variable is72 CPU-local and can be only accessed when interrupts73 are disabled. */74 75 /**76 * Processor ID assigned by kernel.77 */78 int id;79 80 int active;81 int tlb_active;82 83 uint16_t frequency_mhz;84 uint32_t delay_loop_const;85 86 cpu_arch_t arch;87 88 thread_t *fpu_owner;89 90 /**91 * Stack used by scheduler when there is no running thread.92 */93 uint8_t *stack;94 } cpu_t;95 41 96 42 extern cpu_t *cpus; -
kernel/generic/include/ddi/ddi.h
r1ba41c5 rb3f8fb7 38 38 #include <ddi/ddi_arg.h> 39 39 #include <arch/types.h> 40 #include < typedefs.h>40 #include <proc/task.h> 41 41 42 42 /** Structure representing contiguous physical memory area. */ -
kernel/generic/include/ddi/device.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_DEVICE_H_ 37 37 38 #include <typedefs.h>39 40 38 extern devno_t device_assign_devno(void); 41 39 -
kernel/generic/include/ddi/irq.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_IRQ_H_ 37 37 38 typedef enum { 39 CMD_MEM_READ_1 = 0, 40 CMD_MEM_READ_2, 41 CMD_MEM_READ_4, 42 CMD_MEM_READ_8, 43 CMD_MEM_WRITE_1, 44 CMD_MEM_WRITE_2, 45 CMD_MEM_WRITE_4, 46 CMD_MEM_WRITE_8, 47 CMD_PORT_READ_1, 48 CMD_PORT_WRITE_1, 49 CMD_IA64_GETCHAR, 50 CMD_PPC32_GETCHAR, 51 CMD_LAST 52 } irq_cmd_type; 53 54 typedef struct { 55 irq_cmd_type cmd; 56 void *addr; 57 unsigned long long value; 58 int dstarg; 59 } irq_cmd_t; 60 61 typedef struct { 62 unsigned int cmdcount; 63 irq_cmd_t *cmds; 64 } irq_code_t; 65 66 #ifdef KERNEL 67 38 68 #include <arch/types.h> 39 #include <typedefs.h>40 69 #include <adt/list.h> 41 #include <ipc/irq.h>42 70 #include <synch/spinlock.h> 71 #include <proc/task.h> 43 72 44 73 typedef enum { … … 52 81 } irq_trigger_t; 53 82 54 typedef void (* irq_handler_t)(irq_t *irq, void *arg, ...); 83 struct irq; 84 typedef void (* irq_handler_t)(struct irq *irq, void *arg, ...); 85 86 87 88 /** IPC notification config structure. 89 * 90 * Primarily, this structure is encapsulated in the irq_t structure. 91 * It is protected by irq_t::lock. 92 */ 93 typedef struct { 94 bool notify; /**< When false, notifications are not sent. */ 95 answerbox_t *answerbox; /**< Answerbox for notifications. */ 96 unative_t method; /**< Method to be used for the notification. */ 97 irq_code_t *code; /**< Top-half pseudocode. */ 98 count_t counter; /**< Counter. */ 99 link_t link; /**< Link between IRQs that are notifying the 100 same answerbox. The list is protected by 101 the answerbox irq_lock. */ 102 } ipc_notif_cfg_t; 55 103 56 104 /** Structure representing one device IRQ. … … 60 108 * devno. 61 109 */ 62 struct irq {110 typedef struct irq { 63 111 /** Hash table link. */ 64 112 link_t link; … … 87 135 /** Notification configuration structure. */ 88 136 ipc_notif_cfg_t notif_cfg; 89 } ;137 } irq_t; 90 138 91 139 extern void irq_init(count_t inrs, count_t chains); … … 97 145 #endif 98 146 147 #endif 148 99 149 /** @} 100 150 */ -
kernel/generic/include/debug.h
r1ba41c5 rb3f8fb7 43 43 #ifndef HERE 44 44 /** Current Instruction Pointer address */ 45 # define HERE ((uintptr_t *) 0)45 # define HERE ((uintptr_t *) 0) 46 46 #endif 47 47 -
kernel/generic/include/fpu_context.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/fpu_context.h> 39 #include <typedefs.h>40 39 41 40 #if defined(CONFIG_FPU_LAZY) && !defined(ARCH_HAS_FPU) -
kernel/generic/include/func.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <atomic.h> 41 40 -
kernel/generic/include/interrupt.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/interrupt.h> 39 #include <typedefs.h>40 39 #include <arch/types.h> 41 40 #include <proc/task.h> … … 43 42 #include <arch.h> 44 43 #include <console/klog.h> 45 #include <ipc/irq.h> 44 #include <ddi/irq.h> 45 46 typedef void (* iroutine)(int n, istate_t *istate); 46 47 47 48 #define fault_if_from_uspace(istate, cmd, ...) \ … … 55 56 } 56 57 57 58 58 extern iroutine exc_register(int n, const char *name, iroutine f); 59 59 extern void exc_dispatch(int n, istate_t *t); -
kernel/generic/include/ipc/ipc.h
r1ba41c5 rb3f8fb7 159 159 #ifdef KERNEL 160 160 161 #include <synch/waitq.h> 162 #include <adt/list.h> 163 164 #define IPC_MAX_PHONES 16 165 166 typedef struct answerbox_s answerbox_t; 167 typedef struct phone_s phone_t; 161 #include <proc/task.h> 162 168 163 typedef struct { 169 164 unative_t args[IPC_CALL_LEN]; 170 165 phone_t *phone; 171 166 } ipc_data_t; 172 173 struct answerbox_s {174 SPINLOCK_DECLARE(lock);175 176 task_t *task;177 178 waitq_t wq;179 180 link_t connected_phones; /**< Phones connected to this answerbox */181 link_t calls; /**< Received calls */182 link_t dispatched_calls; /* Should be hash table in the future */183 184 link_t answers; /**< Answered calls */185 186 SPINLOCK_DECLARE(irq_lock);187 link_t irq_notifs; /**< Notifications from IRQ handlers */188 link_t irq_head; /**< IRQs with notifications to this answerbox. */189 };190 191 typedef enum {192 IPC_PHONE_FREE = 0, /**< Phone is free and can be allocated */193 IPC_PHONE_CONNECTING, /**< Phone is connecting somewhere */194 IPC_PHONE_CONNECTED, /**< Phone is connected */195 IPC_PHONE_HUNGUP, /**< Phone is hung up, waiting for answers to come */196 IPC_PHONE_SLAMMED /**< Phone was hungup from server */197 } ipc_phone_state_t;198 199 /** Structure identifying phone (in TASK structure) */200 struct phone_s {201 SPINLOCK_DECLARE(lock);202 link_t link;203 answerbox_t *callee;204 ipc_phone_state_t state;205 atomic_t active_calls;206 };207 167 208 168 typedef struct { -
kernel/generic/include/ipc/irq.h
r1ba41c5 rb3f8fb7 39 39 #define IRQ_MAX_PROG_SIZE 10 40 40 41 typedef enum {42 CMD_MEM_READ_1 = 0,43 CMD_MEM_READ_2,44 CMD_MEM_READ_4,45 CMD_MEM_READ_8,46 CMD_MEM_WRITE_1,47 CMD_MEM_WRITE_2,48 CMD_MEM_WRITE_4,49 CMD_MEM_WRITE_8,50 CMD_PORT_READ_1,51 CMD_PORT_WRITE_1,52 CMD_IA64_GETCHAR,53 CMD_PPC32_GETCHAR,54 CMD_LAST55 } irq_cmd_type;56 57 typedef struct {58 irq_cmd_type cmd;59 void *addr;60 unsigned long long value;61 int dstarg;62 } irq_cmd_t;63 64 typedef struct {65 unsigned int cmdcount;66 irq_cmd_t *cmds;67 } irq_code_t;68 69 #ifdef KERNEL70 71 41 #include <ipc/ipc.h> 72 #include < typedefs.h>42 #include <ddi/irq.h> 73 43 #include <arch/types.h> 74 44 #include <adt/list.h> 75 76 /** IPC notification config structure.77 *78 * Primarily, this structure is encapsulated in the irq_t structure.79 * It is protected by irq_t::lock.80 */81 struct ipc_notif_cfg {82 bool notify; /**< When false, notifications are not sent. */83 answerbox_t *answerbox; /**< Answerbox for notifications. */84 unative_t method; /**< Method to be used for the notification. */85 irq_code_t *code; /**< Top-half pseudocode. */86 count_t counter; /**< Counter. */87 link_t link; /**< Link between IRQs that are notifying the88 same answerbox. The list is protected by89 the answerbox irq_lock. */90 };91 45 92 46 extern int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, … … 99 53 #endif 100 54 101 #endif102 103 55 /** @} 104 56 */ -
kernel/generic/include/ipc/sysipc.h
r1ba41c5 rb3f8fb7 39 39 #include <ipc/irq.h> 40 40 #include <arch/types.h> 41 #include <typedefs.h>42 41 43 42 unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, -
kernel/generic/include/lib/elf.h
r1ba41c5 rb3f8fb7 38 38 #include <arch/elf.h> 39 39 #include <arch/types.h> 40 #include <typedefs.h>41 40 42 41 /** … … 336 335 #endif 337 336 338 extern int elf_load(elf_header_t *header, as_t * as);339 337 extern char *elf_error(int rc); 340 338 -
kernel/generic/include/lib/rd.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 41 40 /** -
kernel/generic/include/macros.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 41 40 #define is_digit(d) (((d) >= '0') && ((d) <= '9')) -
kernel/generic/include/main/main.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_MAIN_H_ 37 37 38 #include <typedefs.h>39 40 38 extern uintptr_t stack_safe; 41 39 -
kernel/generic/include/memstr.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_MEMSTR_H_ 37 37 38 #include <typedefs.h>39 38 #include <arch/types.h> 40 39 #include <arch/memstr.h> -
kernel/generic/include/mm/as.h
r1ba41c5 rb3f8fb7 48 48 #include <arch/mm/asid.h> 49 49 #include <arch/types.h> 50 #include <typedefs.h>51 50 #include <synch/spinlock.h> 52 51 #include <synch/mutex.h> … … 67 66 #define FLAG_AS_KERNEL (1 << 0) /**< Kernel address space. */ 68 67 69 /** Address space structure. 70 * 71 * as_t contains the list of as_areas of userspace accessible 72 * pages for one or more tasks. Ranges of kernel memory pages are not 73 * supposed to figure in the list as they are shared by all tasks and 74 * set up during system initialization. 75 */ 76 struct as { 77 /** Protected by asidlock. */ 78 link_t inactive_as_with_asid_link; 79 80 mutex_t lock; 81 82 /** Number of references (i.e tasks that reference this as). */ 83 count_t refcount; 84 85 /** Number of processors on wich is this address space active. */ 86 count_t cpu_refcount; 87 88 /** B+tree of address space areas. */ 89 btree_t as_area_btree; 90 91 /** Page table pointer. Constant on architectures that use global page hash table. */ 92 pte_t *page_table; 93 94 /** Address space identifier. Constant on architectures that do not support ASIDs.*/ 95 asid_t asid; 96 97 /** Architecture specific content. */ 98 as_arch_t arch; 99 }; 100 101 struct as_operations { 68 /** Address space area attributes. */ 69 #define AS_AREA_ATTR_NONE 0 70 #define AS_AREA_ATTR_PARTIAL 1 /**< Not fully initialized area. */ 71 72 #define AS_PF_FAULT 0 /**< The page fault was not resolved by as_page_fault(). */ 73 #define AS_PF_OK 1 /**< The page fault was resolved by as_page_fault(). */ 74 #define AS_PF_DEFER 2 /**< The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */ 75 76 typedef struct { 102 77 pte_t *(* page_table_create)(int flags); 103 78 void (* page_table_destroy)(pte_t *page_table); 104 79 void (* page_table_lock)(as_t *as, bool lock); 105 80 void (* page_table_unlock)(as_t *as, bool unlock); 106 }; 107 typedef struct as_operations as_operations_t; 108 109 /** Address space area attributes. */ 110 #define AS_AREA_ATTR_NONE 0 111 #define AS_AREA_ATTR_PARTIAL 1 /**< Not fully initialized area. */ 112 113 #define AS_PF_FAULT 0 /**< The page fault was not resolved by as_page_fault(). */ 114 #define AS_PF_OK 1 /**< The page fault was resolved by as_page_fault(). */ 115 #define AS_PF_DEFER 2 /**< The page fault was caused by memcpy_from_uspace() 116 or memcpy_to_uspace(). */ 81 } as_operations_t; 117 82 118 83 /** This structure contains information associated with the shared address space area. */ … … 123 88 } share_info_t; 124 89 125 /** Address space area backend structure. */ 126 typedef struct { 127 int (* page_fault)(as_area_t *area, uintptr_t addr, pf_access_t access); 128 void (* frame_free)(as_area_t *area, uintptr_t page, uintptr_t frame); 129 void (* share)(as_area_t *area); 130 } mem_backend_t; 90 /** Page fault access type. */ 91 typedef enum { 92 PF_ACCESS_READ, 93 PF_ACCESS_WRITE, 94 PF_ACCESS_EXEC 95 } pf_access_t; 96 97 struct mem_backend; 131 98 132 99 /** Backend data stored in address space area. */ 133 typedef union {100 typedef union mem_backend_data { 134 101 struct { /**< elf_backend members */ 135 102 elf_header_t *elf; … … 147 114 * In the future, it should not be difficult to support shared areas. 148 115 */ 149 struct as_area{116 typedef struct { 150 117 mutex_t lock; 151 118 as_t *as; /**< Containing address space. */ … … 157 124 share_info_t *sh_info; /**< If the address space area has been shared, this pointer will 158 125 reference the share info structure. */ 159 mem_backend_t*backend; /**< Memory backend backing this address space area. */126 struct mem_backend *backend; /**< Memory backend backing this address space area. */ 160 127 161 128 /** Data to be used by the backend. */ 162 129 mem_backend_data_t backend_data; 163 }; 130 } as_area_t; 131 132 /** Address space area backend structure. */ 133 typedef struct mem_backend { 134 int (* page_fault)(as_area_t *area, uintptr_t addr, pf_access_t access); 135 void (* frame_free)(as_area_t *area, uintptr_t page, uintptr_t frame); 136 void (* share)(as_area_t *area); 137 } mem_backend_t; 164 138 165 139 extern as_t *AS_KERNEL; … … 207 181 #endif /* !def as_deinstall_arch */ 208 182 209 /* Backend declarations . */183 /* Backend declarations and functions. */ 210 184 extern mem_backend_t anon_backend; 211 185 extern mem_backend_t elf_backend; 212 186 extern mem_backend_t phys_backend; 187 188 extern int elf_load(elf_header_t *header, as_t *as); 213 189 214 190 /* Address space area related syscalls. */ -
kernel/generic/include/mm/asid.h
r1ba41c5 rb3f8fb7 45 45 #include <arch/mm/asid.h> 46 46 #include <synch/spinlock.h> 47 #include <typedefs.h> 47 #include <adt/list.h> 48 #include <mm/as.h> 48 49 49 50 #endif -
kernel/generic/include/mm/buddy.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include < typedefs.h>39 #include <adt/list.h> 40 40 41 41 #define BUDDY_SYSTEM_INNER_BLOCK 0xff -
kernel/generic/include/mm/frame.h
r1ba41c5 rb3f8fb7 38 38 39 39 #include <arch/types.h> 40 #include <typedefs.h>41 40 #include <adt/list.h> 42 41 #include <synch/spinlock.h> -
kernel/generic/include/mm/page.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_PAGE_H_ 37 37 38 #include <arch/mm/asid.h>39 38 #include <arch/types.h> 40 #include < typedefs.h>39 #include <mm/as.h> 41 40 #include <memstr.h> 42 43 #define PAGE_CACHEABLE_SHIFT 044 #define PAGE_NOT_CACHEABLE_SHIFT PAGE_CACHEABLE_SHIFT45 #define PAGE_PRESENT_SHIFT 146 #define PAGE_NOT_PRESENT_SHIFT PAGE_PRESENT_SHIFT47 #define PAGE_USER_SHIFT 248 #define PAGE_KERNEL_SHIFT PAGE_USER_SHIFT49 #define PAGE_READ_SHIFT 350 #define PAGE_WRITE_SHIFT 451 #define PAGE_EXEC_SHIFT 552 #define PAGE_GLOBAL_SHIFT 653 54 #define PAGE_NOT_CACHEABLE (0<<PAGE_CACHEABLE_SHIFT)55 #define PAGE_CACHEABLE (1<<PAGE_CACHEABLE_SHIFT)56 57 #define PAGE_PRESENT (0<<PAGE_PRESENT_SHIFT)58 #define PAGE_NOT_PRESENT (1<<PAGE_PRESENT_SHIFT)59 60 #define PAGE_USER (1<<PAGE_USER_SHIFT)61 #define PAGE_KERNEL (0<<PAGE_USER_SHIFT)62 63 #define PAGE_READ (1<<PAGE_READ_SHIFT)64 #define PAGE_WRITE (1<<PAGE_WRITE_SHIFT)65 #define PAGE_EXEC (1<<PAGE_EXEC_SHIFT)66 67 #define PAGE_GLOBAL (1<<PAGE_GLOBAL_SHIFT)68 69 41 70 42 /** … … 73 45 #define PAGE_COLOR(va) (((va) >> PAGE_WIDTH) & ((1 << PAGE_COLOR_BITS) - 1)) 74 46 75 /** Page fault access type. */76 enum pf_access {77 PF_ACCESS_READ,78 PF_ACCESS_WRITE,79 PF_ACCESS_EXEC80 };81 typedef enum pf_access pf_access_t;82 83 47 /** Operations to manipulate page mappings. */ 84 struct page_mapping_operations{85 void (* mapping_insert)(as_t *as, uintptr_t page, uintptr_t frame, int86 flags);48 typedef struct { 49 void (* mapping_insert)(as_t *as, uintptr_t page, uintptr_t frame, 50 int flags); 87 51 void (* mapping_remove)(as_t *as, uintptr_t page); 88 52 pte_t *(* mapping_find)(as_t *as, uintptr_t page); 89 }; 90 typedef struct page_mapping_operations page_mapping_operations_t; 53 } page_mapping_operations_t; 91 54 92 55 extern page_mapping_operations_t *page_mapping_operations; … … 95 58 extern void page_table_lock(as_t *as, bool lock); 96 59 extern void page_table_unlock(as_t *as, bool unlock); 97 extern void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int98 flags);60 extern void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, 61 int flags); 99 62 extern void page_mapping_remove(as_t *as, uintptr_t page); 100 63 extern pte_t *page_mapping_find(as_t *as, uintptr_t page); -
kernel/generic/include/mm/tlb.h
r1ba41c5 rb3f8fb7 38 38 #include <arch/mm/asid.h> 39 39 #include <arch/types.h> 40 #include <typedefs.h>41 40 42 41 /** … … 47 46 48 47 /** Type of TLB shootdown message. */ 49 enum tlb_invalidate_type{48 typedef enum { 50 49 TLB_INVL_INVALID = 0, /**< Invalid type. */ 51 50 TLB_INVL_ALL, /**< Invalidate all entries in TLB. */ 52 51 TLB_INVL_ASID, /**< Invalidate all entries belonging to one address space. */ 53 52 TLB_INVL_PAGES /**< Invalidate specified page range belonging to one address space. */ 54 }; 55 typedef enum tlb_invalidate_type tlb_invalidate_type_t; 53 } tlb_invalidate_type_t; 56 54 57 55 /** TLB shootdown message. */ 58 struct tlb_shootdown_msg{56 typedef struct { 59 57 tlb_invalidate_type_t type; /**< Message type. */ 60 58 asid_t asid; /**< Address space identifier. */ 61 59 uintptr_t page; /**< Page address. */ 62 60 count_t count; /**< Number of pages to invalidate. */ 63 }; 64 typedef struct tlb_shootdown_msg tlb_shootdown_msg_t; 61 } tlb_shootdown_msg_t; 65 62 66 63 extern void tlb_init(void); -
kernel/generic/include/printf/printf_core.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_PRINTF_CORE_H_ 37 37 38 #include < typedefs.h>38 #include <arch/types.h> 39 39 #include <arch/arg.h> 40 40 -
kernel/generic/include/proc/scheduler.h
r1ba41c5 rb3f8fb7 38 38 #include <synch/spinlock.h> 39 39 #include <time/clock.h> /* HZ */ 40 #include <typedefs.h>41 40 #include <atomic.h> 42 41 #include <adt/list.h> -
kernel/generic/include/proc/task.h
r1ba41c5 rb3f8fb7 1 /* 1 /*3D 2 2 * Copyright (c) 2001-2004 Jakub Jermar 3 3 * All rights reserved. … … 36 36 #define KERN_TASK_H_ 37 37 38 #include <typedefs.h>39 38 #include <synch/spinlock.h> 40 39 #include <synch/mutex.h> 40 #include <synch/rwlock.h> 41 41 #include <synch/futex.h> 42 42 #include <adt/btree.h> 43 43 #include <adt/list.h> 44 #include <ipc/ipc.h>45 44 #include <security/cap.h> 46 45 #include <arch/proc/task.h> 46 #include <arch/proc/thread.h> 47 #include <arch/context.h> 48 #include <arch/fpu_context.h> 49 #include <arch/cpu.h> 50 #include <mm/tlb.h> 51 #include <proc/scheduler.h> 52 53 #define IPC_MAX_PHONES 16 54 #define THREAD_NAME_BUFLEN 20 55 56 struct answerbox; 57 struct task; 58 struct thread; 59 60 typedef enum { 61 IPC_PHONE_FREE = 0, /**< Phone is free and can be allocated */ 62 IPC_PHONE_CONNECTING, /**< Phone is connecting somewhere */ 63 IPC_PHONE_CONNECTED, /**< Phone is connected */ 64 IPC_PHONE_HUNGUP, /**< Phone is hung up, waiting for answers to come */ 65 IPC_PHONE_SLAMMED /**< Phone was hungup from server */ 66 } ipc_phone_state_t; 67 68 /** Structure identifying phone (in TASK structure) */ 69 typedef struct { 70 SPINLOCK_DECLARE(lock); 71 link_t link; 72 struct answerbox *callee; 73 ipc_phone_state_t state; 74 atomic_t active_calls; 75 } phone_t; 76 77 typedef struct answerbox { 78 SPINLOCK_DECLARE(lock); 79 80 struct task *task; 81 82 waitq_t wq; 83 84 link_t connected_phones; /**< Phones connected to this answerbox */ 85 link_t calls; /**< Received calls */ 86 link_t dispatched_calls; /* Should be hash table in the future */ 87 88 link_t answers; /**< Answered calls */ 89 90 SPINLOCK_DECLARE(irq_lock); 91 link_t irq_notifs; /**< Notifications from IRQ handlers */ 92 link_t irq_head; /**< IRQs with notifications to this answerbox. */ 93 } answerbox_t; 47 94 48 95 /** Task structure. */ 49 struct task {96 typedef struct task { 50 97 /** Task lock. 51 98 * … … 55 102 56 103 char *name; 57 thread_t*main_thread; /**< Pointer to the main thread. */104 struct thread *main_thread; /**< Pointer to the main thread. */ 58 105 link_t th_head; /**< List of threads contained in this task. */ 59 106 as_t *as; /**< Address space. */ … … 85 132 86 133 uint64_t cycles; /**< Accumulated accounting. */ 87 }; 134 } task_t; 135 136 /** CPU structure. 137 * 138 * There is one structure like this for every processor. 139 */ 140 typedef struct { 141 SPINLOCK_DECLARE(lock); 142 143 tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN]; 144 count_t tlb_messages_count; 145 146 context_t saved_context; 147 148 atomic_t nrdy; 149 runq_t rq[RQ_COUNT]; 150 volatile count_t needs_relink; 151 152 SPINLOCK_DECLARE(timeoutlock); 153 link_t timeout_active_head; 154 155 count_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here 156 so that clock() can react. This variable is 157 CPU-local and can be only accessed when interrupts 158 are disabled. */ 159 160 /** 161 * Processor ID assigned by kernel. 162 */ 163 int id; 164 165 int active; 166 int tlb_active; 167 168 uint16_t frequency_mhz; 169 uint32_t delay_loop_const; 170 171 cpu_arch_t arch; 172 173 struct thread *fpu_owner; 174 175 /** 176 * Stack used by scheduler when there is no running thread. 177 */ 178 uint8_t *stack; 179 } cpu_t; 180 181 typedef void (* timeout_handler_t)(void *arg); 182 183 typedef struct { 184 SPINLOCK_DECLARE(lock); 185 186 link_t link; /**< Link to the list of active timeouts on THE->cpu */ 187 188 uint64_t ticks; /**< Timeout will be activated in this amount of clock() ticks. */ 189 190 timeout_handler_t handler; /**< Function that will be called on timeout activation. */ 191 void *arg; /**< Argument to be passed to handler() function. */ 192 193 cpu_t *cpu; /**< On which processor is this timeout registered. */ 194 } timeout_t; 195 196 /** Thread states. */ 197 typedef enum { 198 Invalid, /**< It is an error, if thread is found in this state. */ 199 Running, /**< State of a thread that is currently executing on some CPU. */ 200 Sleeping, /**< Thread in this state is waiting for an event. */ 201 Ready, /**< State of threads in a run queue. */ 202 Entering, /**< Threads are in this state before they are first readied. */ 203 Exiting, /**< After a thread calls thread_exit(), it is put into Exiting state. */ 204 Undead /**< Threads that were not detached but exited are in the Undead state. */ 205 } state_t; 206 207 /** Join types. */ 208 typedef enum { 209 None, 210 TaskClnp, /**< The thread will be joined by ktaskclnp thread. */ 211 TaskGC /**< The thread will be joined by ktaskgc thread. */ 212 } thread_join_type_t; 213 214 /** Thread structure. There is one per thread. */ 215 typedef struct thread { 216 link_t rq_link; /**< Run queue link. */ 217 link_t wq_link; /**< Wait queue link. */ 218 link_t th_link; /**< Links to threads within containing task. */ 219 220 /** Lock protecting thread structure. 221 * 222 * Protects the whole thread structure except list links above. 223 */ 224 SPINLOCK_DECLARE(lock); 225 226 char name[THREAD_NAME_BUFLEN]; 227 228 void (* thread_code)(void *); /**< Function implementing the thread. */ 229 void *thread_arg; /**< Argument passed to thread_code() function. */ 230 231 /** From here, the stored context is restored when the thread is scheduled. */ 232 context_t saved_context; 233 /** From here, the stored timeout context is restored when sleep times out. */ 234 context_t sleep_timeout_context; 235 /** From here, the stored interruption context is restored when sleep is interrupted. */ 236 context_t sleep_interruption_context; 237 238 bool sleep_interruptible; /**< If true, the thread can be interrupted from sleep. */ 239 waitq_t *sleep_queue; /**< Wait queue in which this thread sleeps. */ 240 timeout_t sleep_timeout; /**< Timeout used for timeoutable sleeping. */ 241 volatile int timeout_pending; /**< Flag signalling sleep timeout in progress. */ 242 243 /** True if this thread is executing copy_from_uspace(). False otherwise. */ 244 bool in_copy_from_uspace; 245 /** True if this thread is executing copy_to_uspace(). False otherwise. */ 246 bool in_copy_to_uspace; 247 248 /** 249 * If true, the thread will not go to sleep at all and will 250 * call thread_exit() before returning to userspace. 251 */ 252 bool interrupted; 253 254 thread_join_type_t join_type; /**< Who joinins the thread. */ 255 bool detached; /**< If true, thread_join_timeout() cannot be used on this thread. */ 256 waitq_t join_wq; /**< Waitq for thread_join_timeout(). */ 257 258 fpu_context_t *saved_fpu_context; 259 int fpu_context_exists; 260 261 /* 262 * Defined only if thread doesn't run. 263 * It means that fpu context is in CPU that last time executes this thread. 264 * This disables migration. 265 */ 266 int fpu_context_engaged; 267 268 rwlock_type_t rwlock_holder_type; 269 270 void (* call_me)(void *); /**< Funtion to be called in scheduler before the thread is put asleep. */ 271 void *call_me_with; /**< Argument passed to call_me(). */ 272 273 state_t state; /**< Thread's state. */ 274 int flags; /**< Thread's flags. */ 275 276 cpu_t *cpu; /**< Thread's CPU. */ 277 task_t *task; /**< Containing task. */ 278 279 uint64_t ticks; /**< Ticks before preemption. */ 280 281 uint64_t cycles; /**< Thread accounting. */ 282 uint64_t last_cycle; /**< Last sampled cycle. */ 283 bool uncounted; /**< Thread doesn't affect accumulated accounting. */ 284 285 int priority; /**< Thread's priority. Implemented as index to CPU->rq */ 286 uint32_t tid; /**< Thread ID. */ 287 288 thread_arch_t arch; /**< Architecture-specific data. */ 289 290 uint8_t *kstack; /**< Thread's kernel stack. */ 291 } thread_t; 88 292 89 293 extern spinlock_t tasks_lock; … … 98 302 extern uint64_t task_get_accounting(task_t *t); 99 303 304 extern void cap_set(task_t *t, cap_t caps); 305 extern cap_t cap_get(task_t *t); 306 100 307 101 308 #ifndef task_create_arch -
kernel/generic/include/proc/thread.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_THREAD_H_ 37 37 38 #include <arch/proc/thread.h> 39 #include <synch/spinlock.h> 40 #include <arch/context.h> 41 #include <fpu_context.h> 42 #include <arch/types.h> 43 #include <typedefs.h> 44 #include <time/timeout.h> 38 #include <synch/waitq.h> 39 #include <proc/task.h> 40 #include <cpu.h> 45 41 #include <synch/rwlock.h> 46 #include <synch/synch.h>47 #include <config.h>48 42 #include <adt/btree.h> 49 #include <adt/list.h>50 43 #include <mm/slab.h> 44 #include <arch/cpu.h> 45 #include <mm/tlb.h> 51 46 #include <proc/uarg.h> 52 47 53 48 #define THREAD_STACK_SIZE STACK_SIZE 54 49 55 /** Thread states. */56 typedef enum {57 Invalid, /**< It is an error, if thread is found in this state. */58 Running, /**< State of a thread that is currently executing on some CPU. */59 Sleeping, /**< Thread in this state is waiting for an event. */60 Ready, /**< State of threads in a run queue. */61 Entering, /**< Threads are in this state before they are first readied. */62 Exiting, /**< After a thread calls thread_exit(), it is put into Exiting state. */63 Undead /**< Threads that were not detached but exited are in the Undead state. */64 } state_t;65 66 50 extern char *thread_states[]; 67 51 68 /** Join types. */69 typedef enum {70 None,71 TaskClnp, /**< The thread will be joined by ktaskclnp thread. */72 TaskGC /**< The thread will be joined by ktaskgc thread. */73 } thread_join_type_t;74 75 52 /* Thread flags */ 76 #define THREAD_FLAG_WIRED (1<<0) /**< Thread cannot be migrated to another CPU. */ 77 #define THREAD_FLAG_STOLEN (1<<1) /**< Thread was migrated to another CPU and has not run yet. */ 78 #define THREAD_FLAG_USPACE (1<<2) /**< Thread executes in userspace. */ 79 80 #define THREAD_NAME_BUFLEN 20 81 82 /** Thread structure. There is one per thread. */ 83 struct thread { 84 link_t rq_link; /**< Run queue link. */ 85 link_t wq_link; /**< Wait queue link. */ 86 link_t th_link; /**< Links to threads within containing task. */ 87 88 /** Lock protecting thread structure. 89 * 90 * Protects the whole thread structure except list links above. 91 */ 92 SPINLOCK_DECLARE(lock); 93 94 char name[THREAD_NAME_BUFLEN]; 95 96 void (* thread_code)(void *); /**< Function implementing the thread. */ 97 void *thread_arg; /**< Argument passed to thread_code() function. */ 98 99 /** From here, the stored context is restored when the thread is scheduled. */ 100 context_t saved_context; 101 /** From here, the stored timeout context is restored when sleep times out. */ 102 context_t sleep_timeout_context; 103 /** From here, the stored interruption context is restored when sleep is interrupted. */ 104 context_t sleep_interruption_context; 105 106 bool sleep_interruptible; /**< If true, the thread can be interrupted from sleep. */ 107 waitq_t *sleep_queue; /**< Wait queue in which this thread sleeps. */ 108 timeout_t sleep_timeout; /**< Timeout used for timeoutable sleeping. */ 109 volatile int timeout_pending; /**< Flag signalling sleep timeout in progress. */ 110 111 /** True if this thread is executing copy_from_uspace(). False otherwise. */ 112 bool in_copy_from_uspace; 113 /** True if this thread is executing copy_to_uspace(). False otherwise. */ 114 bool in_copy_to_uspace; 115 116 /** 117 * If true, the thread will not go to sleep at all and will 118 * call thread_exit() before returning to userspace. 119 */ 120 bool interrupted; 121 122 thread_join_type_t join_type; /**< Who joinins the thread. */ 123 bool detached; /**< If true, thread_join_timeout() cannot be used on this thread. */ 124 waitq_t join_wq; /**< Waitq for thread_join_timeout(). */ 125 126 fpu_context_t *saved_fpu_context; 127 int fpu_context_exists; 128 129 /* 130 * Defined only if thread doesn't run. 131 * It means that fpu context is in CPU that last time executes this thread. 132 * This disables migration. 133 */ 134 int fpu_context_engaged; 135 136 rwlock_type_t rwlock_holder_type; 137 138 void (* call_me)(void *); /**< Funtion to be called in scheduler before the thread is put asleep. */ 139 void *call_me_with; /**< Argument passed to call_me(). */ 140 141 state_t state; /**< Thread's state. */ 142 int flags; /**< Thread's flags. */ 143 144 cpu_t *cpu; /**< Thread's CPU. */ 145 task_t *task; /**< Containing task. */ 146 147 uint64_t ticks; /**< Ticks before preemption. */ 148 149 uint64_t cycles; /**< Thread accounting. */ 150 uint64_t last_cycle; /**< Last sampled cycle. */ 151 bool uncounted; /**< Thread doesn't affect accumulated accounting. */ 152 153 int priority; /**< Thread's priority. Implemented as index to CPU->rq */ 154 uint32_t tid; /**< Thread ID. */ 155 156 thread_arch_t arch; /**< Architecture-specific data. */ 157 158 uint8_t *kstack; /**< Thread's kernel stack. */ 159 }; 53 #define THREAD_FLAG_WIRED (1 << 0) /**< Thread cannot be migrated to another CPU. */ 54 #define THREAD_FLAG_STOLEN (1 << 1) /**< Thread was migrated to another CPU and has not run yet. */ 55 #define THREAD_FLAG_USPACE (1 << 2) /**< Thread executes in userspace. */ 160 56 161 57 /** Thread list lock. … … 196 92 extern void thread_update_accounting(void); 197 93 extern bool thread_exists(thread_t *t); 94 extern void thread_interrupt_sleep(thread_t *t); 198 95 199 96 /* Fpu context slab cache */ -
kernel/generic/include/security/cap.h
r1ba41c5 rb3f8fb7 50 50 #include <syscall/sysarg64.h> 51 51 #include <arch/types.h> 52 #include <typedefs.h>53 52 54 53 /** … … 82 81 typedef uint32_t cap_t; 83 82 84 extern void cap_set(task_t *t, cap_t caps);85 extern cap_t cap_get(task_t *t);86 87 83 extern unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps); 88 84 extern unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps); -
kernel/generic/include/synch/futex.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <synch/waitq.h> 41 40 #include <genarch/mm/page_ht.h> -
kernel/generic/include/synch/mutex.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <synch/semaphore.h> 41 40 #include <synch/synch.h> -
kernel/generic/include/synch/rwlock.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <synch/mutex.h> 41 40 #include <synch/synch.h> -
kernel/generic/include/synch/semaphore.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <synch/waitq.h> 41 40 #include <synch/synch.h> … … 46 45 47 46 #define semaphore_down(s) \ 48 _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)47 _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 49 48 #define semaphore_trydown(s) \ 50 _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)51 #define semaphore_down_timeout(s, usec) \52 _semaphore_down_timeout((s), (usec),SYNCH_FLAGS_NONE)49 _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) 50 #define semaphore_down_timeout(s, usec) \ 51 _semaphore_down_timeout((s), (usec), SYNCH_FLAGS_NONE) 53 52 54 53 extern void semaphore_initialize(semaphore_t *s, int val); -
kernel/generic/include/synch/spinlock.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <preemption.h> 41 40 #include <atomic.h> … … 98 97 CS_LEAVE_BARRIER(); 99 98 100 atomic_set(&sl->val, 0);99 atomic_set(&sl->val, 0); 101 100 preemption_enable(); 102 101 } … … 110 109 #define SPINLOCK_INITIALIZE(name) 111 110 112 #define spinlock_initialize(x, name)111 #define spinlock_initialize(x, name) 113 112 #define spinlock_lock(x) preemption_disable() 114 113 #define spinlock_trylock(x) (preemption_disable(), 1) -
kernel/generic/include/synch/waitq.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <typedefs.h>40 39 #include <synch/spinlock.h> 41 40 #include <synch/synch.h> … … 59 58 60 59 #define waitq_sleep(wq) \ 61 waitq_sleep_timeout((wq), SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)60 waitq_sleep_timeout((wq), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 62 61 63 62 extern void waitq_initialize(waitq_t *wq); … … 68 67 extern void waitq_wakeup(waitq_t *wq, bool all); 69 68 extern void _waitq_wakeup_unsafe(waitq_t *wq, bool all); 70 extern void waitq_interrupt_sleep(thread_t *t);71 69 72 70 #endif -
kernel/generic/include/syscall/copy.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_COPY_H_ 37 37 38 #include < typedefs.h>38 #include <arch/types.h> 39 39 40 40 /** Label within memcpy_from_uspace() that contains return -1. */ -
kernel/generic/include/syscall/syscall.h
r1ba41c5 rb3f8fb7 72 72 73 73 #include <arch/types.h> 74 #include <typedefs.h>75 74 76 75 typedef unative_t (*syshandler_t)(); -
kernel/generic/include/time/timeout.h
r1ba41c5 rb3f8fb7 37 37 38 38 #include <arch/types.h> 39 #include <cpu.h> 40 #include <synch/spinlock.h> 41 #include <adt/list.h> 39 #include <proc/task.h> 42 40 43 #define us2ticks(us) ((uint64_t)(((uint32_t) (us)/(1000000/HZ)))) 44 45 typedef void (* timeout_handler_t)(void *arg); 46 47 typedef struct { 48 SPINLOCK_DECLARE(lock); 49 50 link_t link; /**< Link to the list of active timeouts on THE->cpu */ 51 52 uint64_t ticks; /**< Timeout will be activated in this amount of clock() ticks. */ 53 54 timeout_handler_t handler; /**< Function that will be called on timeout activation. */ 55 void *arg; /**< Argument to be passed to handler() function. */ 56 57 cpu_t *cpu; /**< On which processor is this timeout registered. */ 58 } timeout_t; 41 #define us2ticks(us) ((uint64_t) (((uint32_t) (us) / (1000000 / HZ)))) 59 42 60 43 extern void timeout_init(void); -
kernel/generic/include/typedefs.h
r1ba41c5 rb3f8fb7 36 36 #define KERN_TYPEDEFS_H_ 37 37 38 #define false 039 #define true 140 41 typedef short bool;42 43 typedef unsigned long size_t;44 typedef unsigned long count_t;45 typedef unsigned long index_t;46 47 typedef unsigned long long task_id_t;48 typedef unsigned long context_id_t;49 50 typedef struct task task_t;51 typedef struct thread thread_t;52 53 typedef struct as_area as_area_t;54 typedef struct as as_t;55 56 typedef struct link link_t;57 58 typedef struct chardev chardev_t;59 60 typedef enum cmd_arg_type cmd_arg_type_t;61 typedef struct cmd_arg cmd_arg_t;62 typedef struct cmd_info cmd_info_t;63 64 typedef struct istate istate_t;65 38 typedef void (* function)(); 66 typedef void (* iroutine)(int n, istate_t *istate);67 68 typedef struct hash_table hash_table_t;69 typedef struct hash_table_operations hash_table_operations_t;70 71 typedef struct btree_node btree_node_t;72 typedef struct btree btree_t;73 74 typedef signed int inr_t;75 typedef signed int devno_t;76 typedef struct irq irq_t;77 typedef struct ipc_notif_cfg ipc_notif_cfg_t;78 39 79 40 #endif
Note:
See TracChangeset
for help on using the changeset viewer.