Changeset 629 for trunk/kernel/libk
- Timestamp:
- May 17, 2019, 9:27:04 AM (6 years ago)
- Location:
- trunk/kernel/libk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/queuelock.c
r623 r629 2 2 * queuelock.c - local kernel lock with waiting queue implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 47 47 #if DEBUG_QUEUELOCK_TYPE 48 48 thread_t * this = CURRENT_THREAD; 49 if( DEBUG_QUEUELOCK_TYPE == type ) 49 if( (type == DEBUG_QUEUELOCK_TYPE) && 50 (lock == DEBUG_QUEUELOCK_PTR ) && 51 (local_cxy == DEBUG_QUEUELOCK_CXY ) ) 50 52 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n", 51 53 __FUNCTION__, this->process->pid, this->trdid, … … 75 77 76 78 #if DEBUG_QUEUELOCK_TYPE 77 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 79 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 80 (lock == DEBUG_QUEUELOCK_PTR ) && 81 (local_cxy == DEBUG_QUEUELOCK_CXY ) ) 78 82 printk("\n[%s ] thread[%x,%x] BLOCK on q_lock %s [%x,%x]\n", 79 83 __FUNCTION__, this->process->pid, this->trdid, … … 100 104 101 105 #if DEBUG_QUEUELOCK_TYPE 102 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 106 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 107 (lock == DEBUG_QUEUELOCK_PTR ) && 108 (local_cxy == DEBUG_QUEUELOCK_CXY ) ) 103 109 printk("\n[%s] thread[%x,%x] ACQUIRE q_lock %s [%x,%x]\n", 104 110 __FUNCTION__, this->process->pid, this->trdid, … … 126 132 uint32_t lock_type = lock->lock.type; 127 133 thread_t * this = CURRENT_THREAD; 128 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 134 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 135 (lock == DEBUG_QUEUELOCK_PTR ) && 136 (local_cxy == DEBUG_QUEUELOCK_CXY ) ) 129 137 printk("\n[%s] thread[%x,%x] RELEASE q_lock %s [%x,%x]\n", 130 138 __FUNCTION__, this->process->pid, this->trdid, … … 142 150 143 151 #if DEBUG_QUEUELOCK_TYPE 144 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 152 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 153 (lock == DEBUG_QUEUELOCK_PTR ) && 154 (local_cxy == DEBUG_QUEUELOCK_CXY ) ) 145 155 printk("\n[%s] thread[%x,%x] UNBLOCK thread [%x,%x] / q_lock %s [%x,%x]\n", 146 156 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, -
trunk/kernel/libk/remote_barrier.c
r623 r629 467 467 if( cycle > DEBUG_BARRIER_WAIT ) 468 468 printk("\n[%s] thread[%x,%x] exit / barrier (%x,%x) / cycle %d\n", 469 __FUNCTION__, this-> trdid, this->process->pid, barrier_cxy, barrier_ptr, cycle );469 __FUNCTION__, this->process->pid, this->trdid, barrier_cxy, barrier_ptr, cycle ); 470 470 #endif 471 471 -
trunk/kernel/libk/remote_queuelock.c
r623 r629 2 2 * remote_queuelock.c - remote kernel lock with waiting queue implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 56 56 #if DEBUG_QUEUELOCK_TYPE 57 57 thread_t * this = CURRENT_THREAD; 58 if( DEBUG_QUEUELOCK_TYPE == type ) 58 if( (type == DEBUG_QUEUELOCK_TYPE) && 59 (lock_ptr == DEBUG_QUEUELOCK_PTR ) && 60 (lock_cxy == DEBUG_QUEUELOCK_CXY ) ) 59 61 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n", 60 62 __FUNCTION__, this->process->pid, this->trdid, … … 91 93 92 94 #if DEBUG_QUEUELOCK_TYPE 93 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 95 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 96 (lock_ptr == DEBUG_QUEUELOCK_PTR ) && 97 (lock_cxy == DEBUG_QUEUELOCK_CXY ) ) 94 98 printk("\n[%s] thread[%x,%x] BLOCK on q_lock %s [%x,%x]\n", 95 99 __FUNCTION__, this->process->pid, this->trdid, … … 117 121 118 122 #if DEBUG_QUEUELOCK_TYPE 119 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 123 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 124 (lock_ptr == DEBUG_QUEUELOCK_PTR ) && 125 (lock_cxy == DEBUG_QUEUELOCK_CXY ) ) 120 126 printk("\n[%s] thread[%x,%x] ACQUIRE q_lock %s [%x,%x]\n", 121 127 __FUNCTION__, this->process->pid, this->trdid, … … 152 158 thread_t * this = CURRENT_THREAD; 153 159 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 154 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 160 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 161 (lock_ptr == DEBUG_QUEUELOCK_PTR ) && 162 (lock_cxy == DEBUG_QUEUELOCK_CXY ) ) 155 163 printk("\n[%s] thread[%x,%x] RELEASE q_lock %s (%x,%x)\n", 156 164 __FUNCTION__, this->process->pid, this->trdid, … … 171 179 172 180 #if DEBUG_QUEUELOCK_TYPE 173 if( (DEBUG_QUEUELOCK_TYPE == lock_type) || (DEBUG_QUEUELOCK_TYPE == 1000) ) 181 if( (lock_type == DEBUG_QUEUELOCK_TYPE) && 182 (lock_ptr == DEBUG_QUEUELOCK_PTR ) && 183 (lock_cxy == DEBUG_QUEUELOCK_CXY ) ) 174 184 { 175 185 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); -
trunk/kernel/libk/remote_rwlock.c
r627 r629 55 55 #if DEBUG_RWLOCK_TYPE 56 56 thread_t * this = CURRENT_THREAD; 57 if( DEBUG_RWLOCK_TYPE == type ) 57 if( (type == DEBUG_RWLOCK_TYPE) && 58 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 59 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 58 60 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n", 59 61 __FUNCTION__, this->process->pid, this->trdid, … … 93 95 94 96 #if DEBUG_RWLOCK_TYPE 95 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 97 if( (lock_type == DEBUG_RWLOCK_TYPE) && 98 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 99 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 96 100 printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n", 97 101 __FUNCTION__, this->process->pid, this->trdid, … … 124 128 125 129 #if DEBUG_RWLOCK_TYPE 126 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 127 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken = %d / count = %d\n", 130 if( (lock_type == DEBUG_RWLOCK_TYPE) && 131 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 132 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 133 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n", 128 134 __FUNCTION__, this->process->pid, this->trdid, 129 135 lock_type_str[lock_type], lock_cxy, lock_ptr, … … 166 172 167 173 #if DEBUG_RWLOCK_TYPE 168 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 174 if( (lock_type == DEBUG_RWLOCK_TYPE) && 175 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 176 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 169 177 printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n", 170 178 __FUNCTION__, this->process->pid, this->trdid, … … 196 204 197 205 #if DEBUG_RWLOCK_TYPE 198 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 206 if( (lock_type == DEBUG_RWLOCK_TYPE) && 207 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 208 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 199 209 printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n", 200 210 __FUNCTION__, this->process->pid, this->trdid, … … 235 245 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 236 246 xptr_t taken_xp = XPTR( lock_cxy , &lock_ptr->taken ); 237 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 247 if( (lock_type == DEBUG_RWLOCK_TYPE) && 248 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 249 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 238 250 printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n", 239 251 __FUNCTION__, this->process->pid, this->trdid, … … 258 270 259 271 #if DEBUG_RWLOCK_TYPE 260 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 272 if( (lock_type == DEBUG_RWLOCK_TYPE) && 273 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 274 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 261 275 { 262 276 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); … … 289 303 290 304 #if DEBUG_RWLOCK_TYPE 291 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 305 if( (lock_type == DEBUG_RWLOCK_TYPE) && 306 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 307 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 292 308 { 293 309 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); … … 334 350 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 335 351 xptr_t count_xp = XPTR( lock_cxy , &lock_ptr->count ); 336 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 352 if( (lock_type == DEBUG_RWLOCK_TYPE) && 353 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 354 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 337 355 printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n", 338 356 __FUNCTION__, this->process->pid, this->trdid, … … 356 374 357 375 #if DEBUG_RWLOCK_TYPE 358 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 376 if( (lock_type == DEBUG_RWLOCK_TYPE) && 377 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 378 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 359 379 { 360 380 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); … … 386 406 387 407 #if DEBUG_RWLOCK_TYPE 388 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 408 if( (lock_type == DEBUG_RWLOCK_TYPE) && 409 ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 410 (lock_cxy == DEBUG_RWLOCK_CXY ) ) 389 411 { 390 412 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); -
trunk/kernel/libk/remote_rwlock.h
r627 r629 42 42 * taken, or if the number of readers is non zero, it registers in the "wr_root" waiting 43 43 * queue, blocks, and deschedules. It set "taken" otherwise. 44 * - when a reader completes its access, it decrement the readers "count", unblock the44 * - when a reader completes its access, it decrement the readers "count", unblock 45 45 * the first waiting writer if there is no other readers, and unblock all waiting 46 46 * readers if there no write request. -
trunk/kernel/libk/rwlock.c
r623 r629 2 2 * rwlock.c - kernel local read/write lock implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 52 52 #if DEBUG_RWLOCK_TYPE 53 53 thread_t * this = CURRENT_THREAD; 54 if( DEBUG_RWLOCK_TYPE == type ) 54 if( (type == DEBUG_RWLOCK_TYPE) && 55 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 56 (local_cxy == DEBUG_RWLOCK_CXY ) ) 55 57 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n", 56 58 __FUNCTION__, this->process->pid, this->trdid, … … 80 82 81 83 #if DEBUG_RWLOCK_TYPE 82 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 84 if( (lock_type == DEBUG_RWLOCK_TYPE) && 85 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 86 (local_cxy == DEBUG_RWLOCK_CXY ) ) 83 87 printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n", 84 88 __FUNCTION__, this->process->pid, this->trdid, … … 105 109 106 110 #if DEBUG_RWLOCK_TYPE 107 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 111 if( (lock_type == DEBUG_RWLOCK_TYPE) && 112 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 113 (local_cxy == DEBUG_RWLOCK_CXY ) ) 108 114 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n", 109 115 __FUNCTION__, this->process->pid, this->trdid, … … 136 142 137 143 #if DEBUG_RWLOCK_TYPE 138 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 144 if( (lock_type == DEBUG_RWLOCK_TYPE) && 145 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 146 (local_cxy == DEBUG_RWLOCK_CXY ) ) 139 147 printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n", 140 148 __FUNCTION__, this->process->pid, this->trdid, … … 161 169 162 170 #if DEBUG_RWLOCK_TYPE 163 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 171 if( (lock_type == DEBUG_RWLOCK_TYPE) && 172 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 173 (local_cxy == DEBUG_RWLOCK_CXY ) ) 164 174 printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n", 165 175 __FUNCTION__, this->process->pid, this->trdid, … … 187 197 thread_t * this = CURRENT_THREAD; 188 198 uint32_t lock_type = lock->lock.type; 189 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 199 if( (lock_type == DEBUG_RWLOCK_TYPE) && 200 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 201 (local_cxy == DEBUG_RWLOCK_CXY ) ) 190 202 printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n", 191 203 __FUNCTION__, this->process->pid, this->trdid, … … 201 213 202 214 #if DEBUG_RWLOCK_TYPE 203 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 215 if( (lock_type == DEBUG_RWLOCK_TYPE) && 216 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 217 (local_cxy == DEBUG_RWLOCK_CXY ) ) 204 218 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 205 219 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, … … 223 237 224 238 #if DEBUG_RWLOCK_TYPE 225 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 239 if( (lock_type == DEBUG_RWLOCK_TYPE) && 240 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 241 (local_cxy == DEBUG_RWLOCK_CXY ) ) 226 242 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 227 243 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, … … 257 273 thread_t * this = CURRENT_THREAD; 258 274 uint32_t lock_type = lock->lock.type; 259 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 275 if( (lock_type == DEBUG_RWLOCK_TYPE) && 276 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 277 (local_cxy == DEBUG_RWLOCK_CXY ) ) 260 278 printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n", 261 279 __FUNCTION__, this->process->pid, this->trdid, … … 270 288 271 289 #if DEBUG_RWLOCK_TYPE 272 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 290 if( (lock_type == DEBUG_RWLOCK_TYPE) && 291 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 292 (local_cxy == DEBUG_RWLOCK_CXY ) ) 273 293 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 274 294 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, … … 291 311 292 312 #if DEBUG_RWLOCK_TYPE 293 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) ) 313 if( (lock_type == DEBUG_RWLOCK_TYPE) && 314 ((intptr_t)lock == DEBUG_RWLOCK_PTR ) && 315 (local_cxy == DEBUG_RWLOCK_CXY ) ) 294 316 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 295 317 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, -
trunk/kernel/libk/user_dir.c
r619 r629 2 2 * user_dir.c - kernel DIR related operations implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 91 91 pid_t ref_pid; // reference process PID 92 92 xptr_t gpt_xp; // extended pointer on reference process GPT 93 uint32_t gpt_attributes; // attributes for all mapped gptentries93 uint32_t attr; // attributes for all GPT entries 94 94 uint32_t dirents_per_page; // number of dirent descriptors per page 95 95 xptr_t page_xp; // extended pointer on page descriptor … … 99 99 uint32_t total_dirents; // total number of dirents in dirent array 100 100 uint32_t total_pages; // total number of pages for dirent array 101 vpn_t vpn; // first page in dirent array vseg 101 vpn_t vpn_base; // first page in dirent array vseg 102 vpn_t vpn; // current page in dirent array vseg 102 103 ppn_t ppn; // ppn of currently allocated physical page 103 104 uint32_t entries; // number of dirent actually comied in one page … … 107 108 uint32_t page_id; // page index in list of physical pages 108 109 kmem_req_t req; // kmem request descriptor 110 ppn_t fake_ppn; // unused, but required by hal_gptlock_pte() 111 uint32_t fake_attr; // unused, but required by hal_gptlock_pte() 109 112 error_t error; 110 113 111 // get cluster, local pointer, and pid of reference userprocess114 // get cluster, local pointer, and pid of reference process 112 115 ref_cxy = GET_CXY( ref_xp ); 113 116 ref_ptr = GET_PTR( ref_xp ); … … 256 259 "unconsistent vseg size for dirent array" ); 257 260 258 // build extended pointer on reference process GPT , PTE attributes and ppn261 // build extended pointer on reference process GPT 259 262 gpt_xp = XPTR( ref_cxy , &ref_ptr->vmm.gpt ); 260 gpt_attributes = GPT_MAPPED | 261 GPT_SMALL | 262 GPT_READABLE | 263 GPT_CACHABLE | 264 GPT_USER ; 263 264 // build PTE attributes 265 attr = GPT_MAPPED | 266 GPT_SMALL | 267 GPT_READABLE | 268 GPT_CACHABLE | 269 GPT_USER ; 265 270 266 271 // get first vpn from vseg descriptor 267 vpn = hal_remote_l32( XPTR( ref_cxy , &vseg->vpn_base ) );272 vpn_base = hal_remote_l32( XPTR( ref_cxy , &vseg->vpn_base ) ); 268 273 269 274 // scan the list of allocated physical pages to map 270 // all physical pages in the in thereference process GPT275 // all physical pages in the reference process GPT 271 276 page_id = 0; 272 277 while( list_is_empty( &root ) == false ) … … 277 282 // compute ppn 278 283 ppn = ppm_page2ppn( XPTR( local_cxy , page ) ); 284 285 // compute vpn 286 vpn = vpn_base + page_id; 279 287 280 error = hal_gpt_set_pte( gpt_xp, 281 vpn + page_id, 282 gpt_attributes, 283 ppn ); 288 // lock the PTE (and create PT2 if required) 289 error = hal_gpt_lock_pte( gpt_xp, 290 vpn, 291 &fake_attr, 292 &fake_ppn ); 284 293 if( error ) 285 294 { 286 295 printk("\n[ERROR] in %s : cannot map vpn %x in GPT\n", 287 __FUNCTION__, (vpn + page_id));296 __FUNCTION__, vpn ); 288 297 289 298 // delete the vseg 290 if( ref_cxy == local_cxy) vmm_delete_vseg( ref_pid, vpn<<CONFIG_PPM_PAGE_SHIFT ); 291 else rpc_vmm_delete_vseg_client( ref_cxy, ref_pid, vpn<<CONFIG_PPM_PAGE_SHIFT ); 299 if( ref_cxy == local_cxy) 300 vmm_delete_vseg( ref_pid, vpn_base << CONFIG_PPM_PAGE_SHIFT ); 301 else 302 rpc_vmm_delete_vseg_client( ref_cxy, ref_pid, vpn_base << CONFIG_PPM_PAGE_SHIFT ); 292 303 293 304 // release the user_dir descriptor … … 298 309 } 299 310 311 // set PTE in GPT 312 hal_gpt_set_pte( gpt_xp, 313 vpn, 314 attr, 315 ppn ); 316 300 317 #if DEBUG_USER_DIR 301 318 if( cycle > DEBUG_USER_DIR ) … … 317 334 dir->current = 0; 318 335 dir->entries = total_dirents; 319 dir->ident = (intptr_t)(vpn << CONFIG_PPM_PAGE_SHIFT);336 dir->ident = (intptr_t)(vpn_base << CONFIG_PPM_PAGE_SHIFT); 320 337 321 338 // build extended pointers on root and lock of user_dir xlist in ref process -
trunk/kernel/libk/user_dir.h
r623 r629 2 2 * user_dir.h - DIR related operations definition. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites
Note: See TracChangeset
for help on using the changeset viewer.