Changeset 566 for trunk/kernel/syscalls/sys_write.c
- Timestamp:
- Oct 4, 2018, 11:50:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_write.c
r492 r566 1 1 /* 2 * sys_write.c - write bytes to a file2 * sys_write.c - Kernel function implementing the "write" system call. 3 3 * 4 4 * Author Alain Greiner (2016,2017,2018) … … 29 29 #include <errno.h> 30 30 #include <vfs.h> 31 #include <vmm.h> 31 32 #include <thread.h> 32 33 #include <printk.h> 33 34 #include <process.h> 34 35 35 /* TODO: concurrent user page(s) unmap need to be handled [AG] */36 36 37 37 extern uint32_t enter_sys_write; … … 64 64 process_t * process = this->process; 65 65 66 #if (DEBUG_SYS_WRITE || CONFIG_INSTRUMENTATION_SYSCALLS) 67 uint64_t tm_start = hal_get_cycles(); 68 #endif 69 66 70 #if DEBUG_SYS_WRITE 67 uint32_t tm_start;68 uint32_t tm_end;69 71 tm_start = hal_get_cycles(); 70 72 if( DEBUG_SYS_WRITE < tm_start ) … … 123 125 124 126 // get file type 125 vfs_inode_type_t type = hal_remote_l w( XPTR( file_cxy , &file_ptr->type ) );127 vfs_inode_type_t type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) ); 126 128 127 129 // enable IRQs … … 132 134 { 133 135 // check file writable 134 uint32_t attr = hal_remote_l w( XPTR( file_cxy , &file_ptr->attr ) );136 uint32_t attr = hal_remote_l32( XPTR( file_cxy , &file_ptr->attr ) ); 135 137 if( (attr & FD_ATTR_WRITE_ENABLE) == 0 ) 136 138 { … … 192 194 hal_fence(); 193 195 196 #if (DEBUG_SYS_WRITE || CONFIG_INSTRUMENTATION_SYSCALLS) 197 uint64_t tm_end = hal_get_cycles(); 198 #endif 199 194 200 #if DEBUG_SYS_WRITE 195 tm_end = hal_get_cycles();196 201 if( DEBUG_SYS_WRITE < tm_end ) 197 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d / cost %d\n", 198 __FUNCTION__, this->trdid, process->pid, (uint32_t)tm_start, (uint32_t)(tm_end - tm_start) ); 199 #endif 200 202 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n", 203 __FUNCTION__, this->trdid, process->pid, (uint32_t)tm_end ); 204 #endif 205 206 #if CONFIG_INSTRUMENTATION_SYSCALLS 207 hal_atomic_add( &syscalls_cumul_cost[SYS_WRITE] , tm_end - tm_start ); 208 hal_atomic_add( &syscalls_occurences[SYS_WRITE] , 1 ); 209 #endif 210 201 211 #if (DEBUG_SYS_WRITE & 1) 202 212 exit_sys_write = (uint32_t)tm_end;
Note: See TracChangeset
for help on using the changeset viewer.