Changeset 435 for trunk/kernel/kern/rpc.c
- Timestamp:
- Feb 20, 2018, 5:32:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r433 r435 39 39 #include <vfs.h> 40 40 #include <fatfs.h> 41 #include <signal.h>42 41 #include <rpc.h> 43 42 … … 80 79 &rpc_process_make_fork_server, // 3 81 80 &rpc_undefined, // 4 unused slot 82 &rpc_ process_make_kill_server, // 581 &rpc_undefined, // 5 unused slot 83 82 &rpc_thread_user_create_server, // 6 84 83 &rpc_thread_kernel_create_server, // 7 … … 610 609 611 610 ///////////////////////////////////////////////////////////////////////////////////////// 612 // [5] Marshaling functions attached to RPC_PROCESS_MAKE_KILL (blocking) 613 ///////////////////////////////////////////////////////////////////////////////////////// 614 615 /////////////////////////////////////////////////// 616 void rpc_process_make_kill_client( cxy_t cxy, 617 process_t * process, 618 bool_t is_exit, 619 uint32_t status ) 620 { 621 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 622 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 623 CURRENT_THREAD->core->lid , hal_time_stamp() ); 624 625 // initialise RPC descriptor header 626 rpc_desc_t rpc; 627 rpc.index = RPC_PROCESS_MAKE_KILL; 628 rpc.response = 1; 629 rpc.blocking = true; 630 631 // set input arguments in RPC descriptor 632 rpc.args[0] = (uint64_t)(intptr_t)process; 633 rpc.args[1] = (uint64_t)is_exit; 634 rpc.args[2] = (uint64_t)status; 635 636 // register RPC request in remote RPC fifo (blocking function) 637 rpc_send( cxy , &rpc ); 638 639 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 640 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 641 CURRENT_THREAD->core->lid , hal_time_stamp() ); 642 } 643 644 ////////////////////////////////////////////// 645 void rpc_process_make_kill_server( xptr_t xp ) 646 { 647 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 648 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 649 CURRENT_THREAD->core->lid , hal_time_stamp() ); 650 651 process_t * process; 652 bool_t is_exit; 653 uint32_t status; 654 655 // get client cluster identifier and pointer on RPC descriptor 656 cxy_t client_cxy = (cxy_t)GET_CXY( xp ); 657 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp ); 658 659 // get arguments from RPC descriptor 660 process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); 661 is_exit = (bool_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); 662 status = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); 663 664 // call local kernel function 665 process_make_kill( process , is_exit , status ); 666 667 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 668 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 669 CURRENT_THREAD->core->lid , hal_time_stamp() ); 670 } 611 // [5] undefined slot 612 ///////////////////////////////////////////////////////////////////////////////////////// 671 613 672 614 ///////////////////////////////////////////////////////////////////////////////////////// … … 906 848 rpc_desc_t * rpc_ptr ) 907 849 { 908 sigaction_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",850 rpc_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", 909 851 __FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) , 910 852 ((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() ); … … 913 855 rpc_send( cxy , rpc_ptr ); 914 856 915 sigaction_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n",857 rpc_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n", 916 858 __FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) , 917 859 ((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() ); … … 921 863 void rpc_process_sigaction_server( xptr_t xp ) 922 864 { 865 pid_t pid; // target process identifier 923 866 process_t * process; // pointer on local process descriptor 924 867 uint32_t action; // sigaction index … … 934 877 935 878 // get arguments from RPC descriptor 936 action = (uint32_t) 937 p rocess = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) );879 action = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &rpc->args[0] ) ); 880 pid = (pid_t) hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) ); 938 881 client_ptr = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) ); 882 883 rpc_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n", 884 __FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() ); 885 886 // get local process descriptor 887 process = process_get_local_copy( pid ); 939 888 940 889 // build extended pointer on client thread 941 890 client_xp = XPTR( client_cxy , client_ptr ); 942 943 sigaction_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n",944 __FUNCTION__ , process_action_str( action ) , process->pid , (uint32_t)hal_get_cycles() );945 891 946 892 // call relevant kernel function … … 958 904 } 959 905 960 sigaction_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n",961 __FUNCTION__ , process_action_str( action ) , p rocess->pid , (uint32_t)hal_get_cycles() );906 rpc_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n", 907 __FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() ); 962 908 } 963 909
Note: See TracChangeset
for help on using the changeset viewer.