Changeset 625 for trunk/hal/tsar_mips32/drivers
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_tty.c
r619 r625 346 346 owner_pid = hal_remote_l32( XPTR( owner_cxy , &owner_ptr->pid ) ); 347 347 348 // block TXT owner process only if it is not the INIT process 349 if( owner_pid != 1 ) 350 { 351 // get parent process descriptor pointers 352 parent_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->parent_xp ) ); 353 parent_cxy = GET_CXY( parent_xp ); 354 parent_ptr = GET_PTR( parent_xp ); 355 356 // get pointers on the parent process main thread 357 parent_main_ptr = hal_remote_lpt(XPTR(parent_cxy,&parent_ptr->th_tbl[0])); 358 parent_main_xp = XPTR( parent_cxy , parent_main_ptr ); 359 360 // transfer TXT ownership 361 process_txt_transfer_ownership( owner_xp ); 362 363 // block all threads in all clusters, but the main thread 364 process_sigaction( owner_pid , BLOCK_ALL_THREADS ); 365 366 // block the main thread 367 xptr_t main_xp = XPTR( owner_cxy , &owner_ptr->th_tbl[0] ); 368 thread_block( main_xp , THREAD_BLOCKED_GLOBAL ); 369 370 // atomically update owner process termination state 371 hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , 372 PROCESS_TERM_STOP ); 373 374 // unblock the parent process main thread 375 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 376 377 return; 378 } 348 // TXT owner cannot be the INIT process 349 assert( (owner_pid != 1) , "INIT process cannot be the TXT owner" ); 350 351 // get parent process descriptor pointers 352 parent_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->parent_xp ) ); 353 parent_cxy = GET_CXY( parent_xp ); 354 parent_ptr = GET_PTR( parent_xp ); 355 356 // get pointers on the parent process main thread 357 parent_main_ptr = hal_remote_lpt(XPTR(parent_cxy,&parent_ptr->th_tbl[0])); 358 parent_main_xp = XPTR( parent_cxy , parent_main_ptr ); 359 360 // transfer TXT ownership 361 process_txt_transfer_ownership( owner_xp ); 362 363 // mark for block all threads in all clusters, but the main 364 process_sigaction( owner_pid , BLOCK_ALL_THREADS ); 365 366 // block the main thread 367 xptr_t main_xp = XPTR( owner_cxy , &owner_ptr->th_tbl[0] ); 368 thread_block( main_xp , THREAD_BLOCKED_GLOBAL ); 369 370 // atomically update owner process termination state 371 hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , 372 PROCESS_TERM_STOP ); 373 374 // unblock the parent process main thread 375 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 376 377 return; 379 378 } 380 379 … … 390 389 owner_xp = process_txt_get_owner( channel ); 391 390 392 // check process exist 393 assert( (owner_xp != XPTR_NULL) , 394 "TXT owner process not found\n" ); 391 // check process exist 392 assert( (owner_xp != XPTR_NULL) , "TXT owner process not found\n" ); 395 393 396 394 // get relevant infos on TXT owner process … … 399 397 owner_pid = hal_remote_l32( XPTR( owner_cxy , &owner_ptr->pid ) ); 400 398 401 // kill TXT owner process only if it is not the INIT process 402 if( owner_pid != 1 ) 403 { 404 // get parent process descriptor pointers 405 parent_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->parent_xp ) ); 406 parent_cxy = GET_CXY( parent_xp ); 407 parent_ptr = GET_PTR( parent_xp ); 408 409 // get pointers on the parent process main thread 410 parent_main_ptr = hal_remote_lpt(XPTR(parent_cxy,&parent_ptr->th_tbl[0])); 411 parent_main_xp = XPTR( parent_cxy , parent_main_ptr ); 412 413 // remove process from TXT list 414 process_txt_detach( owner_xp ); 415 416 // mark for delete all thread in all clusters, but the main 417 process_sigaction( owner_pid , DELETE_ALL_THREADS ); 399 // TXT owner cannot be the INIT process 400 assert( (owner_pid != 1) , "INIT process cannot be the TXT owner" ); 401 402 #if DEBUG_HAL_TXT_RX 403 if( DEBUG_HAL_TXT_RX < rx_cycle ) 404 printk("\n[%s] TXT%d owner is process %x\n", 405 __FUNCTION__, channel, owner_pid ); 406 #endif 407 // get parent process descriptor pointers 408 parent_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->parent_xp ) ); 409 parent_cxy = GET_CXY( parent_xp ); 410 parent_ptr = GET_PTR( parent_xp ); 411 412 // get pointers on the parent process main thread 413 parent_main_ptr = hal_remote_lpt(XPTR(parent_cxy,&parent_ptr->th_tbl[0])); 414 parent_main_xp = XPTR( parent_cxy , parent_main_ptr ); 415 416 // transfer TXT ownership 417 process_txt_transfer_ownership( owner_xp ); 418 419 // remove process from TXT list 420 // process_txt_detach( owner_xp ); 421 422 // mark for delete all thread in all clusters, but the main 423 process_sigaction( owner_pid , DELETE_ALL_THREADS ); 418 424 419 // block main thread 420 xptr_t main_xp = XPTR( owner_cxy , &owner_ptr->th_tbl[0] ); 421 thread_block( main_xp , THREAD_BLOCKED_GLOBAL ); 422 423 // atomically update owner process termination state 424 hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , 425 PROCESS_TERM_KILL ); 426 427 // unblock the parent process main thread 428 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 429 430 return; 431 } 425 #if DEBUG_HAL_TXT_RX 426 if( DEBUG_HAL_TXT_RX < rx_cycle ) 427 printk("\n[%s] marked for delete all threads of process but main\n", 428 __FUNCTION__, owner_pid ); 429 #endif 430 // block main thread 431 xptr_t main_xp = XPTR( owner_cxy , &owner_ptr->th_tbl[0] ); 432 thread_block( main_xp , THREAD_BLOCKED_GLOBAL ); 433 434 #if DEBUG_HAL_TXT_RX 435 if( DEBUG_HAL_TXT_RX < rx_cycle ) 436 printk("\n[%s] blocked process %x main thread\n", 437 __FUNCTION__, owner_pid ); 438 #endif 439 440 // atomically update owner process termination state 441 hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , 442 PROCESS_TERM_KILL ); 443 444 // unblock the parent process main thread 445 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 446 447 #if DEBUG_HAL_TXT_RX 448 if( DEBUG_HAL_TXT_RX < rx_cycle ) 449 printk("\n[%s] unblocked parent process %x main thread\n", 450 __FUNCTION__, hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid) ) ); 451 #endif 452 return; 432 453 } 433 454
Note: See TracChangeset
for help on using the changeset viewer.