Changeset 623 for trunk/kernel/syscalls/sys_munmap.c
- Timestamp:
- Mar 6, 2019, 4:37:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_munmap.c
r506 r623 25 25 #include <hal_kernel_types.h> 26 26 #include <hal_uspace.h> 27 #include <hal_irqmask.h> 27 28 #include <shared_syscalls.h> 28 29 #include <errno.h> … … 41 42 { 42 43 error_t error; 44 vseg_t * vseg; 45 reg_t save_sr; // required to enable IRQs 43 46 44 47 thread_t * this = CURRENT_THREAD; 45 48 process_t * process = this->process; 46 49 50 #if (DEBUG_SYS_MUNMAP || CONFIG_INSTRUMENTATION_SYSCALLS) 51 uint64_t tm_start = hal_get_cycles(); 52 #endif 53 47 54 #if DEBUG_SYS_MUNMAP 48 uint64_t tm_start;49 uint64_t tm_end;50 tm_start = hal_get_cycles();51 55 if( DEBUG_SYS_MUNMAP < tm_start ) 52 printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n" 56 printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n", 53 57 __FUNCTION__ , this, process->pid, (uint32_t)tm_start ); 54 58 #endif 59 60 // check user buffer is mapped 61 error = vmm_get_vseg( process , (intptr_t)vaddr, &vseg ); 62 63 if( error ) 64 { 65 66 #if DEBUG_SYSCALLS_ERROR 67 printk("\n[ERROR] in %s : thread[%x,%x] / user buffer unmapped %x\n", 68 __FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr ); 69 vmm_display( process , false ); 70 #endif 71 this->errno = EINVAL; 72 return -1; 73 } 74 75 // enable IRQs 76 hal_enable_irq( &save_sr ); 55 77 56 78 // call relevant kernel function … … 67 89 } 68 90 91 // restore IRQs 92 hal_restore_irq( save_sr ); 93 94 #if (DEBUG_SYS_MUNMAP || CONFIG_INSTRUMENTATION_SYSCALLS) 95 uint64_t tm_end = hal_get_cycles(); 96 #endif 97 98 #if CONFIG_INSTRUMENTATION_SYSCALLS 99 hal_atomic_add( &syscalls_cumul_cost[SYS_MUNMAP] , tm_end - tm_start ); 100 hal_atomic_add( &syscalls_occurences[SYS_MUNMAP] , 1 ); 101 #endif 102 69 103 #if DEBUG_SYS_MUNMAP 70 tm_end = hal_get_cycles();71 104 if( DEBUG_SYS_MUNMAP < tm_start ) 72 printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n" 105 printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n", 73 106 __FUNCTION__ , this, process->pid, (uint32_t)tm_end ); 74 107 #endif
Note: See TracChangeset
for help on using the changeset viewer.