Changeset 665 for trunk/kernel/mm
- Timestamp:
- Oct 10, 2020, 5:21:36 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r657 r665 2108 2108 remote_queuelock_acquire( loc_lock_xp ); 2109 2109 2110 // try to get vseg from local V MM2110 // try to get vseg from local VSL 2111 2111 loc_vseg = vmm_vseg_from_vaddr( XPTR( local_cxy, &process->vmm ) , vaddr ); 2112 2112 … … 2120 2120 process_t * ref_ptr = GET_PTR( ref_xp ); 2121 2121 2122 // build extended pointer on reference VSL lock 2123 ref_lock_xp = XPTR( ref_cxy , &ref_ptr->vmm.vsl_lock ); 2124 2125 // get reference VSL lock 2126 remote_queuelock_acquire( ref_lock_xp ); 2127 2128 // try to get vseg from reference VMM 2129 ref_vseg = vmm_vseg_from_vaddr( XPTR( ref_cxy , &ref_ptr->vmm ) , vaddr ); 2130 2131 if( ref_vseg == NULL ) // vseg not found => return error 2122 if( ref_cxy == local_cxy ) // local is ref => return error 2132 2123 { 2133 2124 printk("\n[ERROR] in %s : vaddr %x in process %x out of segment\n", 2134 2125 __FUNCTION__, vaddr, process->pid ); 2135 2126 2136 // release reference VSL lock2137 remote_queuelock_release( ref_lock_xp );2127 // release local VSL lock 2128 remote_queuelock_release( loc_lock_xp ); 2138 2129 2139 2130 return -1; 2140 2131 } 2141 else // vseg found => try to update local VSL2132 else // ref != local => access ref VSL 2142 2133 { 2143 // allocate a local vseg descriptor 2144 loc_vseg = vseg_alloc(); 2145 2146 if( loc_vseg == NULL ) // no memory => return error 2134 // build extended pointer on reference VSL lock 2135 ref_lock_xp = XPTR( ref_cxy , &ref_ptr->vmm.vsl_lock ); 2136 2137 // get reference VSL lock 2138 remote_queuelock_acquire( ref_lock_xp ); 2139 2140 // try to get vseg from reference VSL 2141 ref_vseg = vmm_vseg_from_vaddr( XPTR( ref_cxy , &ref_ptr->vmm ) , vaddr ); 2142 2143 if( ref_vseg == NULL ) // vseg not found => return error 2147 2144 { 2148 printk("\n[ERROR] in %s : vaddr %x in process %x / no memory for local vseg\n", 2145 // release both VSL locks 2146 remote_queuelock_release( loc_lock_xp ); 2147 remote_queuelock_release( ref_lock_xp ); 2148 2149 printk("\n[ERROR] in %s : vaddr %x in process %x out of segment\n", 2149 2150 __FUNCTION__, vaddr, process->pid ); 2150 2151 // release reference VSL & local VSL locks2152 remote_queuelock_release( ref_lock_xp );2153 remote_queuelock_release( loc_lock_xp );2154 2151 2155 2152 return -1; 2156 2153 } 2157 else // update local VSL and return success2154 else // vseg found => try to update local VSL 2158 2155 { 2159 // initialize local vseg 2160 vseg_init_from_ref( loc_vseg , XPTR( ref_cxy , ref_vseg ) ); 2161 2162 // register local vseg in local VSL 2163 vmm_attach_vseg_to_vsl( &process->vmm , loc_vseg ); 2164 2165 // release reference VSL & local VSL locks 2166 remote_queuelock_release( ref_lock_xp ); 2167 remote_queuelock_release( loc_lock_xp ); 2168 2169 *found_vseg = loc_vseg; 2170 return 0; 2156 // allocate a local vseg descriptor 2157 loc_vseg = vseg_alloc(); 2158 2159 if( loc_vseg == NULL ) // no memory => return error 2160 { 2161 printk("\n[ERROR] in %s : vaddr %x in process %x / no memory\n", 2162 __FUNCTION__, vaddr, process->pid ); 2163 2164 // release both VSL locks 2165 remote_queuelock_release( ref_lock_xp ); 2166 remote_queuelock_release( loc_lock_xp ); 2167 2168 return -1; 2169 } 2170 else // update local VSL and return success 2171 { 2172 // initialize local vseg 2173 vseg_init_from_ref( loc_vseg , XPTR( ref_cxy , ref_vseg ) ); 2174 2175 // register local vseg in local VSL 2176 vmm_attach_vseg_to_vsl( &process->vmm , loc_vseg ); 2177 2178 // release both VSL locks 2179 remote_queuelock_release( ref_lock_xp ); 2180 remote_queuelock_release( loc_lock_xp ); 2181 2182 *found_vseg = loc_vseg; 2183 return 0; 2184 } 2171 2185 } 2172 2186 } … … 2174 2188 else // vseg found in local VSL => return success 2175 2189 { 2176 // release local VSL lock 2190 // release local VSL lock 2177 2191 remote_queuelock_release( loc_lock_xp ); 2178 2192
Note: See TracChangeset
for help on using the changeset viewer.