Changeset 640 for trunk/kernel/syscalls
- Timestamp:
- Oct 1, 2019, 1:19:00 PM (5 years ago)
- Location:
- trunk/kernel/syscalls
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_display.c
r637 r640 134 134 case DISPLAY_VMM: 135 135 { 136 cxy_t cxy = (cxy_t)arg0; 137 pid_t pid = (pid_t)arg1; 136 cxy_t cxy = (cxy_t)arg0; 137 pid_t pid = (pid_t)arg1; 138 bool_t mapping = (arg2 != 0); 138 139 139 140 // check cxy argument … … 163 164 164 165 // call kernel function 165 hal_vmm_display( process_xp , true);166 hal_vmm_display( process_xp , mapping ); 166 167 167 168 break; … … 197 198 } 198 199 199 if( cxy == local_cxy ) 200 { 201 sched_display( lid ); 202 } 203 else 204 { 205 sched_remote_display( cxy , lid ); 206 } 200 // call kernel function 201 sched_remote_display( cxy , lid ); 207 202 208 203 break; -
trunk/kernel/syscalls/sys_munmap.c
r635 r640 72 72 } 73 73 74 // compute unmapped region min an max 75 intptr_t addr_min = (intptr_t)vaddr; 76 intptr_t addr_max = addr_min + size; 77 78 79 // get vseg min & max addresses 80 intptr_t vseg_min = vseg->min; 81 intptr_t vseg_max = vseg->max; 82 74 83 // enable IRQs 75 84 hal_enable_irq( &save_sr ); 76 85 77 // call relevant kernel function 78 error = vmm_resize_vseg( process , (intptr_t)vaddr , (intptr_t)size ); 79 80 if ( error ) 86 // action depend on both vseg and region bases & sizes 87 if( (vseg_min > addr_min) || (vseg_max < addr_max) ) // region not included in vseg 81 88 { 82 89 83 90 #if DEBUG_SYSCALLS_ERROR 84 printk("\n[ERROR] in %s : cannot remove mapping\n", __FUNCTION__ ); 91 printk("\n[ERROR] in %s : region[%x->%x] / vseg[%x->%x] => non included in vseg\n", 92 __FUNCTION__, process->pid, this->trdid, addr_min, addr_max, vseg_min, vseg_max ); 85 93 #endif 86 94 this->errno = EINVAL; 87 95 return -1; 96 } 97 else if( (vseg_min == addr_min) && (vseg_min == vseg_max) ) 98 { 99 100 #if( DEBUG_SYS_MUNMAP & 1 ) 101 if( DEBUG_SYS_MUNMAP < cycle ) 102 printk("\n[%s] unmapped region[%x->%x[ / vseg[%x->%x[ => vseg deleted\n", 103 __FUNCTION__, addr_min, addr_max, vseg_min, vseg_max ); 104 #endif 105 // delete existing vseg 106 vmm_global_delete_vseg( process, 107 vseg_min ); 108 } 109 else if( (vseg_min == addr_min) || (vseg_min == vseg_max) ) 110 { 111 112 #if( DEBUG_SYS_MUNMAP & 1 ) 113 if( DEBUG_SYS_MUNMAP < cycle ) 114 printk("\n[%s] unmapped region[%x->%x[ / vseg[%x->%x[ => vseg resized\n", 115 __FUNCTION__, addr_min, addr_max, vseg_min, vseg_max ); 116 #endif 117 // resize existing vseg 118 vmm_global_resize_vseg( process, 119 vseg_min, 120 addr_min, 121 addr_max - addr_min ); 122 } 123 else // vseg_min < addr_min) && (addr_max < vseg_max) 124 { 125 126 #if( DEBUG_SYS_MUNMAP & 1 ) 127 if( DEBUG_SYS_MUNMAP < cycle ) 128 printk("\n[%s] unmapped region[%x->%x[ / vseg[%x->%x[ => vseg resized & new vseg created\n", 129 __FUNCTION__, addr_min, addr_max, vseg_min, vseg_max ); 130 #endif 131 // resize existing vseg 132 vmm_global_resize_vseg( process, 133 vseg_min, 134 vseg_min, 135 addr_min - vseg_min ); 136 137 // create new vseg 138 vmm_create_vseg( process, 139 vseg->type, 140 addr_max, 141 vseg_max - addr_max, 142 vseg->file_offset, 143 vseg->file_size, 144 vseg->mapper_xp, 145 vseg->cxy ); 88 146 } 89 147 -
trunk/kernel/syscalls/syscalls.h
r637 r640 187 187 /****************************************************************************************** 188 188 * [11] This function remove an existing mapping defined by the <addr> and <size> 189 * arguments in user space. 190 ****************************************************************************************** 189 * arguments in user space. This can modify the number of vsegs: 190 * (a) if the region is not entirely mapped in one existing vseg, it's an error. 191 * (b) if the region has same base and size as an existing vseg, the vseg is removed. 192 * (c) if the removed region cut the exiting vseg in two parts, it is resized. 193 * (d) if the removed region cut the vseg in three parts, it is modified, and a new 194 * vseg is created with same type. 195 * All existing VSL copies are updated. 196 ****************************************************************************************** 191 197 * @ addr : base address in user space. 192 * #size : number of bytes.198 * @ size : number of bytes. 193 199 * @ return 0 if success / return -1 if failure. 194 200 *****************************************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.