Changeset 408 for trunk/kernel/kern/do_syscall.c
- Timestamp:
- Dec 5, 2017, 4:20:07 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/do_syscall.c
r407 r408 29 29 #include <printk.h> 30 30 #include <syscalls.h> 31 #include <shared_syscalls.h> 31 32 32 /////////////////////////////////////////////////////////////////////////////////////// //////33 /////////////////////////////////////////////////////////////////////////////////////// 33 34 // This ƒonction should never be called... 34 /////////////////////////////////////////////////////////////////////////////////////// //////35 /////////////////////////////////////////////////////////////////////////////////////// 35 36 static int sys_undefined() 36 37 { … … 39 40 } 40 41 41 /////////////////////////////////////////////////////////////////////////////////////// //////42 /////////////////////////////////////////////////////////////////////////////////////// 42 43 // This array of pointers define the kernel functions implementing the syscalls. 43 44 // It must be kept consistent with the enum in "shared_syscalls.h" file. 44 /////////////////////////////////////////////////////////////////////////////////////// //////45 /////////////////////////////////////////////////////////////////////////////////////// 45 46 46 47 typedef int (*sys_func_t) (); … … 59 60 sys_mutex, // 9 60 61 61 sys_ undefined,// 1062 sys_exit, // 10 62 63 sys_munmap, // 11 63 64 sys_open, // 12 … … 101 102 }; 102 103 104 //////////////////////////////////// 105 char * syscall_str( uint32_t index ) 106 { 107 if ( index == SYS_THREAD_EXIT ) return "THREAD_EXIT"; // 0 108 else if( index == SYS_THREAD_YIELD ) return "THREAD_YIELD"; // 1 109 else if( index == SYS_THREAD_CREATE ) return "THREAD_CREATE"; // 2 110 else if( index == SYS_THREAD_JOIN ) return "THREAD_JOIN"; // 3 111 else if( index == SYS_THREAD_DETACH ) return "THREAD_DETACH"; // 4 112 else if( index == SYS_SEM ) return "SEM"; // 6 113 else if( index == SYS_CONDVAR ) return "CONDVAR"; // 7 114 else if( index == SYS_BARRIER ) return "BARRIER"; // 8 115 else if( index == SYS_MUTEX ) return "MUTEX"; // 9 116 117 else if( index == SYS_EXIT ) return "EXIT"; // 10 118 else if( index == SYS_MUNMAP ) return "MUNMAP"; // 11 119 else if( index == SYS_OPEN ) return "OPEN"; // 12 120 else if( index == SYS_MMAP ) return "MMAP"; // 13 121 else if( index == SYS_READ ) return "READ"; // 14 122 else if( index == SYS_WRITE ) return "WRITE"; // 15 123 else if( index == SYS_LSEEK ) return "LSEEK"; // 16 124 else if( index == SYS_CLOSE ) return "CLOSE"; // 17 125 else if( index == SYS_UNLINK ) return "UNLINK"; // 18 126 else if( index == SYS_PIPE ) return "PIPE"; // 19 127 128 else if( index == SYS_CHDIR ) return "CHDIR"; // 20 129 else if( index == SYS_MKDIR ) return "MKDIR"; // 21 130 else if( index == SYS_MKFIFO ) return "MKFIFO"; // 22 131 else if( index == SYS_OPENDIR ) return "OPENDIR"; // 23 132 else if( index == SYS_READDIR ) return "READDIR"; // 24 133 else if( index == SYS_CLOSEDIR ) return "CLOSEDIR"; // 25 134 else if( index == SYS_GETCWD ) return "GETCWD"; // 26 135 else if( index == SYS_ALARM ) return "ALARM"; // 28 136 else if( index == SYS_RMDIR ) return "RMDIR"; // 29 137 138 else if( index == SYS_UTLS ) return "UTLS"; // 30 139 else if( index == SYS_CHMOD ) return "CHMOD"; // 31 140 else if( index == SYS_SIGNAL ) return "SIGNAL"; // 32 141 else if( index == SYS_TIMEOFDAY ) return "TIMEOFDAY"; // 33 142 else if( index == SYS_KILL ) return "KILL"; // 34 143 else if( index == SYS_GETPID ) return "GETPID"; // 35 144 else if( index == SYS_FORK ) return "FORK"; // 36 145 else if( index == SYS_EXEC ) return "EXEC"; // 37 146 else if( index == SYS_STAT ) return "STAT"; // 38 147 else if( index == SYS_TRACE ) return "TRACE"; // 39 148 149 else if( index == SYS_GET_CONFIG ) return "GET_CONFIG"; // 40 150 else if( index == SYS_GET_CORE ) return "GET_CORE"; // 41 151 else if( index == SYS_GET_CYCLE ) return "GET_CYCLE"; // 42 152 else if( index == SYS_GET_SCHED ) return "GET_SCHED"; // 43 153 else if( index == SYS_PANIC ) return "PANIC"; // 44 154 else if( index == SYS_SLEEP ) return "SLEEP"; // 45 155 else if( index == SYS_WAKEUP ) return "WAKEUP"; // 46 156 157 else return "undefined"; 158 } 159 160 103 161 ////////////////////////////////// 104 162 reg_t do_syscall( thread_t * this, … … 109 167 reg_t service_num ) 110 168 { 111 int 169 int error = 0; 112 170 113 171 // update user time 114 172 thread_user_time_update( this ); 115 173 116 // enable interrupts117 hal_enable_irq( NULL );118 119 174 // check syscall index 120 175 if( service_num >= SYSCALLS_NR ) … … 128 183 } 129 184 130 #if( CONFIG_SYSCALL_DEBUG & 0x1)131 printk("\n[DBG] %s : pid = %x / trdid = %x / service #%d\n"132 " arg0 = %x / arg1 = %x / arg2 = %x / arg3 = %x\n",133 __FUNCTION__ , this->process->pid , this->trdid , service_num , arg0 , arg1 , arg2 , arg3 );134 #endif135 136 185 // reset errno 137 186 this->errno = 0; … … 140 189 error = syscall_tbl[service_num] ( arg0 , arg1 , arg2 , arg3 ); 141 190 142 // disable interrupt143 hal_disable_irq( NULL );144 145 191 // update kernel time 146 192 thread_kernel_time_update( this );
Note: See TracChangeset
for help on using the changeset viewer.