Changes in kernel/generic/src/syscall/syscall.c [ad211c8:3b3fcf36] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/syscall/syscall.c
rad211c8 r3b3fcf36 56 56 #include <log.h> 57 57 58 static syshandler_t syscall_table[] = { 58 /** Dispatch system call */ 59 sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3, 60 sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id) 61 { 62 /* Do userpace accounting */ 63 irq_spinlock_lock(&THREAD->lock, true); 64 thread_update_accounting(true); 65 irq_spinlock_unlock(&THREAD->lock, true); 66 67 #ifdef CONFIG_UDEBUG 68 /* 69 * An istate_t-compatible record was created on the stack by the 70 * low-level syscall handler. This is the userspace space state 71 * structure. 72 */ 73 THREAD->udebug.uspace_state = istate_get(THREAD); 74 75 /* 76 * Early check for undebugged tasks. We do not lock anything as this 77 * test need not be precise in either direction. 78 */ 79 if (THREAD->udebug.active) 80 udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false); 81 #endif 82 83 sysarg_t rc; 84 if (id < SYSCALL_END) { 85 rc = syscall_table[id](a1, a2, a3, a4, a5, a6); 86 } else { 87 log(LF_OTHER, LVL_ERROR, 88 "Task %" PRIu64 ": Unknown syscall %#" PRIxn, TASK->taskid, id); 89 task_kill_self(true); 90 } 91 92 if (THREAD->interrupted) 93 thread_exit(); 94 95 #ifdef CONFIG_UDEBUG 96 if (THREAD->udebug.active) { 97 udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true); 98 99 /* 100 * Stopping point needed for tasks that only invoke 101 * non-blocking system calls. Not needed if the task 102 * is not being debugged (it cannot block here). 103 */ 104 udebug_stoppable_begin(); 105 udebug_stoppable_end(); 106 } 107 108 /* Clear userspace state pointer */ 109 THREAD->udebug.uspace_state = NULL; 110 #endif 111 112 /* Do kernel accounting */ 113 irq_spinlock_lock(&THREAD->lock, true); 114 thread_update_accounting(false); 115 irq_spinlock_unlock(&THREAD->lock, true); 116 117 return rc; 118 } 119 120 syshandler_t syscall_table[SYSCALL_END] = { 59 121 /* System management syscalls. */ 60 122 [SYS_KIO] = (syshandler_t) sys_kio, … … 136 198 }; 137 199 138 /** Dispatch system call */139 sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,140 sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)141 {142 /* Do userpace accounting */143 irq_spinlock_lock(&THREAD->lock, true);144 thread_update_accounting(true);145 irq_spinlock_unlock(&THREAD->lock, true);146 147 #ifdef CONFIG_UDEBUG148 /*149 * An istate_t-compatible record was created on the stack by the150 * low-level syscall handler. This is the userspace space state151 * structure.152 */153 THREAD->udebug.uspace_state = istate_get(THREAD);154 155 /*156 * Early check for undebugged tasks. We do not lock anything as this157 * test need not be precise in either direction.158 */159 if (THREAD->udebug.active)160 udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);161 #endif162 163 sysarg_t rc;164 if (id < sizeof_array(syscall_table)) {165 rc = syscall_table[id](a1, a2, a3, a4, a5, a6);166 } else {167 log(LF_OTHER, LVL_ERROR,168 "Task %" PRIu64 ": Unknown syscall %#" PRIxn, TASK->taskid, id);169 task_kill_self(true);170 }171 172 if (THREAD->interrupted)173 thread_exit();174 175 #ifdef CONFIG_UDEBUG176 if (THREAD->udebug.active) {177 udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);178 179 /*180 * Stopping point needed for tasks that only invoke181 * non-blocking system calls. Not needed if the task182 * is not being debugged (it cannot block here).183 */184 udebug_stoppable_begin();185 udebug_stoppable_end();186 }187 188 /* Clear userspace state pointer */189 THREAD->udebug.uspace_state = NULL;190 #endif191 192 /* Do kernel accounting */193 irq_spinlock_lock(&THREAD->lock, true);194 thread_update_accounting(false);195 irq_spinlock_unlock(&THREAD->lock, true);196 197 return rc;198 }199 200 200 /** @} 201 201 */
Note:
See TracChangeset
for help on using the changeset viewer.