Changeset 04803bf in mainline for kernel/generic/src/syscall/syscall.c
- Timestamp:
- 2011-03-21T22:00:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e
- Parents:
- b50b5af2 (diff), 7308e84 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/syscall/syscall.c
rb50b5af2 r04803bf 45 45 #include <debug.h> 46 46 #include <ddi/device.h> 47 #include <interrupt.h> 47 48 #include <ipc/sysipc.h> 48 49 #include <synch/futex.h> … … 56 57 57 58 /** Print a hex integer into klog */ 58 static unative_t sys_debug_putint(unative_t i)59 static sysarg_t sys_debug_putint(sysarg_t i) 59 60 { 60 61 printf("[task:0x%x]", i); … … 63 64 64 65 /** Dispatch system call */ 65 unative_t syscall_handler(unative_t a1, unative_t a2, unative_t a3,66 unative_t a4, unative_t a5, unative_t a6, unative_t id)66 sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3, 67 sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id) 67 68 { 68 unative_t rc; 69 69 /* Do userpace accounting */ 70 irq_spinlock_lock(&THREAD->lock, true); 71 thread_update_accounting(true); 72 irq_spinlock_unlock(&THREAD->lock, true); 73 70 74 #ifdef CONFIG_UDEBUG 71 bool debug; 75 /* 76 * An istate_t-compatible record was created on the stack by the 77 * low-level syscall handler. This is the userspace space state 78 * structure. 79 */ 80 THREAD->udebug.uspace_state = istate_get(THREAD); 72 81 73 82 /* 74 83 * Early check for undebugged tasks. We do not lock anything as this 75 * test need not be precise in either way.84 * test need not be precise in either direction. 76 85 */ 77 debug = THREAD->udebug.active; 78 79 if (debug) { 86 if (THREAD->udebug.active) 80 87 udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false); 81 }82 88 #endif 83 89 90 sysarg_t rc; 84 91 if (id < SYSCALL_END) { 85 92 rc = syscall_table[id](a1, a2, a3, a4, a5, a6); 86 93 } else { 87 94 printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id); 88 task_kill(TASK->taskid); 89 thread_exit(); 95 task_kill_self(true); 90 96 } 91 97 … … 94 100 95 101 #ifdef CONFIG_UDEBUG 96 if ( debug) {102 if (THREAD->udebug.active) { 97 103 udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true); 98 104 99 105 /* 100 106 * Stopping point needed for tasks that only invoke … … 105 111 udebug_stoppable_end(); 106 112 } 113 114 /* Clear userspace state pointer */ 115 THREAD->udebug.uspace_state = NULL; 107 116 #endif 117 118 /* Do kernel accounting */ 119 irq_spinlock_lock(&THREAD->lock, true); 120 thread_update_accounting(false); 121 irq_spinlock_unlock(&THREAD->lock, true); 108 122 109 123 return rc; … … 118 132 (syshandler_t) sys_thread_exit, 119 133 (syshandler_t) sys_thread_get_id, 134 (syshandler_t) sys_thread_usleep, 120 135 121 136 (syshandler_t) sys_task_get_id, 122 137 (syshandler_t) sys_task_set_name, 138 (syshandler_t) sys_task_kill, 139 (syshandler_t) sys_task_exit, 123 140 (syshandler_t) sys_program_spawn_loader, 124 141 125 142 /* Synchronization related syscalls. */ 126 (syshandler_t) sys_futex_sleep _timeout,143 (syshandler_t) sys_futex_sleep, 127 144 (syshandler_t) sys_futex_wakeup, 128 145 (syshandler_t) sys_smc_coherence, … … 133 150 (syshandler_t) sys_as_area_change_flags, 134 151 (syshandler_t) sys_as_area_destroy, 152 (syshandler_t) sys_as_get_unmapped_area, 135 153 136 154 /* IPC related syscalls. */ … … 146 164 (syshandler_t) sys_ipc_poke, 147 165 (syshandler_t) sys_ipc_hangup, 148 (syshandler_t) sys_ipc_register_irq, 149 (syshandler_t) sys_ipc_unregister_irq, 150 166 (syshandler_t) sys_ipc_connect_kbox, 167 151 168 /* Event notification syscalls. */ 152 169 (syshandler_t) sys_event_subscribe, … … 160 177 (syshandler_t) sys_physmem_map, 161 178 (syshandler_t) sys_iospace_enable, 162 (syshandler_t) sys_preempt_control, 179 (syshandler_t) sys_register_irq, 180 (syshandler_t) sys_unregister_irq, 163 181 164 182 /* Sysinfo syscalls */ 165 (syshandler_t) sys_sysinfo_valid, 166 (syshandler_t) sys_sysinfo_value, 183 (syshandler_t) sys_sysinfo_get_tag, 184 (syshandler_t) sys_sysinfo_get_value, 185 (syshandler_t) sys_sysinfo_get_data_size, 186 (syshandler_t) sys_sysinfo_get_data, 167 187 168 188 /* Debug calls */ 169 189 (syshandler_t) sys_debug_putint, 170 190 (syshandler_t) sys_debug_enable_console, 171 (syshandler_t) sys_debug_disable_console, 172 173 (syshandler_t) sys_ipc_connect_kbox 191 (syshandler_t) sys_debug_disable_console 174 192 }; 175 193
Note:
See TracChangeset
for help on using the changeset viewer.