Changeset 657 for trunk/kernel/kern
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (5 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 2 added
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/chdev.c
r635 r657 1 1 /* 2 * chdev.c - channel device descriptor operationsimplementation.2 * chdev.c - channel device API implementation. 3 3 * 4 * Authors Alain Greiner (2016 )4 * Authors Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 148 148 #endif 149 149 150 thread_t * this = CURRENT_THREAD; 150 thread_t * this = CURRENT_THREAD; 151 xptr_t client_xp = XPTR( local_cxy , this ); 151 152 152 153 // get chdev cluster and local pointer … … 197 198 lock_xp = XPTR( chdev_cxy , &chdev_ptr->wait_lock ); 198 199 199 // The following actions executein critical section,200 // because the lock_acquire / lock_release :201 // (1) take the lock protecting the chdev state200 // The following actions are executed in critical section, 201 // (because the busylock_acquire / busylock_release) 202 // (1) take the lock protecting the waiting queue 202 203 // (2) register client thread in server queue 203 204 // (3) unblock the server thread and block client thread … … 224 225 225 226 // 3. client thread unblocks server thread and blocks itself 226 thread_unblock( server_xp , THREAD_BLOCKED_ IDLE);227 thread_block( XPTR( local_cxy , CURRENT_THREAD ), THREAD_BLOCKED_IO );227 thread_unblock( server_xp , THREAD_BLOCKED_CLIENT ); 228 thread_block( client_xp , THREAD_BLOCKED_IO ); 228 229 229 230 #if (DEBUG_CHDEV_CMD_TX & 1) … … 300 301 server = CURRENT_THREAD; 301 302 302 // build extended pointer on root of client threads queue303 // build extended pointer on root & lock of client threads queue 303 304 root_xp = XPTR( local_cxy , &chdev->wait_root ); 304 305 // build extended pointer on lock protecting client threads queue306 305 lock_xp = XPTR( local_cxy , &chdev->wait_lock ); 307 306 … … 351 350 #endif 352 351 // block 353 thread_block( XPTR( local_cxy , server ) , THREAD_BLOCKED_ IDLE);352 thread_block( XPTR( local_cxy , server ) , THREAD_BLOCKED_CLIENT ); 354 353 355 354 // deschedule … … 358 357 else // waiting queue not empty 359 358 { 359 // get pointers on first client thread 360 client_xp = XLIST_FIRST( root_xp , thread_t , wait_list ); 361 client_cxy = GET_CXY( client_xp ); 362 client_ptr = GET_PTR( client_xp ); 363 364 // remove this client thread from chdev waiting queue 365 xlist_unlink( XPTR( client_cxy , &client_ptr->wait_list ) ); 366 360 367 // release lock protecting the waiting queue 361 368 remote_busylock_release( lock_xp ); 362 363 // get extended pointer on first client thread364 client_xp = XLIST_FIRST( root_xp , thread_t , wait_list );365 366 // get client thread cluster and local pointer367 client_cxy = GET_CXY( client_xp );368 client_ptr = GET_PTR( client_xp );369 369 370 370 #if( DEBUG_CHDEV_SERVER_TX || DEBUG_CHDEV_SERVER_RX ) … … 402 402 // unblock client thread when driver returns 403 403 thread_unblock( client_xp , THREAD_BLOCKED_IO ); 404 405 // get the lock protecting the waiting queue406 remote_busylock_acquire( lock_xp );407 408 // remove this client thread from chdev waiting queue409 xlist_unlink( XPTR( client_cxy , &client_ptr->wait_list ) );410 411 // release lock protecting the waiting queue412 remote_busylock_release( lock_xp );413 404 414 405 #if DEBUG_CHDEV_SERVER_RX -
trunk/kernel/kern/chdev.h
r625 r657 1 1 /* 2 * chdev.h - channel device (chdev) descriptor definition.2 * chdev.h - channel device (chdev) descriptor and API definition. 3 3 * 4 * Authors Alain Greiner (2016 )4 * Authors Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 36 36 #include <dev_txt.h> 37 37 38 /**************************************************************************************** **38 /**************************************************************************************** 39 39 * Channel Device descriptor definition 40 40 * … … 42 42 * independant) Channel Device descriptor (in brief "chdev"). 43 43 * ALMOS-MKH supports multi-channels peripherals, and defines one separated chdev 44 * descriptor for each channel (and for each RX/TX direction for theNIC and TXT devices).44 * descriptor for each channel (and for each RX/TX direction for NIC and TXT devices). 45 45 * Each chdev contains a trans-clusters waiting queue, registering the "client threads", 46 46 * and an associated "server thread", handling these requests. … … 50 50 * - the server cluster, containing the chdev and the server thread, 51 51 * - the I/O cluster, containing the physical device. 52 *************************************************************************************** **/52 ***************************************************************************************/ 53 53 54 54 /**** Forward declarations ****/ … … 58 58 struct boot_info_s; 59 59 60 /**************************************************************************************** **61 * These macros extract the functionality and theimplementation from the peripheral type.62 *************************************************************************************** **/60 /**************************************************************************************** 61 * These macros extract functionality and implementation from the peripheral type. 62 ***************************************************************************************/ 63 63 64 64 #define FUNC_FROM_TYPE( type ) ((uint32_t)(type>>16)) 65 65 #define IMPL_FROM_TYPE( type ) ((uint32_t)(type & 0x0000FFFF)) 66 66 67 /**************************************************************************************** **67 /**************************************************************************************** 68 68 * This define the generic prototypes for the three functions that must be defined 69 69 * by the drivers implementing a generic device: … … 73 73 * The "cmd", "isr", and "aux" driver functions are registered in the generic chdev 74 74 * descriptor at kernel init, and are called to start and complete an I/O operation. 75 *************************************************************************************** **/75 ***************************************************************************************/ 76 76 77 77 typedef void (dev_ini_t) ( xptr_t dev ); … … 80 80 typedef void (dev_aux_t) ( void * args ); 81 81 82 /**************************************************************************************** **82 /**************************************************************************************** 83 83 * This enum defines the supported generic device types. 84 84 * These types are functionnal types: all (architecture specific) implementations … … 89 89 * distributed LAPIC controler, but it does not exist as a chdev in the kernel, 90 90 * as it is hidden in the driver associated to the PIC device. 91 *************************************************************************************** **/91 ***************************************************************************************/ 92 92 93 93 enum dev_func_type … … 116 116 * For each device type ***, the specific extension is defined in the "dev_***.h" file. 117 117 * 118 * NOTE :For most chdevs, the busylock is used to protect the waiting queue changes,118 * NOTE . For most chdevs, the busylock is used to protect the waiting queue changes, 119 119 * when a thread register in this queue, or is removed after service. 120 * This busylock is also used to protect direct access to the kernel TXT0 terminal 121 * (without using the server thread). 120 * . This busylock is also used to protect direct access to the shared 121 * kernel TXT0 terminal, that does not use the waiting queue. 122 * . For the NIC chdevs it is also used to protect registration (or removal) of a 123 * socket in the list of attached sockets rooted in NIC device extension. 122 124 *****************************************************************************************/ 123 125 … … 125 127 { 126 128 uint32_t func; /*! peripheral functionnal type */ 127 uint32_t impl; /*! peripheral i nplementation subtype*/129 uint32_t impl; /*! peripheral implementation type */ 128 130 uint32_t channel; /*! channel index */ 129 131 bool_t is_rx; /*! relevant for NIC and TXT peripherals */ … … 185 187 chdev_directory_t; 186 188 187 /**************************************************************************************** **189 /**************************************************************************************** 188 190 * This function display relevant values for a chdev descriptor. 189 **************************************************************************************** **191 **************************************************************************************** 190 192 * @ chdev : pointer on chdev. 191 *************************************************************************************** **/193 ***************************************************************************************/ 192 194 void chdev_print( chdev_t * chdev ); 193 195 194 /**************************************************************************************** **196 /**************************************************************************************** 195 197 * This function returns a printable string for a device functionnal types. 196 **************************************************************************************** **198 **************************************************************************************** 197 199 * @ func_type : functionnal type. 198 200 * @ return pointer on string. 199 *************************************************************************************** **/201 ***************************************************************************************/ 200 202 char * chdev_func_str( uint32_t func_type ); 201 203 202 /**************************************************************************************** **204 /**************************************************************************************** 203 205 * This function allocates memory and initializes a chdev descriptor in local cluster, 204 206 * from arguments values. It should be called by a local thread. 205 207 * The device specific fields are initialised later. 206 **************************************************************************************** **208 **************************************************************************************** 207 209 * @ func : functionnal type. 208 210 * @ impl : implementation type. … … 211 213 * @ base : extended pointer on peripheral segment base. 212 214 * @ return a local pointer on created chdev / return NULL if failure. 213 *************************************************************************************** **/215 ***************************************************************************************/ 214 216 chdev_t * chdev_create( uint32_t func, 215 217 uint32_t impl, … … 218 220 xptr_t base ); 219 221 220 /****************************************************************************************** 221 * This function registers the calling thread in the waiting queue of a remote 222 * chdev descriptor, activates (i.e. unblock) the server thread associated to chdev, 223 * and blocks itself on the THREAD_BLOCKED_IO condition. 224 ****************************************************************************************** 222 /**************************************************************************************** 223 * This generid function is executed by an user thread requesting an IOC or TXT chdev 224 * service. It registers the calling thread in the waiting queue of a the remote 225 * chdev descriptor identified by the <chdev_xp> argument. 226 * It activates (i.e. unblocks) the server thread associated to chdev, blocks itself, 227 * and deschedule. It is supposed to be re-activated by the server thread. 228 * It can be called by a thread running in any cluster. 229 * It cannot be used for a NIC or FBF chdev, because it is only convenient for one shot 230 * I/O operations, as the server thread removes the client thread from the waiting 231 * queue when it starts to execute the command. 232 **************************************************************************************** 233 * Implementation Note: 234 * The following actions are executed in a critical section, thanks to the 235 * busylock_acquire / busylock_release mechanism : 236 * 1) it takes the lock protecting the waiting queue. 237 * 2) it registers client thread in the server queue. 238 * 3) it unblocks the server thread from the THREAD_BLOCKED_CLIENT condition. 239 * 4) it blocks the client thread on the THREAD_BLOCKED_IO condition. 240 * 5) it send an IPI to the core running the server thread to force scheduling. 241 * 6) it releases the lock protecting waiting queue. 242 * 7) it deschedules. 243 **************************************************************************************** 225 244 * @ chdev_xp : extended pointer on remote chdev descriptor. 226 *************************************************************************************** **/245 ***************************************************************************************/ 227 246 void chdev_register_command( xptr_t chdev_xp ); 228 247 229 /****************************************************************************************** 230 * This function is executed by the server thread associated to a chdev descriptor. 231 * It executes an infinite loop to handle sequencially all commands registered by the 232 * client threads in the device waiting queue, until the queue is empty. 233 * The driver CMD function being blocking, these functions return only when the command 248 /**************************************************************************************** 249 * This generic function is executed by the server thread associated to an IOC or TXT 250 * chdev identified by the <chdev> argument, to execute all commands registered in the 251 * waiting queue attached to this chev. 252 * When the clients queue is empty, the server thread blocks on the THREAD_BLOCKED_CLIENT 253 * condition and deschedules. It is supposed to be re-activated by a client thread 254 * registering a new command. 255 * It cannot be used for a NIC or FBF chdev, because it is only convenient for one shot 256 * I/O operations, as the server thread removes the client thread from the waiting 257 * queue when it starts to execute the command. 258 **************************************************************************************** 259 * Implementation Note: 260 * All driver CMD functions are supposed to be blocking, and return only when the command 234 261 * is completed. These functions can use either a busy waiting policy, or a descheduling 235 * policy, blocking on the THREAD_BLOCKED_I O_ISR condition, and reactivated by the ISR.236 * When the waiting queue is empty, the server thread blocks on the THREAD_BLOCKED_IO_CMD237 * condition and deschedule. It is re-activated by a client thread registering a command.238 **************************************************************************************** **262 * policy, blocking on the THREAD_BLOCKED_ISR condition. In the descheduling scenario, 263 * the server thread is supposed to be reactivated by the ISR attached to the hardware 264 * interrupts signaling command completion. 265 **************************************************************************************** 239 266 * @ chdev : local pointer on device descriptor. 240 *************************************************************************************** **/267 ***************************************************************************************/ 241 268 void chdev_server_func( chdev_t * chdev ); 242 269 243 /**************************************************************************************** **270 /**************************************************************************************** 244 271 * This function returns an extended pointer on the chdev associated to a pseudo file 245 272 * descriptor (type INODE_TYPE_DEV) identified by the <file_xp> argument. 246 273 * It can be called by a thread running in any cluster. 247 274 * It enters kernel panic if the inode has not the expected type. 248 **************************************************************************************** **275 **************************************************************************************** 249 276 * @ file_xp : extended pointer on the pseudo file descriptor. 250 277 * @ return an extended pointer on chdev. 251 *************************************************************************************** **/278 ***************************************************************************************/ 252 279 xptr_t chdev_from_file( xptr_t file_xp ); 253 280 254 /**************************************************************************************** **281 /**************************************************************************************** 255 282 * This function displays the local copy of the external chdevs directory. 256 283 * (global variable replicated in all clusters) 257 *************************************************************************************** **/284 ***************************************************************************************/ 258 285 void chdev_dir_display( void ); 259 286 260 /**************************************************************************************** **287 /**************************************************************************************** 261 288 * This function displays the list of threads registered in the queue associated 262 289 * to the chdev identified by the <chdev_xp>. 263 **************************************************************************************** **290 **************************************************************************************** 264 291 * # root_xp : extended pointer 265 *************************************************************************************** **/292 ***************************************************************************************/ 266 293 void chdev_queue_display( xptr_t chdev_xp ); 267 294 -
trunk/kernel/kern/cluster.c
r637 r657 4 4 * Author Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016,2017,2018,2019 )6 * Alain Greiner (2016,2017,2018,2019,2020) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/kern/cluster.h
r637 r657 4 4 * authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016,2017,2018,2019 )6 * Alain Greiner (2016,2017,2018,2019,2019,2020) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites … … 197 197 198 198 /****************************************************************************************** 199 * This function (pseudo) randomly selectsa valid cluster.199 * This function selects (pseudo) randomly a valid cluster. 200 200 * It is called by the vfs_cluster_lookup() function to place a new (missing) inode. 201 201 * It is called by the vmm_page_allocate() function to place a distributed vseg page. 202 * It is called by the dev_nic_accept() function to place a new server socket. 202 203 ****************************************************************************************** 203 204 * @ returns the selected cluster identifier. -
trunk/kernel/kern/core.c
r564 r657 54 54 // initialize scheduler 55 55 sched_init( core ); 56 } 57 58 ////////////////////// 59 lid_t core_lid( void ) 60 { 61 uint32_t i; 62 63 // get pointer on local cluser descriptor 64 cluster_t * cluster = LOCAL_CLUSTER; 65 66 // get core gid from hardware register 67 gid_t gid = hal_get_gid(); 68 69 // makes an associative search in core_tbl[] from gid 70 for( i = 0 ; i < cluster->cores_nr ; i++ ) 71 { 72 if( gid == cluster->core_tbl[i].gid ) return i; 73 } 74 75 assert( false , "core not found" ); 56 76 } 57 77 -
trunk/kernel/kern/core.h
r564 r657 83 83 84 84 /*************************************************************************************** 85 * This function returns the calling core local index (lid), making an associative 86 * in the local core_tbl[] array based on the hardwired (gid). 87 *************************************************************************************** 88 * @ returns always the lid value. 89 **************************************************************************************/ 90 lid_t core_lid( void ); 91 92 /*************************************************************************************** 85 93 * This function returns a pseudo random number from the core descriptor 86 94 * private random generator. -
trunk/kernel/kern/do_syscall.c
r647 r657 112 112 sys_get_thread_info, // 55 113 113 sys_fbf, // 56 114 sys_socket, // 57 114 115 }; 115 116 … … 181 182 case SYS_GET_THREAD_INFO: return "GET_THREAD_INFO"; // 55 182 183 case SYS_FBF: return "FBF"; // 56 184 case SYS_SOCKET: return "SOCKET"; // 57 183 185 184 186 default: return "undefined"; -
trunk/kernel/kern/kernel_init.c
r651 r657 3 3 * 4 4 * Authors : Mohamed Lamine Karaoui (2015) 5 * Alain Greiner (2016,2017,2018,2019 )5 * Alain Greiner (2016,2017,2018,2019,2020) 6 6 * 7 7 * Copyright (c) Sorbonne Universites … … 136 136 "VMM_STACK", // 3 137 137 "VMM_MMAP", // 4 138 " VFS_CTX",// 5139 "K CM_STATE", // 6140 " KHM_STATE",// 7141 "HTAB_STATE", // 8 142 138 "KCM_STATE", // 5 139 "KHM_STATE", // 6 140 "HTAB_STATE", // 7 141 142 "VFS_CTX", // 8 143 143 "PPM_FREE", // 9 144 144 "THREAD_JOIN", // 10 … … 172 172 "VFS_MAIN", // 34 173 173 "FATFS_FAT", // 35 174 "FBF_WINDOWS", // 36 174 175 }; 175 176 … … 874 875 // @ cxy : [out] cluster identifier. 875 876 // @ lid : [out] core global identifier (hardware). 876 // @ return 0 if success / return EINVALif not found.877 // @ return 0 if success / return -1 if not found. 877 878 /////////////////////////////////////////////////////////////////////////////////////////// 878 879 static error_t __attribute__ ((noinline)) get_core_identifiers( boot_info_t * info, … … 898 899 } 899 900 } 900 return EINVAL; 901 } 902 903 904 905 906 907 ///////////////////////////////// 908 // kleenex debug function 909 ///////////////////////////////// 910 void display_fat( uint32_t step ) 911 { 912 fatfs_ctx_t * fatfs_ctx = fs_context[FS_TYPE_FATFS].extend; 913 if( fatfs_ctx != NULL ) 914 { 915 printk("\n[%s] step %d at cycle %d\n", __FUNCTION__, step, (uint32_t)hal_get_cycles() ); 916 xptr_t mapper_xp = fatfs_ctx->fat_mapper_xp; 917 mapper_display_page( mapper_xp , 0 , 128 ); 918 } 919 else 920 { 921 printk("\n[%s] step %d : fatfs context not initialized\n", __FUNCTION__, step ); 922 } 901 return -1; 923 902 } 924 903 … … 949 928 xptr_t devfs_dev_inode_xp; // extended pointer on DEVFS dev inode 950 929 xptr_t devfs_external_inode_xp; // extended pointer on DEVFS external inode 951 xptr_t devfs_internal_inode_xp; // extended pointer on DEVFS internal inode952 930 953 931 error_t error; … … 1139 1117 #endif 1140 1118 1141 #if ( DEBUG_KERNEL_INIT & 1 )1119 #if CONFIG_INSTRUMENTATION_CHDEVS 1142 1120 if( (core_lid == 0) & (local_cxy == 0) ) 1143 1121 chdev_dir_display(); … … 1145 1123 1146 1124 ///////////////////////////////////////////////////////////////////////////////// 1147 // STEP 6 : all cores enable IPI (Inter Procesor Interrupt), 1148 // all cores unblock the idle thread, and register it in scheduler. 1149 // core[0] in cluster[0] creates the VFS root inode. 1150 // It access the boot device to initialize the file system context. 1125 // STEP 6 : All cores enable IPI (Inter Procesor Interrupt), 1126 // All cores unblock the idle thread, and register it in scheduler. 1127 // The core[0] in cluster defined by the CONFIG_VFS_ROOT_CXY parameter, 1128 // access the IOC device to initialize the VFS for the FS identified 1129 // by the CONFIG_VFS_ROOT_IS_*** parameter. It does the following 1130 // actions in the VFS_ROOT cluster : 1131 // 1. allocate and initialize the selected FS context, 1132 // 2. create and initializes the VFS root inodes, 1133 // 3. initialize the VFS context for FATFS (in fs_context[] array), 1134 // 4. create the <.> and <..> dentries in VFS root directory, 1135 // 5. register the VFS root inode in process_zero descriptor, 1136 // 6. allocate the DEVFS context, 1137 // 7. initialize the VFS context for DEVFS (in fs_context[] array), 1138 // 8. create the <dev> and <external> inodes, 1139 // 9. initialize the DEVFS context. 1151 1140 ///////////////////////////////////////////////////////////////////////////////// 1152 1141 … … 1159 1148 core->scheduler.idle = thread; 1160 1149 1161 // core[O] in cluster[0]creates the VFS root1162 if( (core_lid == 0) && (local_cxy == 0) )1150 // core[O] in VFS_ROOT cluster creates the VFS root 1151 if( (core_lid == 0) && (local_cxy == CONFIG_VFS_ROOT_CXY ) ) 1163 1152 { 1164 vfs_root_inode_xp = XPTR_NULL;1165 1166 1153 // Only FATFS is supported yet, 1167 // other File System can be introduced here1154 // TODO other File System can be introduced below 1168 1155 if( CONFIG_VFS_ROOT_IS_FATFS ) 1169 1156 { 1170 // 1. allocate memory for FATFS context in cluster 01171 fatfs_ctx_t * fatfs_ctx = fatfs_ctx_alloc();1172 1173 if( fatfs_ctx ==NULL )1157 // 1. allocate memory and initialize FATFS context in VFS_ROOT cluster 1158 xptr_t fatfs_ctx_xp = fatfs_ctx_alloc( CONFIG_VFS_ROOT_CXY ); 1159 1160 if( fatfs_ctx_xp == XPTR_NULL ) 1174 1161 { 1175 printk("\n[PANIC] in %s : cannot create FATFS context in cluster 0\n",1176 __FUNCTION__ );1162 printk("\n[PANIC] in %s : cannot allocate FATFS context in cluster %x\n", 1163 __FUNCTION__ , CONFIG_VFS_ROOT_CXY ); 1177 1164 hal_core_sleep(); 1178 1165 } 1179 1166 1180 // 2. access boot device to initialize FATFS context 1181 fatfs_ctx_init( fatfs_ctx ); 1182 1183 // 3. get various informations from FATFS context 1184 uint32_t root_dir_cluster = fatfs_ctx->root_dir_cluster; 1185 uint32_t cluster_size = fatfs_ctx->bytes_per_sector * 1186 fatfs_ctx->sectors_per_cluster; 1187 uint32_t total_clusters = fatfs_ctx->fat_sectors_count << 7; 1188 1189 // 4. create VFS root inode in cluster 0 1190 error = vfs_inode_create( FS_TYPE_FATFS, // fs_type 1191 0, // attr 1192 0, // rights 1193 0, // uid 1194 0, // gid 1195 &vfs_root_inode_xp ); // return 1167 // initialise FATFS context in VFS_ROOT cluster from IOC device (boot_record) 1168 error = fatfs_ctx_init( fatfs_ctx_xp ); 1169 1196 1170 if( error ) 1197 1171 { 1198 printk("\n[PANIC] in %s : cannot create VFS root inode in cluster 0\n",1199 __FUNCTION__ );1172 printk("\n[PANIC] in %s : cannot initialize FATFS context in cluster %x\n", 1173 __FUNCTION__ , CONFIG_VFS_ROOT_CXY ); 1200 1174 hal_core_sleep(); 1201 1175 } 1202 1176 1203 // 5. update FATFS root inode "type" and "extend" fields 1204 cxy_t vfs_root_cxy = GET_CXY( vfs_root_inode_xp ); 1205 vfs_inode_t * vfs_root_ptr = GET_PTR( vfs_root_inode_xp ); 1206 hal_remote_s32( XPTR( vfs_root_cxy , &vfs_root_ptr->type ), INODE_TYPE_DIR ); 1207 hal_remote_spt( XPTR( vfs_root_cxy , &vfs_root_ptr->extend ), 1177 #if( DEBUG_KERNEL_INIT & 1 ) 1178 printk("\n[%s] initialized FATFS context in cluster %x\n", 1179 __FUNCTION__, CONFIG_VFS_ROOT_CXY ); 1180 #endif 1181 1182 // get various informations from FATFS context 1183 fatfs_ctx_t * fatfs_ctx_ptr = GET_PTR( fatfs_ctx_xp ); 1184 1185 uint32_t root_dir_cluster = hal_remote_l32( XPTR( CONFIG_VFS_ROOT_CXY, 1186 &fatfs_ctx_ptr->root_dir_cluster ) ); 1187 1188 uint32_t bytes_per_sector = hal_remote_l32( XPTR( CONFIG_VFS_ROOT_CXY, 1189 &fatfs_ctx_ptr->bytes_per_sector ) ); 1190 1191 uint32_t sectors_per_cluster = hal_remote_l32( XPTR( CONFIG_VFS_ROOT_CXY, 1192 &fatfs_ctx_ptr->sectors_per_cluster ) ); 1193 1194 uint32_t cluster_size = bytes_per_sector * sectors_per_cluster; 1195 1196 uint32_t fat_sectors_count = hal_remote_l32( XPTR( CONFIG_VFS_ROOT_CXY, 1197 &fatfs_ctx_ptr->fat_sectors_count ) ) << 7; 1198 1199 uint32_t total_clusters = fat_sectors_count << 7; 1200 1201 // 2. create VFS root inode in VFS_ROOT cluster 1202 // TODO define attr, rights, uid, gid 1203 error = vfs_inode_create( CONFIG_VFS_ROOT_CXY, // target cluster 1204 FS_TYPE_FATFS, // fs_type 1205 0, // attr 1206 0, // rights 1207 0, // uid 1208 0, // gid 1209 &vfs_root_inode_xp ); // return 1210 if( error ) 1211 { 1212 printk("\n[PANIC] in %s : cannot create VFS root inode in cluster %x\n", 1213 __FUNCTION__ , CONFIG_VFS_ROOT_CXY ); 1214 hal_core_sleep(); 1215 } 1216 1217 #if( DEBUG_KERNEL_INIT & 1 ) 1218 vfs_inode_t * root_inode = GET_PTR( vfs_root_inode_xp ); 1219 printk("\n[%s] created </> root inode %x in cluster %x / ctx %x\n", 1220 __FUNCTION__, root_inode, CONFIG_VFS_ROOT_CXY, root_inode->ctx ); 1221 #endif 1222 1223 // update FATFS root inode "type" and "extend" fields 1224 vfs_inode_t * vfs_root_inode_ptr = GET_PTR( vfs_root_inode_xp ); 1225 1226 hal_remote_s32( XPTR( CONFIG_VFS_ROOT_CXY , &vfs_root_inode_ptr->type ), 1227 INODE_TYPE_DIR ); 1228 1229 hal_remote_spt( XPTR( CONFIG_VFS_ROOT_CXY , &vfs_root_inode_ptr->extend ), 1208 1230 (void*)(intptr_t)root_dir_cluster ); 1209 1231 1210 // 6. initialize the generic VFS context for FATFS 1211 vfs_ctx_init( FS_TYPE_FATFS, // fs type 1212 0, // attributes: unused 1213 total_clusters, // number of clusters 1214 cluster_size, // bytes 1215 vfs_root_inode_xp, // VFS root 1216 fatfs_ctx ); // extend 1232 // 3. initialize the VFS context for FATFS in VFS_ROOT cluster 1233 vfs_ctx_init( CONFIG_VFS_ROOT_CXY, // target cluster 1234 FS_TYPE_FATFS, // fs type 1235 total_clusters, // number of clusters 1236 cluster_size, // bytes 1237 vfs_root_inode_xp, // VFS root 1238 fatfs_ctx_ptr ); // extend 1239 1240 #if( DEBUG_KERNEL_INIT & 1 ) 1241 vfs_ctx_t * vfs_for_fatfs_ctx = &fs_context[FS_TYPE_FATFS]; 1242 printk("\n[%s] initialized VFS_for_FATFS context in cluster %x / ctx %x / fs_type %d\n", 1243 __FUNCTION__, CONFIG_VFS_ROOT_CXY, vfs_for_fatfs_ctx, vfs_for_fatfs_ctx->type ); 1244 #endif 1217 1245 } 1218 1246 else 1219 1247 { 1220 printk("\n[PANIC] in %s : unsupported VFS type in cluster 0\n",1221 __FUNCTION__ );1248 printk("\n[PANIC] in %s : unsupported VFS type in cluster %x\n", 1249 __FUNCTION__ , CONFIG_VFS_ROOT_CXY ); 1222 1250 hal_core_sleep(); 1223 1251 } 1224 1252 1225 // create the <.> and <..> dentries in VFS root directory1253 // 4. create the <.> and <..> dentries in VFS root directory 1226 1254 // the VFS root parent inode is the VFS root inode itself 1227 1255 vfs_add_special_dentries( vfs_root_inode_xp, 1228 1256 vfs_root_inode_xp ); 1229 1257 1230 // register VFS root inode in process_zero descriptor of cluster 0 1231 process_zero.vfs_root_xp = vfs_root_inode_xp; 1232 process_zero.cwd_xp = vfs_root_inode_xp; 1258 // 5. register VFS root inode in target cluster process_zero descriptor 1259 hal_remote_s64( XPTR( CONFIG_VFS_ROOT_CXY , &process_zero.vfs_root_xp ), 1260 vfs_root_inode_xp ); 1261 hal_remote_s64( XPTR( CONFIG_VFS_ROOT_CXY , &process_zero.cwd_xp ), 1262 vfs_root_inode_xp ); 1263 1264 // 6. allocate memory for DEVFS context in VFS_ROOT cluster 1265 xptr_t devfs_ctx_xp = devfs_ctx_alloc( CONFIG_VFS_ROOT_CXY ); 1266 1267 if( devfs_ctx_xp == XPTR_NULL ) 1268 { 1269 printk("\n[PANIC] in %s : cannot create DEVFS context in cluster %x\n", 1270 __FUNCTION__ , CONFIG_VFS_ROOT_CXY ); 1271 hal_core_sleep(); 1272 } 1273 1274 // 7. initialize the VFS context for DEVFS in VFS_ROOT cluster 1275 vfs_ctx_init( CONFIG_VFS_ROOT_CXY, // target cluster 1276 FS_TYPE_DEVFS, // fs type 1277 0, // total_clusters: unused 1278 0, // cluster_size: unused 1279 vfs_root_inode_xp, // VFS root 1280 GET_PTR( devfs_ctx_xp ) ); // extend 1281 1282 #if( DEBUG_KERNEL_INIT & 1 ) 1283 vfs_ctx_t * vfs_for_devfs_ctx = &fs_context[FS_TYPE_DEVFS]; 1284 printk("\n[%s] initialized VFS_for_DEVFS context in cluster %x / ctx %x / fs_type %d\n", 1285 __FUNCTION__, CONFIG_VFS_ROOT_CXY, vfs_for_devfs_ctx, vfs_for_devfs_ctx->type ); 1286 #endif 1287 1288 // 8. create "dev" and "external" inodes (directories) 1289 devfs_global_init( vfs_root_inode_xp, 1290 &devfs_dev_inode_xp, 1291 &devfs_external_inode_xp ); 1292 1293 // 9. initializes DEVFS context in VFS_ROOT cluster 1294 devfs_ctx_init( devfs_ctx_xp, 1295 devfs_dev_inode_xp, 1296 devfs_external_inode_xp ); 1233 1297 } 1234 1298 … … 1240 1304 1241 1305 #if DEBUG_KERNEL_INIT 1242 if( (core_lid == 0) & (local_cxy == 0) ) 1243 printk("\n[%s] exit barrier 6 : VFS root (%x,%x) in cluster 0 / cycle %d\n", 1244 __FUNCTION__, GET_CXY(process_zero.vfs_root_xp), 1245 GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() ); 1246 #endif 1247 1248 ///////////////////////////////////////////////////////////////////////////////// 1249 // STEP 7 : In all other clusters than cluster[0], the core[0] allocates memory 1250 // for the selected FS context, and initialise the local FS context and 1251 // the local VFS context from values stored in cluster 0. 1252 // They get the VFS root inode extended pointer from cluster 0. 1253 ///////////////////////////////////////////////////////////////////////////////// 1254 1255 if( (core_lid == 0) && (local_cxy != 0) ) 1306 if( (core_lid == 0) & (local_cxy == CONFIG_VFS_ROOT_CXY) ) 1307 printk("\n[%s] exit barrier 6 : VFS root inode (%x) created in cluster (%x) / cycle %d\n", 1308 __FUNCTION__, GET_CXY(vfs_root_inode_xp), 1309 GET_PTR(vfs_root_inode_xp), (uint32_t)hal_get_cycles() ); 1310 #endif 1311 1312 ///////////////////////////////////////////////////////////////////////////////// 1313 // STEP 7 : In all clusters other than the VFS_ROOT cluster, the core[0] makes 1314 // the following local actions to complete the VFS initialisation : 1315 // 1. allocate a local context for the selected FS extension, 1316 // 2. copy FS context from VFS_ROOT cluster to local cluster, 1317 // 3. copy VFS_for_FATFS context from VFS_ROOT cluster to local cluster, 1318 // 4. allocate a local context for the DEVFS extension, 1319 // 5. copy DEVFS context from VFS_ROOT cluster to local cluster, 1320 // 6. update the local "root_inode_xp" field in process_zero. 1321 ///////////////////////////////////////////////////////////////////////////////// 1322 1323 if( (core_lid == 0) && (local_cxy != CONFIG_VFS_ROOT_CXY) ) 1256 1324 { 1257 // File System must be FATFS in this implementation,1258 // but other File System can be introduced here1325 // only FATFS is supported yet 1326 // TODO other File System can be introduced below 1259 1327 if( CONFIG_VFS_ROOT_IS_FATFS ) 1260 1328 { 1261 // 1. allocate memory for local FATFS context 1262 fatfs_ctx_t * local_fatfs_ctx = fatfs_ctx_alloc(); 1263 1264 // check memory 1265 if( local_fatfs_ctx == NULL ) 1329 // 1. allocate a local FATFS context extension 1330 xptr_t local_fatfs_ctx_xp = fatfs_ctx_alloc( local_cxy ); 1331 1332 if( local_fatfs_ctx_xp == XPTR_NULL ) 1266 1333 { 1267 1334 printk("\n[PANIC] in %s : cannot create FATFS context in cluster %x\n", … … 1270 1337 } 1271 1338 1272 // 2. get local pointer on VFS context for FATFS 1273 vfs_ctx_t * vfs_ctx = &fs_context[FS_TYPE_FATFS]; 1274 1275 // 3. get local pointer on FATFS context in cluster 0 1276 fatfs_ctx_t * remote_fatfs_ctx = hal_remote_lpt( XPTR( 0 , &vfs_ctx->extend ) ); 1277 1278 // 4. copy FATFS context from cluster 0 to local cluster 1279 hal_remote_memcpy( XPTR( local_cxy , local_fatfs_ctx ), 1280 XPTR( 0 , remote_fatfs_ctx ), sizeof(fatfs_ctx_t) ); 1281 1282 // 5. copy VFS context from cluster 0 to local cluster 1283 hal_remote_memcpy( XPTR( local_cxy , vfs_ctx ), 1284 XPTR( 0 , vfs_ctx ), sizeof(vfs_ctx_t) ); 1285 1286 // 6. update extend field in local copy of VFS context 1287 vfs_ctx->extend = local_fatfs_ctx; 1288 1289 if( ((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster != 8 ) 1290 { 1291 printk("\n[PANIC] in %s : illegal FATFS context in cluster %x\n", 1292 __FUNCTION__ , local_cxy ); 1293 hal_core_sleep(); 1294 } 1295 } 1296 1297 // get extended pointer on VFS root inode from cluster 0 1298 vfs_root_inode_xp = hal_remote_l64( XPTR( 0 , &process_zero.vfs_root_xp ) ); 1299 1300 // update local process_zero descriptor 1339 // get local pointer on VFS_for_FATFS context (same in all clusters) 1340 vfs_ctx_t * vfs_fat_ctx_ptr = &fs_context[FS_TYPE_FATFS]; 1341 1342 // build extended pointer on VFS_for_FATFS "extend" field in VFS_ROOT cluster 1343 xptr_t fatfs_extend_xp = XPTR( CONFIG_VFS_ROOT_CXY , &vfs_fat_ctx_ptr->extend ); 1344 1345 // get local pointer on FATFS context in VFS_ROOT cluster 1346 fatfs_ctx_t * remote_fatfs_ctx_ptr = hal_remote_lpt( fatfs_extend_xp ); 1347 1348 // build extended pointer on FATFS context in VFS_ROOT cluster 1349 xptr_t remote_fatfs_ctx_xp = XPTR( CONFIG_VFS_ROOT_CXY , remote_fatfs_ctx_ptr ); 1350 1351 // 2. copy FATFS context from VFS_ROOT cluster to local cluster 1352 hal_remote_memcpy( local_fatfs_ctx_xp, 1353 remote_fatfs_ctx_xp, 1354 sizeof(fatfs_ctx_t) ); 1355 1356 // build extended pointer on remote VFS_for_FATFS context 1357 xptr_t remote_vfs_ctx_xp = XPTR( CONFIG_VFS_ROOT_CXY , vfs_fat_ctx_ptr ); 1358 1359 // build extended pointer on local VFS_for_FATFS context 1360 xptr_t local_vfs_ctx_xp = XPTR( local_cxy , vfs_fat_ctx_ptr ); 1361 1362 // 3. copy VFS_for_FATFS context from VFS_ROOT cluster to local cluster 1363 hal_remote_memcpy( local_vfs_ctx_xp, 1364 remote_vfs_ctx_xp, 1365 sizeof(vfs_ctx_t) ); 1366 1367 // update "extend" field in local VFS_for_FATFS context 1368 vfs_fat_ctx_ptr->extend = GET_PTR( local_fatfs_ctx_xp ); 1369 1370 // check local FATFS and VFS context copies 1371 assert( (((fatfs_ctx_t *)vfs_fat_ctx_ptr->extend)->sectors_per_cluster == 8), 1372 "illegal FATFS context in cluster %x\n", local_cxy ); 1373 1374 } 1375 else 1376 { 1377 printk("\n[PANIC] in %s : unsupported VFS type in cluster %x\n", 1378 __FUNCTION__ , local_cxy ); 1379 hal_core_sleep(); 1380 } 1381 1382 // 4. allocate a local DEVFS context extension, 1383 xptr_t local_devfs_ctx_xp = devfs_ctx_alloc( local_cxy ); 1384 1385 // get local pointer on VFS_for_DEVFS context (same in all clusters) 1386 vfs_ctx_t * vfs_dev_ctx_ptr = &fs_context[FS_TYPE_DEVFS]; 1387 1388 // build extended pointer on VFS_for_DEVFS extend field in VFS_ROOT cluster 1389 xptr_t remote_extend_xp = XPTR( CONFIG_VFS_ROOT_CXY , &vfs_dev_ctx_ptr->extend ); 1390 1391 // get local pointer on DEVFS context in VFS_ROOT cluster 1392 devfs_ctx_t * remote_devfs_ctx_ptr = hal_remote_lpt( remote_extend_xp ); 1393 1394 // build extended pointer on FATFS context in VFS_ROOT cluster 1395 xptr_t remote_devfs_ctx_xp = XPTR( CONFIG_VFS_ROOT_CXY , remote_devfs_ctx_ptr ); 1396 1397 // 5. copy DEVFS context from VFS_ROOT cluster to local cluster 1398 hal_remote_memcpy( local_devfs_ctx_xp, 1399 remote_devfs_ctx_xp, 1400 sizeof(devfs_ctx_t) ); 1401 1402 // update "extend" field in local VFS_for_DEVFS context 1403 vfs_dev_ctx_ptr->extend = GET_PTR( local_devfs_ctx_xp ); 1404 1405 // get extended pointer on VFS root inode from VFS_ROOT cluster 1406 vfs_root_inode_xp = hal_remote_l64( XPTR( CONFIG_VFS_ROOT_CXY, 1407 &process_zero.vfs_root_xp ) ); 1408 1409 // 6. update local process_zero descriptor 1301 1410 process_zero.vfs_root_xp = vfs_root_inode_xp; 1302 1411 process_zero.cwd_xp = vfs_root_inode_xp; … … 1310 1419 1311 1420 #if DEBUG_KERNEL_INIT 1312 if( (core_lid == 0) & (local_cxy == 1) ) 1313 printk("\n[%s] exit barrier 7 : VFS root (%x,%x) in cluster 1 / cycle %d\n", 1314 __FUNCTION__, GET_CXY(process_zero.vfs_root_xp), 1315 GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() ); 1316 #endif 1317 1318 ///////////////////////////////////////////////////////////////////////////////// 1319 // STEP 8 : core[0] in cluster 0 makes the global DEVFS initialisation: 1320 // It initializes the DEVFS context, and creates the DEVFS 1321 // "dev" and "external" inodes in cluster 0. 1322 ///////////////////////////////////////////////////////////////////////////////// 1323 1324 if( (core_lid == 0) && (local_cxy == 0) ) 1421 if( (core_lid == 0) & (local_cxy == 0) ) 1422 printk("\n[%s] exit barrier 7 : VFS & DEVFS contexts replicated in all clusters / cycle %d\n", 1423 __FUNCTION__ , (uint32_t)hal_get_cycles() ); 1424 #endif 1425 1426 ///////////////////////////////////////////////////////////////////////////////// 1427 // STEP 8 : In all clusters in parallel, core[0] completes DEVFS initialization. 1428 // Each core[0] creates the local DEVFS "internal" directory, 1429 // and creates the pseudo-files for chdevs placed in local cluster. 1430 ///////////////////////////////////////////////////////////////////////////////// 1431 1432 if( core_lid == 0 ) 1325 1433 { 1326 // 1. allocate memory for DEVFS context extension in cluster 0 1327 devfs_ctx_t * devfs_ctx = devfs_ctx_alloc(); 1328 1329 if( devfs_ctx == NULL ) 1330 { 1331 printk("\n[PANIC] in %s : cannot create DEVFS context in cluster 0\n", 1332 __FUNCTION__ , local_cxy ); 1333 hal_core_sleep(); 1334 } 1335 1336 // 2. initialize the DEVFS entry in the vfs_context[] array 1337 vfs_ctx_init( FS_TYPE_DEVFS, // fs type 1338 0, // attributes: unused 1339 0, // total_clusters: unused 1340 0, // cluster_size: unused 1341 vfs_root_inode_xp, // VFS root 1342 devfs_ctx ); // extend 1343 1344 // 3. create "dev" and "external" inodes (directories) 1345 devfs_global_init( process_zero.vfs_root_xp, 1346 &devfs_dev_inode_xp, 1347 &devfs_external_inode_xp ); 1348 1349 // 4. initializes DEVFS context extension 1350 devfs_ctx_init( devfs_ctx, 1351 devfs_dev_inode_xp, 1352 devfs_external_inode_xp ); 1353 } 1434 // get local pointer on local DEVFS context 1435 devfs_ctx_t * ctx = fs_context[FS_TYPE_DEVFS].extend; 1436 1437 // populate DEVFS in all clusters 1438 devfs_local_init( ctx->dev_inode_xp, 1439 ctx->external_inode_xp ); 1440 } 1354 1441 1355 1442 ///////////////////////////////////////////////////////////////////////////////// … … 1361 1448 #if DEBUG_KERNEL_INIT 1362 1449 if( (core_lid == 0) & (local_cxy == 0) ) 1363 printk("\n[%s] exit barrier 8 : DEVFS root initialized in cluster 0 / cycle %d\n", 1364 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1365 #endif 1366 1367 ///////////////////////////////////////////////////////////////////////////////// 1368 // STEP 9 : In all clusters in parallel, core[0] completes DEVFS initialization. 1369 // Each core[0] get the "dev" and "external" extended pointers from 1370 // values stored in cluster(0), creates the DEVFS "internal" directory, 1371 // and creates the pseudo-files for all chdevs in local cluster. 1372 ///////////////////////////////////////////////////////////////////////////////// 1373 1374 if( core_lid == 0 ) 1375 { 1376 // get extended pointer on "extend" field of VFS context for DEVFS in cluster 0 1377 xptr_t extend_xp = XPTR( 0 , &fs_context[FS_TYPE_DEVFS].extend ); 1378 1379 // get pointer on DEVFS context in cluster 0 1380 devfs_ctx_t * devfs_ctx = hal_remote_lpt( extend_xp ); 1381 1382 devfs_dev_inode_xp = hal_remote_l64( XPTR( 0 , &devfs_ctx->dev_inode_xp ) ); 1383 devfs_external_inode_xp = hal_remote_l64( XPTR( 0 , &devfs_ctx->external_inode_xp ) ); 1384 1385 // populate DEVFS in all clusters 1386 devfs_local_init( devfs_dev_inode_xp, 1387 devfs_external_inode_xp, 1388 &devfs_internal_inode_xp ); 1389 } 1390 1391 ///////////////////////////////////////////////////////////////////////////////// 1392 if( core_lid == 0 ) xbarrier_wait( XPTR( 0 , &global_barrier ), 1393 (info->x_size * info->y_size) ); 1394 barrier_wait( &local_barrier , info->cores_nr ); 1395 ///////////////////////////////////////////////////////////////////////////////// 1396 1397 #if DEBUG_KERNEL_INIT 1398 if( (core_lid == 0) & (local_cxy == 0) ) 1399 printk("\n[%s] exit barrier 9 : DEVFS initialized in cluster 0 / cycle %d\n", 1450 printk("\n[%s] exit barrier 8 : DEVFS initialized in all clusters / cycle %d\n", 1400 1451 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1401 1452 #endif … … 1407 1458 1408 1459 ///////////////////////////////////////////////////////////////////////////////// 1409 // STEP 10: core[0] in cluster 0 creates the first user process (process_init).1410 // This include the first userprocess VMM (GPT and VSL) creation.1411 // 1460 // STEP 9 : core[0] in cluster 0 creates the first user process (process_init). 1461 // This include the process VMM (GPT and VSL) creation. 1462 // Finally, it prints the ALMOS-MKH banner. 1412 1463 ///////////////////////////////////////////////////////////////////////////////// 1413 1464 … … 1419 1470 #if DEBUG_KERNEL_INIT 1420 1471 if( (core_lid == 0) & (local_cxy == 0) ) 1421 printk("\n[%s] exit barrier 10: process_init created in cluster 0 / cycle %d\n",1472 printk("\n[%s] exit barrier 9 : process_init created in cluster 0 / cycle %d\n", 1422 1473 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1423 1474 #endif -
trunk/kernel/kern/printk.h
r625 r657 2 2 * printk.h - Kernel Log & debug messages API definition. 3 3 * 4 * authors Alain Greiner (2016,2017,2018 )4 * authors Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 123 123 124 124 /********************************************************************************** 125 * This function displays a non-formated message on TXT0 terminal.125 * This debug function displays a non-formated message on TXT0 terminal. 126 126 * This function is actually used to debug the assembly level kernel functions. 127 127 ********************************************************************************** … … 131 131 132 132 /********************************************************************************** 133 * This function displays a 32 bits value in hexadecimal on TXT0 terminal.133 * This debug function displays a 32 bits value in hexadecimal on TXT0 terminal. 134 134 * This function is actually used to debug the assembly level kernel functions. 135 135 ********************************************************************************** … … 139 139 140 140 /********************************************************************************** 141 * This function displays a 32 bits signed value in decimal on TXT0 terminal.141 * This debug function displays a 32 bits signed value in decimal on TXT0 terminal. 142 142 * This function is actually used to debug the assembly level kernel functions. 143 143 ********************************************************************************** … … 147 147 148 148 /********************************************************************************** 149 * This function displays a 64 bits value in hexadecimal on TXT0 terminal.149 * This debug function displays a 64 bits value in hexadecimal on TXT0 terminal. 150 150 * This function is actually used to debug the assembly level kernel functions. 151 151 ********************************************************************************** … … 158 158 * array of bytes defined by <buffer> and <size> arguments (16 bytes per line). 159 159 * The <string> argument is displayed before the buffer content. 160 * The line format is an address fol owed by 16 (hexa) bytes.160 * The line format is an address followed by 16 (hexa) bytes. 161 161 ********************************************************************************** 162 162 * @ string : buffer name or identifier. -
trunk/kernel/kern/process.c
r651 r657 4 4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016,2017,2018,2019 )6 * Alain Greiner (2016,2017,2018,2019,2020) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites … … 1103 1103 xptr_t xp; 1104 1104 1105 // get referenceprocess cluster and local pointer1105 // get target process cluster and local pointer 1106 1106 process_t * process_ptr = GET_PTR( process_xp ); 1107 1107 cxy_t process_cxy = GET_CXY( process_xp ); 1108 1108 1109 // check client process is reference process1109 // check target process is reference process 1110 1110 assert( (process_xp == hal_remote_l64( XPTR( process_cxy , &process_ptr->ref_xp ) ) ), 1111 1111 "client process must be reference process\n" ); … … 1158 1158 1159 1159 } // end process_fd_register() 1160 1161 ///////////////////////////////////////////// 1162 void process_fd_remove( xptr_t process_xp, 1163 uint32_t fdid ) 1164 { 1165 pid_t pid; // target process PID 1166 lpid_t lpid; // target process LPID 1167 xptr_t iter_xp; // iterator for list of process copies 1168 xptr_t copy_xp; // extended pointer on process copy 1169 process_t * copy_ptr; // local pointer on process copy 1170 cxy_t copy_cxy; // process copy cluster identifier 1171 1172 // check process_xp argument 1173 assert( (process_xp != XPTR_NULL), "process_xp argument cannot be XPTR_NULL"); 1174 1175 // get target process cluster and local pointer 1176 process_t * process_ptr = GET_PTR( process_xp ); 1177 cxy_t process_cxy = GET_CXY( process_xp ); 1178 1179 // get target process pid and lpid 1180 pid = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid) ); 1181 lpid = LPID_FROM_PID( pid ); 1182 1183 // get process descriptor in owner cluster and in reference cluster 1184 xptr_t owner_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->owner_xp )); 1185 xptr_t ref_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->ref_xp )); 1186 1187 // check target process in in owner cluster 1188 assert( (process_xp == owner_xp), "target process must be in owner process\n" ); 1189 1190 #if DEBUG_PROCESS_FD_REMOVE 1191 uint32_t cycle = (uint32_t)hal_get_cycles(); 1192 thread_t * this = CURRENT_THREAD; 1193 if( DEBUG_PROCESS_FD_REMOVE < cycle ) 1194 printk("\n[%s] thread[%x,%x] enter for fdid %d in process %x / cycle %d\n", 1195 __FUNCTION__, this->process->pid, this->trdid, fdid, pid, cycle ); 1196 #endif 1197 1198 // build extended pointers on list_of_copies root and lock (in owner cluster) 1199 xptr_t copies_root_xp = XPTR( process_cxy , &LOCAL_CLUSTER->pmgr.copies_root[lpid] ); 1200 xptr_t copies_lock_xp = XPTR( process_cxy , &LOCAL_CLUSTER->pmgr.copies_lock[lpid] ); 1201 1202 // get reference process cluster and local pointer 1203 process_t * ref_ptr = GET_PTR( ref_xp ); 1204 cxy_t ref_cxy = GET_CXY( ref_xp ); 1205 1206 // build extended pointer on lock protecting reference fd_array 1207 xptr_t fd_lock_xp = XPTR( ref_cxy , &ref_ptr->fd_array.lock ); 1208 1209 // take lock protecting reference fd_array 1210 remote_queuelock_acquire( fd_lock_xp ); 1211 1212 // take the lock protecting the list of copies 1213 remote_queuelock_acquire( copies_lock_xp ); 1214 1215 // loop on list of process copies 1216 XLIST_FOREACH( copies_root_xp , iter_xp ) 1217 { 1218 // get pointers on process copy 1219 copy_xp = XLIST_ELEMENT( iter_xp , process_t , copies_list ); 1220 copy_ptr = GET_PTR( copy_xp ); 1221 copy_cxy = GET_CXY( copy_xp ); 1222 1223 // release the fd_array entry in process copy 1224 hal_remote_s64( XPTR( copy_cxy , ©_ptr->fd_array.array[fdid] ), XPTR_NULL ); 1225 } 1226 1227 // release the lock protecting reference fd_array 1228 remote_queuelock_release( fd_lock_xp ); 1229 1230 // release the lock protecting the list of copies 1231 remote_queuelock_release( copies_lock_xp ); 1232 1233 #if DEBUG_PROCESS_FD_REMOVE 1234 cycle = (uint32_t)hal_get_cycles(); 1235 if( DEBUG_PROCESS_FD_REMOVE < cycle ) 1236 printk("\n[%s] thread[%x,%x] exit for fdid %d in process %x / cycle %d\n", 1237 __FUNCTION__, this->process->pid, this->trdid, fdid, pid, cycle ); 1238 #endif 1239 1240 } // end process_fd_remove() 1160 1241 1161 1242 //////////////////////////////////////////////// -
trunk/kernel/kern/process.h
r651 r657 4 4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016,2017,2018,2019 )6 * Alain Greiner (2016,2017,2018,2019,2020) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites … … 70 70 /********************************************************************************************* 71 71 * This structure defines an array of extended pointers on the open file descriptors 72 * for a given process. We use an extended pointer because the open file descriptor 73 * isalways stored in the same cluster as the inode associated to the file.72 * for a given process. We use an extended pointer because the open file descriptors 73 * are always stored in the same cluster as the inode associated to the file. 74 74 * A free entry in this array contains the XPTR_NULL value. 75 75 * The array size is defined by the CONFIG_PROCESS_FILE_MAX_NR parameter. … … 79 79 * - the fd_array[] in a process copy is simply a cache containing a subset of the 80 80 * open files to speed the fdid to xptr translation, but the "lock" and "current 81 * fields are not used. 82 * - all modifications made by the process_fd_remove() are done in reference cluster 83 * and reported in all process_copies. 81 * fields are not significant for these copies. 82 * - the modifications made by the process_fd_remove() function are done in the 83 * reference cluster in all process_copies. 84 * - The modifications made by the process_fd_register() function are done in the 85 * reference cluster, and in the cluster containing the calling thread. 84 86 ********************************************************************************************/ 85 87 … … 436 438 437 439 /********************************************************************************************* 438 * This function allocates a free slot in the fd_array of the reference process 440 * This function allocates a free slot in the fd_array of the reference process descriptor 439 441 * identified by the <process_xp> argument, register the <file_xp> argument in the 440 442 * allocated slot, and return the slot index in the <fdid> buffer. 441 * It can be called by any thread in any cluster, because it uses remote access442 * primitives to access the reference process descriptor.443 * Note: we must use the reference process descriptor, because the reference fd_array is 444 * contained in the reference cluster. It can be called by any thread in any cluster. 443 445 * It takes the lock protecting the reference fd_array against concurrent accesses. 444 446 ********************************************************************************************* … … 454 456 /********************************************************************************************* 455 457 * This function uses as many remote accesses as required, to reset an entry in fd_array[], 456 * in all clusters containing a copy. The entry is identified by the <fdid> argument. 457 * This function must be executed by a thread running in reference cluster, that contains 458 * the complete list of process descriptors copies. 458 * identified by the <fdid> argument, in all clusters containing a copy of the 459 * process descriptor, identified by the <process_xp> argument. 460 * Note: we must use the owner process descriptor, because only this owner cluster contains 461 * the list of process copies. It can be called by any thread in any cluster. 459 462 * It takes the lock protecting the reference fd_array against concurrent accesses. 460 * TODO this function is not implemented yet.461 463 ********************************************************************************************* 462 464 * @ process : [in] pointer on the local process descriptor. 463 465 * @ fdid : [in] file descriptor index in the fd_array. 464 466 ********************************************************************************************/ 465 void process_fd_remove( process_t * process,466 uint32_t 467 void process_fd_remove( xptr_t process_xp, 468 uint32_t fdid ); 467 469 468 470 /********************************************************************************************* -
trunk/kernel/kern/rpc.c
r641 r657 2 2 * rpc.c - RPC operations implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 59 59 &rpc_thread_user_create_server, // 6 60 60 &rpc_thread_kernel_create_server, // 7 61 &rpc_ vfs_fs_update_dentry_server,// 861 &rpc_undefined, // 8 62 62 &rpc_process_sigaction_server, // 9 63 63 64 &rpc_vfs_inode_create_server, // 10 65 &rpc_vfs_inode_destroy_server, // 11 66 &rpc_vfs_dentry_create_server, // 12 67 &rpc_vfs_dentry_destroy_server, // 13 68 &rpc_vfs_file_create_server, // 14 69 &rpc_vfs_file_destroy_server, // 15 70 &rpc_vfs_fs_new_dentry_server, // 16 71 &rpc_vfs_fs_add_dentry_server, // 17 72 &rpc_vfs_fs_remove_dentry_server, // 18 73 &rpc_vfs_inode_load_all_pages_server, // 19 74 75 &rpc_undefined, // 20 76 &rpc_undefined, // 21 77 &rpc_undefined, // 22 78 &rpc_undefined, // 23 79 &rpc_mapper_sync_server, // 24 80 &rpc_vmm_resize_vseg_server, // 25 81 &rpc_vmm_remove_vseg_server, // 26 82 &rpc_vmm_create_vseg_server, // 27 83 &rpc_vmm_set_cow_server, // 28 84 &rpc_undefined, // 29 64 &rpc_undefined, // 10 65 &rpc_undefined, // 11 66 &rpc_undefined, // 12 67 &rpc_undefined, // 13 68 &rpc_undefined, // 14 69 &rpc_vmm_resize_vseg_server, // 15 70 &rpc_vmm_remove_vseg_server, // 16 71 &rpc_vmm_create_vseg_server, // 17 72 &rpc_vmm_set_cow_server, // 18 73 &rpc_undefined, // 19 85 74 }; 86 75 … … 95 84 "THREAD_USER_CREATE", // 6 96 85 "THREAD_KERNEL_CREATE", // 7 97 " VFS_FS_UPDATE_DENTRY",// 886 "FBF_DISPLAY", // 8 98 87 "PROCESS_SIGACTION", // 9 99 88 100 "VFS_INODE_CREATE", // 10 101 "VFS_INODE_DESTROY", // 11 102 "VFS_DENTRY_CREATE", // 12 103 "VFS_DENTRY_DESTROY", // 13 104 "VFS_FILE_CREATE", // 14 105 "VFS_FILE_DESTROY", // 15 106 "VFS_FS_NEW_DENTRY", // 16 107 "VFS_FS_ADD_DENTRY", // 17 108 "VFS_FS_REMOVE_DENTRY", // 18 109 "VFS_INODE_LOAD_ALL_PAGES", // 19 110 111 "VMM_GLOBAL_RESIZE_VSEG", // 20 112 "VMM_GLOBAL_UPDATE_PTE", // 21 113 "undefined_22", // 22 114 "undefined_23", // 23 115 "MAPPER_SYNC", // 24 116 "undefined_25", // 25 117 "VMM_REMOVE_VSEG", // 26 118 "VMM_CREATE_VSEG", // 27 119 "VMM_SET_COW", // 28 120 "undefined_29", // 29 89 "undefined_10", // 10 90 "undefined_11", // 11 91 "undefined_12", // 12 92 "undefined_13", // 13 93 "undefined_14", // 14 94 "VMM_RESIZE_VSEG", // 15 95 "VMM_REMOVE_VSEG", // 16 96 "VMM_CREATE_VSEG", // 17 97 "VMM_SET_COW", // 18 98 "undefined_19", // 19 121 99 }; 122 100 … … 423 401 424 402 425 ///////////////////////////////////////////////////////////////////////////////////////// 426 // [0] RPC_PMEM_GET_PAGES deprecated [AG] May 2019 427 ///////////////////////////////////////////////////////////////////////////////////////// 428 429 /* 430 /////////////////////////////////////////////// 431 void rpc_pmem_get_pages_client( cxy_t cxy, 432 uint32_t order, // in 433 page_t ** page ) // out 434 { 435 #if DEBUG_RPC_PMEM_GET_PAGES 436 thread_t * this = CURRENT_THREAD; 437 uint32_t cycle = (uint32_t)hal_get_cycles(); 438 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 439 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 440 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 441 #endif 442 443 uint32_t responses = 1; 444 445 // initialise RPC descriptor header 446 rpc_desc_t rpc; 447 rpc.index = RPC_PMEM_GET_PAGES; 448 rpc.blocking = true; 449 rpc.rsp = &responses; 450 451 // set input arguments in RPC descriptor 452 rpc.args[0] = (uint64_t)order; 453 454 // register RPC request in remote RPC fifo 455 rpc_send( cxy , &rpc ); 456 457 // get output arguments from RPC descriptor 458 *page = (page_t *)(intptr_t)rpc.args[1]; 459 460 #if DEBUG_RPC_PMEM_GET_PAGES 461 cycle = (uint32_t)hal_get_cycles(); 462 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 463 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 464 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 465 #endif 466 } 467 468 /////////////////////////////////////////// 469 void rpc_pmem_get_pages_server( xptr_t xp ) 470 { 471 #if DEBUG_RPC_PMEM_GET_PAGES 472 thread_t * this = CURRENT_THREAD; 473 uint32_t cycle = (uint32_t)hal_get_cycles(); 474 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 475 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 476 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 477 #endif 478 479 // get client cluster identifier and pointer on RPC descriptor 480 cxy_t cxy = GET_CXY( xp ); 481 rpc_desc_t * desc = GET_PTR( xp ); 482 483 // get input arguments from client RPC descriptor 484 uint32_t order = (uint32_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) ); 485 486 // call local pmem allocator 487 page_t * page = ppm_alloc_pages( order ); 488 489 // set output arguments into client RPC descriptor 490 hal_remote_s64( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); 491 492 #if DEBUG_RPC_PMEM_GET_PAGES 493 cycle = (uint32_t)hal_get_cycles(); 494 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 495 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 496 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 497 #endif 498 } 499 */ 500 501 ///////////////////////////////////////////////////////////////////////////////////////// 502 // [1] RPC_PMEM_RELEASE_PAGES deprecated [AG] may 2019 503 ///////////////////////////////////////////////////////////////////////////////////////// 504 505 /* 506 ////////////////////////////////////////////////// 507 void rpc_pmem_release_pages_client( cxy_t cxy, 508 page_t * page ) // out 509 { 510 #if DEBUG_RPC_PMEM_RELEASE_PAGES 511 thread_t * this = CURRENT_THREAD; 512 uint32_t cycle = (uint32_t)hal_get_cycles(); 513 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 514 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 515 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 516 #endif 517 518 uint32_t responses = 1; 519 520 // initialise RPC descriptor header 521 rpc_desc_t rpc; 522 rpc.index = RPC_PMEM_RELEASE_PAGES; 523 rpc.blocking = true; 524 rpc.rsp = &responses; 525 526 // set input arguments in RPC descriptor 527 rpc.args[0] = (uint64_t)(intptr_t)page; 528 529 // register RPC request in remote RPC fifo 530 rpc_send( cxy , &rpc ); 531 532 #if DEBUG_RPC_PMEM_RELEASE_PAGES 533 cycle = (uint32_t)hal_get_cycles(); 534 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 535 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 536 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 537 #endif 538 } 539 540 /////////////////////////////////////////////// 541 void rpc_pmem_release_pages_server( xptr_t xp ) 542 { 543 #if DEBUG_RPC_PMEM_RELEASE_PAGES 544 thread_t * this = CURRENT_THREAD; 545 uint32_t cycle = (uint32_t)hal_get_cycles(); 546 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 547 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 548 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 549 #endif 550 551 // get client cluster identifier and pointer on RPC descriptor 552 cxy_t cxy = GET_CXY( xp ); 553 rpc_desc_t * desc = GET_PTR( xp ); 554 555 // get input arguments from client RPC descriptor 556 page_t * page = (page_t *)(intptr_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) ); 557 558 // release memory to local pmem 559 kmem_req_t req; 560 req.type = KMEM_PPM; 561 req.ptr = page; 562 kmem_free( &req ); 563 564 #if DEBUG_RPC_PMEM_RELEASE_PAGES 565 cycle = (uint32_t)hal_get_cycles(); 566 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 567 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 568 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 569 #endif 570 } 571 */ 572 573 ///////////////////////////////////////////////////////////////////////////////////////// 574 // [2] RPC_PPM_DISPLAY deprecated [AG] May 2019 575 ///////////////////////////////////////////////////////////////////////////////////////// 576 577 /* 578 ///////////////////////////////////////// 579 void rpc_ppm_display_client( cxy_t cxy ) 580 { 581 #if DEBUG_RPC_PPM_DISPLAY 582 thread_t * this = CURRENT_THREAD; 583 uint32_t cycle = (uint32_t)hal_get_cycles(); 584 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 585 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 586 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 587 #endif 588 589 uint32_t responses = 1; 590 591 // initialise RPC descriptor header 592 rpc_desc_t rpc; 593 rpc.index = RPC_PPM_DISPLAY; 594 rpc.blocking = true; 595 rpc.rsp = &responses; 596 597 // register RPC request in remote RPC fifo 598 rpc_send( cxy , &rpc ); 599 600 #if DEBUG_RPC_PPM_DISPLAY 601 cycle = (uint32_t)hal_get_cycles(); 602 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 603 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 604 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 605 #endif 606 } 607 608 //////////////////////////////////////////////////////////////////// 609 void rpc_ppm_display_server( xptr_t __attribute__((__unused__)) xp ) 610 { 611 #if DEBUG_RPC_PPM_DISPLAY 612 thread_t * this = CURRENT_THREAD; 613 uint32_t cycle = (uint32_t)hal_get_cycles(); 614 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 615 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 616 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 617 #endif 618 619 // call local kernel function 620 ppm_display(); 621 622 #if DEBUG_RPC_PPM_DISPLAY 623 cycle = (uint32_t)hal_get_cycles(); 624 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 625 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 626 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 627 #endif 628 } 629 */ 630 631 ///////////////////////////////////////////////////////////////////////////////////////// 632 // [3] Marshaling functions attached to RPC_PROCESS_MAKE_FORK 403 /***************************************************************************************/ 404 /************ Marshaling functions ordered by increasing index *************************/ 405 /***************************************************************************************/ 406 407 408 ///////////////////////////////////////////////////////////////////////////////////////// 409 // [0] undefined 410 ///////////////////////////////////////////////////////////////////////////////////////// 411 412 ///////////////////////////////////////////////////////////////////////////////////////// 413 // [1] undefined 414 ///////////////////////////////////////////////////////////////////////////////////////// 415 416 ///////////////////////////////////////////////////////////////////////////////////////// 417 // [2] undefined 418 ///////////////////////////////////////////////////////////////////////////////////////// 419 420 421 ///////////////////////////////////////////////////////////////////////////////////////// 422 // [3] Marshaling function attached to RPC_MAKE_FORK 633 423 ///////////////////////////////////////////////////////////////////////////////////////// 634 424 … … 1073 863 1074 864 ///////////////////////////////////////////////////////////////////////////////////////// 1075 // [8] Marshaling functions attached to RPC_VFS_FS_UPDATE_DENTRY 1076 ///////////////////////////////////////////////////////////////////////////////////////// 1077 1078 ///////////////////////////////////////////////////////// 1079 void rpc_vfs_fs_update_dentry_client( cxy_t cxy, 1080 vfs_inode_t * inode, 1081 vfs_dentry_t * dentry, 1082 uint32_t size, 1083 error_t * error ) 1084 { 1085 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1086 thread_t * this = CURRENT_THREAD; 1087 uint32_t cycle = (uint32_t)hal_get_cycles(); 1088 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1089 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1090 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1091 #endif 1092 1093 uint32_t responses = 1; 1094 1095 // initialise RPC descriptor header 1096 rpc_desc_t rpc; 1097 rpc.index = RPC_VFS_FS_UPDATE_DENTRY; 1098 rpc.blocking = true; 1099 rpc.rsp = &responses; 1100 1101 // set input arguments in RPC descriptor 1102 rpc.args[0] = (uint64_t)(intptr_t)inode; 1103 rpc.args[1] = (uint64_t)(intptr_t)dentry; 1104 rpc.args[2] = (uint64_t)size; 1105 1106 // register RPC request in remote RPC fifo 1107 rpc_send( cxy , &rpc ); 1108 1109 // get output values from RPC descriptor 1110 *error = (error_t)rpc.args[3]; 1111 1112 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1113 cycle = (uint32_t)hal_get_cycles(); 1114 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1115 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1116 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1117 #endif 1118 } 1119 1120 ///////////////////////////////////////////////// 1121 void rpc_vfs_fs_update_dentry_server( xptr_t xp ) 1122 { 1123 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1124 thread_t * this = CURRENT_THREAD; 1125 uint32_t cycle = (uint32_t)hal_get_cycles(); 1126 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1127 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1128 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1129 #endif 1130 1131 error_t error; 1132 vfs_inode_t * inode; 1133 vfs_dentry_t * dentry; 1134 uint32_t size; 1135 1136 // get client cluster identifier and pointer on RPC descriptor 1137 cxy_t client_cxy = GET_CXY( xp ); 1138 rpc_desc_t * desc = GET_PTR( xp ); 1139 1140 // get input arguments 1141 inode = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 1142 dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 1143 size = (uint32_t) hal_remote_l64(XPTR(client_cxy , &desc->args[2])); 1144 1145 // call the kernel function 1146 error = vfs_fs_update_dentry( inode , dentry , size ); 1147 1148 // set output argument 1149 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1150 1151 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1152 cycle = (uint32_t)hal_get_cycles(); 1153 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1154 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1155 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1156 #endif 1157 } 865 // [8] undefined 866 ///////////////////////////////////////////////////////////////////////////////////////// 1158 867 1159 868 ///////////////////////////////////////////////////////////////////////////////////////// … … 1197 906 process_action_str( action ), pid, cycle ); 1198 907 #endif 1199 } // end rpc_process_sigaction_client()908 } 1200 909 1201 910 ////////////////////////////////////////////// … … 1241 950 process_action_str( action ), pid, cycle ); 1242 951 #endif 1243 } // end rpc_process_sigaction_server() 1244 1245 ///////////////////////////////////////////////////////////////////////////////////////// 1246 // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE 1247 ///////////////////////////////////////////////////////////////////////////////////////// 1248 1249 ///////////////////////////////////////////////////// 1250 void rpc_vfs_inode_create_client( cxy_t cxy, 1251 uint32_t fs_type, // in 1252 uint32_t attr, // in 1253 uint32_t rights, // in 1254 uint32_t uid, // in 1255 uint32_t gid, // in 1256 xptr_t * inode_xp, // out 1257 error_t * error ) // out 1258 { 1259 #if DEBUG_RPC_VFS_INODE_CREATE 1260 thread_t * this = CURRENT_THREAD; 1261 uint32_t cycle = (uint32_t)hal_get_cycles(); 1262 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1263 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1264 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1265 #endif 1266 1267 uint32_t responses = 1; 1268 1269 // initialise RPC descriptor header 1270 rpc_desc_t rpc; 1271 rpc.index = RPC_VFS_INODE_CREATE; 1272 rpc.blocking = true; 1273 rpc.rsp = &responses; 1274 1275 // set input arguments in RPC descriptor 1276 rpc.args[0] = (uint64_t)fs_type; 1277 rpc.args[1] = (uint64_t)attr; 1278 rpc.args[2] = (uint64_t)rights; 1279 rpc.args[3] = (uint64_t)uid; 1280 rpc.args[4] = (uint64_t)gid; 1281 1282 // register RPC request in remote RPC fifo 1283 rpc_send( cxy , &rpc ); 1284 1285 // get output values from RPC descriptor 1286 *inode_xp = (xptr_t)rpc.args[5]; 1287 *error = (error_t)rpc.args[6]; 1288 1289 #if DEBUG_RPC_VFS_INODE_CREATE 1290 cycle = (uint32_t)hal_get_cycles(); 1291 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1292 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1293 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1294 #endif 1295 } 1296 1297 ///////////////////////////////////////////// 1298 void rpc_vfs_inode_create_server( xptr_t xp ) 1299 { 1300 #if DEBUG_RPC_VFS_INODE_CREATE 1301 thread_t * this = CURRENT_THREAD; 1302 uint32_t cycle = (uint32_t)hal_get_cycles(); 1303 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1304 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1305 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1306 #endif 1307 1308 uint32_t fs_type; 1309 uint32_t attr; 1310 uint32_t rights; 1311 uint32_t uid; 1312 uint32_t gid; 1313 xptr_t inode_xp; 1314 error_t error; 1315 1316 // get client cluster identifier and pointer on RPC descriptor 1317 cxy_t client_cxy = GET_CXY( xp ); 1318 rpc_desc_t * desc = GET_PTR( xp ); 1319 1320 // get input arguments from client rpc descriptor 1321 fs_type = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1322 attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 1323 rights = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); 1324 uid = (uid_t) hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) ); 1325 gid = (gid_t) hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) ); 1326 1327 // call local kernel function 1328 error = vfs_inode_create( fs_type, 1329 attr, 1330 rights, 1331 uid, 1332 gid, 1333 &inode_xp ); 1334 1335 // set output arguments 1336 hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)inode_xp ); 1337 hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error ); 1338 1339 #if DEBUG_RPC_VFS_INODE_CREATE 1340 cycle = (uint32_t)hal_get_cycles(); 1341 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1342 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1343 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1344 #endif 1345 } 1346 1347 ///////////////////////////////////////////////////////////////////////////////////////// 1348 // [11] Marshaling functions attached to RPC_VFS_INODE_DESTROY 1349 ///////////////////////////////////////////////////////////////////////////////////////// 1350 1351 ///////////////////////////////////////////////////////////// 1352 void rpc_vfs_inode_destroy_client( cxy_t cxy, 1353 struct vfs_inode_s * inode ) 1354 { 1355 #if DEBUG_RPC_VFS_INODE_DESTROY 1356 thread_t * this = CURRENT_THREAD; 1357 uint32_t cycle = (uint32_t)hal_get_cycles(); 1358 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1359 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1360 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1361 #endif 1362 1363 uint32_t responses = 1; 1364 1365 // initialise RPC descriptor header 1366 rpc_desc_t rpc; 1367 rpc.index = RPC_VFS_INODE_DESTROY; 1368 rpc.blocking = true; 1369 rpc.rsp = &responses; 1370 1371 // set input arguments in RPC descriptor 1372 rpc.args[0] = (uint64_t)(intptr_t)inode; 1373 1374 // register RPC request in remote RPC fifo 1375 rpc_send( cxy , &rpc ); 1376 1377 #if DEBUG_RPC_VFS_INODE_DESTROY 1378 cycle = (uint32_t)hal_get_cycles(); 1379 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1380 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1381 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1382 #endif 1383 } 1384 1385 ////////////////////////////////////////////// 1386 void rpc_vfs_inode_destroy_server( xptr_t xp ) 1387 { 1388 #if DEBUG_RPC_VFS_INODE_DESTROY 1389 thread_t * this = CURRENT_THREAD; 1390 uint32_t cycle = (uint32_t)hal_get_cycles(); 1391 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1392 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1393 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1394 #endif 1395 1396 vfs_inode_t * inode; 1397 1398 // get client cluster identifier and pointer on RPC descriptor 1399 cxy_t client_cxy = GET_CXY( xp ); 1400 rpc_desc_t * desc = GET_PTR( xp ); 1401 1402 // get argument "inode" from client RPC descriptor 1403 inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1404 1405 // call local kernel function 1406 vfs_inode_destroy( inode ); 1407 1408 #if DEBUG_RPC_VFS_INODE_DESTROY 1409 cycle = (uint32_t)hal_get_cycles(); 1410 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1411 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1412 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1413 #endif 1414 } 1415 1416 ///////////////////////////////////////////////////////////////////////////////////////// 1417 // [12] Marshaling functions attached to RPC_VFS_DENTRY_CREATE 1418 ///////////////////////////////////////////////////////////////////////////////////////// 1419 1420 ////////////////////////////////////////////////////////////// 1421 void rpc_vfs_dentry_create_client( cxy_t cxy, 1422 uint32_t type, // in 1423 char * name, // in 1424 xptr_t * dentry_xp, // out 1425 error_t * error ) // out 1426 { 1427 #if DEBUG_RPC_VFS_DENTRY_CREATE 1428 thread_t * this = CURRENT_THREAD; 1429 uint32_t cycle = (uint32_t)hal_get_cycles(); 1430 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1431 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1432 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1433 #endif 1434 1435 uint32_t responses = 1; 1436 1437 // initialise RPC descriptor header 1438 rpc_desc_t rpc; 1439 rpc.index = RPC_VFS_DENTRY_CREATE; 1440 rpc.blocking = true; 1441 rpc.rsp = &responses; 1442 1443 // set input arguments in RPC descriptor 1444 rpc.args[0] = (uint64_t)type; 1445 rpc.args[1] = (uint64_t)(intptr_t)name; 1446 1447 // register RPC request in remote RPC fifo 1448 rpc_send( cxy , &rpc ); 1449 1450 // get output values from RPC descriptor 1451 *dentry_xp = (xptr_t)rpc.args[2]; 1452 *error = (error_t)rpc.args[3]; 1453 1454 #if DEBUG_RPC_VFS_DENTRY_CREATE 1455 cycle = (uint32_t)hal_get_cycles(); 1456 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1457 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1458 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1459 #endif 1460 } 1461 1462 ////////////////////////////////////////////// 1463 void rpc_vfs_dentry_create_server( xptr_t xp ) 1464 { 1465 #if DEBUG_RPC_VFS_DENTRY_CREATE 1466 thread_t * this = CURRENT_THREAD; 1467 uint32_t cycle = (uint32_t)hal_get_cycles(); 1468 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1469 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1470 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1471 #endif 1472 1473 uint32_t type; 1474 char * name; 1475 xptr_t dentry_xp; 1476 error_t error; 1477 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 1478 1479 // get client cluster identifier and pointer on RPC descriptor 1480 cxy_t client_cxy = GET_CXY( xp ); 1481 rpc_desc_t * desc = GET_PTR( xp ); 1482 1483 // get arguments "name", "type", and "parent" from client RPC descriptor 1484 type = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1485 name = (char *)(intptr_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 1486 1487 // makes a local copy of name 1488 hal_remote_strcpy( XPTR( local_cxy , name_copy ), 1489 XPTR( client_cxy , name ) ); 1490 1491 // call local kernel function 1492 error = vfs_dentry_create( type, 1493 name_copy, 1494 &dentry_xp ); 1495 // set output arguments 1496 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)dentry_xp ); 1497 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1498 1499 #if DEBUG_RPC_VFS_DENTRY_CREATE 1500 cycle = (uint32_t)hal_get_cycles(); 1501 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1502 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1503 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1504 #endif 1505 } 1506 1507 ///////////////////////////////////////////////////////////////////////////////////////// 1508 // [13] Marshaling functions attached to RPC_VFS_DENTRY_DESTROY 1509 ///////////////////////////////////////////////////////////////////////////////////////// 1510 1511 /////////////////////////////////////////////////////// 1512 void rpc_vfs_dentry_destroy_client( cxy_t cxy, 1513 vfs_dentry_t * dentry ) 1514 { 1515 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1516 thread_t * this = CURRENT_THREAD; 1517 uint32_t cycle = (uint32_t)hal_get_cycles(); 1518 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1519 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1520 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1521 #endif 1522 1523 uint32_t responses = 1; 1524 1525 // initialise RPC descriptor header 1526 rpc_desc_t rpc; 1527 rpc.index = RPC_VFS_DENTRY_DESTROY; 1528 rpc.blocking = true; 1529 rpc.rsp = &responses; 1530 1531 // set input arguments in RPC descriptor 1532 rpc.args[0] = (uint64_t)(intptr_t)dentry; 1533 1534 // register RPC request in remote RPC fifo 1535 rpc_send( cxy , &rpc ); 1536 1537 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1538 cycle = (uint32_t)hal_get_cycles(); 1539 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1540 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1541 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1542 #endif 1543 } 1544 1545 /////////////////////////////////////////////// 1546 void rpc_vfs_dentry_destroy_server( xptr_t xp ) 1547 { 1548 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1549 thread_t * this = CURRENT_THREAD; 1550 uint32_t cycle = (uint32_t)hal_get_cycles(); 1551 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1552 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1553 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1554 #endif 1555 1556 vfs_dentry_t * dentry; 1557 1558 // get client cluster identifier and pointer on RPC descriptor 1559 cxy_t client_cxy = GET_CXY( xp ); 1560 rpc_desc_t * desc = GET_PTR( xp ); 1561 1562 // get arguments "dentry" from client RPC descriptor 1563 dentry = (vfs_dentry_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1564 1565 // call local kernel function 1566 vfs_dentry_destroy( dentry ); 1567 1568 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1569 cycle = (uint32_t)hal_get_cycles(); 1570 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1571 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1572 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1573 #endif 1574 } 1575 1576 1577 ///////////////////////////////////////////////////////////////////////////////////////// 1578 // [14] Marshaling functions attached to RPC_VFS_FILE_CREATE 1579 ///////////////////////////////////////////////////////////////////////////////////////// 1580 1581 ////////////////////////////////////////////////////////////// 1582 void rpc_vfs_file_create_client( cxy_t cxy, 1583 struct vfs_inode_s * inode, // in 1584 uint32_t file_attr, // in 1585 xptr_t * file_xp, // out 1586 error_t * error ) // out 1587 { 1588 #if DEBUG_RPC_VFS_FILE_CREATE 1589 thread_t * this = CURRENT_THREAD; 1590 uint32_t cycle = (uint32_t)hal_get_cycles(); 1591 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1592 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1593 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1594 #endif 1595 1596 uint32_t responses = 1; 1597 1598 // initialise RPC descriptor header 1599 rpc_desc_t rpc; 1600 rpc.index = RPC_VFS_FILE_CREATE; 1601 rpc.blocking = true; 1602 rpc.rsp = &responses; 1603 1604 // set input arguments in RPC descriptor 1605 rpc.args[0] = (uint64_t)(intptr_t)inode; 1606 rpc.args[1] = (uint64_t)file_attr; 1607 1608 // register RPC request in remote RPC fifo 1609 rpc_send( cxy , &rpc ); 1610 1611 // get output values from RPC descriptor 1612 *file_xp = (xptr_t)rpc.args[2]; 1613 *error = (error_t)rpc.args[3]; 1614 1615 #if DEBUG_RPC_VFS_FILE_CREATE 1616 cycle = (uint32_t)hal_get_cycles(); 1617 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1618 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1619 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1620 #endif 1621 } 1622 1623 //////////////////////////////////////////// 1624 void rpc_vfs_file_create_server( xptr_t xp ) 1625 { 1626 #if DEBUG_RPC_VFS_FILE_CREATE 1627 thread_t * this = CURRENT_THREAD; 1628 uint32_t cycle = (uint32_t)hal_get_cycles(); 1629 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1630 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1631 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1632 #endif 1633 1634 uint32_t file_attr; 1635 vfs_inode_t * inode; 1636 xptr_t file_xp; 1637 error_t error; 1638 1639 // get client cluster identifier and pointer on RPC descriptor 1640 cxy_t client_cxy = GET_CXY( xp ); 1641 rpc_desc_t * desc = GET_PTR( xp ); 1642 1643 // get arguments "file_attr" and "inode" from client RPC descriptor 1644 inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1645 file_attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 1646 1647 // call local kernel function 1648 error = vfs_file_create( inode, 1649 file_attr, 1650 &file_xp ); 1651 1652 // set output arguments 1653 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp ); 1654 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1655 1656 #if DEBUG_RPC_VFS_FILE_CREATE 1657 cycle = (uint32_t)hal_get_cycles(); 1658 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1659 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1660 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1661 #endif 1662 } 1663 1664 ///////////////////////////////////////////////////////////////////////////////////////// 1665 // [15] Marshaling functions attached to RPC_VFS_FILE_DESTROY 1666 ///////////////////////////////////////////////////////////////////////////////////////// 1667 1668 /////////////////////////////////////////////////// 1669 void rpc_vfs_file_destroy_client( cxy_t cxy, 1670 vfs_file_t * file ) 1671 { 1672 #if DEBUG_RPC_VFS_FILE_DESTROY 1673 thread_t * this = CURRENT_THREAD; 1674 uint32_t cycle = (uint32_t)hal_get_cycles(); 1675 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 1676 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1677 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1678 #endif 1679 1680 uint32_t responses = 1; 1681 1682 // initialise RPC descriptor header 1683 rpc_desc_t rpc; 1684 rpc.index = RPC_VFS_FILE_DESTROY; 1685 rpc.blocking = true; 1686 rpc.rsp = &responses; 1687 1688 // set input arguments in RPC descriptor 1689 rpc.args[0] = (uint64_t)(intptr_t)file; 1690 1691 // register RPC request in remote RPC fifo 1692 rpc_send( cxy , &rpc ); 1693 1694 #if DEBUG_RPC_VFS_FILE_DESTROY 1695 cycle = (uint32_t)hal_get_cycles(); 1696 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 1697 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1698 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1699 #endif 1700 } 1701 1702 ///////////////////////////////////////////// 1703 void rpc_vfs_file_destroy_server( xptr_t xp ) 1704 { 1705 #if DEBUG_RPC_VFS_FILE_DESTROY 1706 thread_t * this = CURRENT_THREAD; 1707 uint32_t cycle = (uint32_t)hal_get_cycles(); 1708 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 1709 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1710 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1711 #endif 1712 1713 vfs_file_t * file; 1714 1715 // get client cluster identifier and pointer on RPC descriptor 1716 cxy_t client_cxy = GET_CXY( xp ); 1717 rpc_desc_t * desc = GET_PTR( xp ); 1718 1719 // get arguments "dentry" from client RPC descriptor 1720 file = (vfs_file_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1721 1722 // call local kernel function 1723 vfs_file_destroy( file ); 1724 1725 #if DEBUG_RPC_VFS_FILE_DESTROY 1726 cycle = (uint32_t)hal_get_cycles(); 1727 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 1728 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1729 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1730 #endif 1731 } 1732 1733 ///////////////////////////////////////////////////////////////////////////////////////// 1734 // [16] Marshaling functions attached to RPC_VFS_FS_GET_DENTRY 1735 ///////////////////////////////////////////////////////////////////////////////////////// 1736 1737 ///////////////////////////////////////////////////////// 1738 void rpc_vfs_fs_new_dentry_client( cxy_t cxy, 1739 vfs_inode_t * parent_inode, // in 1740 char * name, // in 1741 xptr_t child_inode_xp, // in 1742 error_t * error ) // out 1743 { 1744 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 1745 thread_t * this = CURRENT_THREAD; 1746 uint32_t cycle = (uint32_t)hal_get_cycles(); 1747 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 1748 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1749 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1750 #endif 1751 1752 uint32_t responses = 1; 1753 1754 // initialise RPC descriptor header 1755 rpc_desc_t rpc; 1756 rpc.index = RPC_VFS_FS_NEW_DENTRY; 1757 rpc.blocking = true; 1758 rpc.rsp = &responses; 1759 1760 // set input arguments in RPC descriptor 1761 rpc.args[0] = (uint64_t)(intptr_t)parent_inode; 1762 rpc.args[1] = (uint64_t)(intptr_t)name; 1763 rpc.args[2] = (uint64_t)child_inode_xp; 1764 1765 // register RPC request in remote RPC fifo 1766 rpc_send( cxy , &rpc ); 1767 1768 // get output values from RPC descriptor 1769 *error = (error_t)rpc.args[3]; 1770 1771 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 1772 cycle = (uint32_t)hal_get_cycles(); 1773 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 1774 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1775 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1776 #endif 1777 } 1778 1779 ////////////////////////////////////////////// 1780 void rpc_vfs_fs_new_dentry_server( xptr_t xp ) 1781 { 1782 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 1783 thread_t * this = CURRENT_THREAD; 1784 uint32_t cycle = (uint32_t)hal_get_cycles(); 1785 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 1786 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1787 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1788 #endif 1789 1790 error_t error; 1791 vfs_inode_t * parent; 1792 xptr_t child_xp; 1793 char * name; 1794 1795 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 1796 1797 // get client cluster identifier and pointer on RPC descriptor 1798 cxy_t client_cxy = GET_CXY( xp ); 1799 rpc_desc_t * desc = GET_PTR( xp ); 1800 1801 // get arguments "parent", "name", and "child_xp" 1802 parent = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 1803 name = (char*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 1804 child_xp = (xptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[2])); 1805 1806 // get name local copy 1807 hal_remote_strcpy( XPTR( local_cxy , name_copy ) , 1808 XPTR( client_cxy , name ) ); 1809 1810 // call the kernel function 1811 error = vfs_fs_new_dentry( parent , name_copy , child_xp ); 1812 1813 // set output argument 1814 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1815 1816 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 1817 cycle = (uint32_t)hal_get_cycles(); 1818 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 1819 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1820 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1821 #endif 1822 } 1823 1824 ///////////////////////////////////////////////////////////////////////////////////////// 1825 // [17] Marshaling function attached to RPC_VFS_FS_ADD_DENTRY 1826 ///////////////////////////////////////////////////////////////////////////////////////// 1827 1828 void rpc_vfs_fs_add_dentry_client( cxy_t cxy, 1829 vfs_inode_t * parent, // in 1830 vfs_dentry_t * dentry, // in 1831 error_t * error ) // out 1832 { 1833 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 1834 thread_t * this = CURRENT_THREAD; 1835 uint32_t cycle = (uint32_t)hal_get_cycles(); 1836 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 1837 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1838 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1839 #endif 1840 1841 uint32_t responses = 1; 1842 1843 // initialise RPC descriptor header 1844 rpc_desc_t rpc; 1845 rpc.index = RPC_VFS_FS_ADD_DENTRY; 1846 rpc.blocking = true; 1847 rpc.rsp = &responses; 1848 1849 // set input arguments in RPC descriptor 1850 rpc.args[0] = (uint64_t)(intptr_t)parent; 1851 rpc.args[1] = (uint64_t)(intptr_t)dentry; 1852 1853 // register RPC request in remote RPC fifo 1854 rpc_send( cxy , &rpc ); 1855 1856 // get output values from RPC descriptor 1857 *error = (error_t)rpc.args[2]; 1858 1859 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 1860 cycle = (uint32_t)hal_get_cycles(); 1861 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 1862 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1863 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1864 #endif 1865 } 1866 1867 ////////////////////////////////////////////// 1868 void rpc_vfs_fs_add_dentry_server( xptr_t xp ) 1869 { 1870 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 1871 thread_t * this = CURRENT_THREAD; 1872 uint32_t cycle = (uint32_t)hal_get_cycles(); 1873 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 1874 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1875 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1876 #endif 1877 1878 error_t error; 1879 vfs_inode_t * parent; 1880 vfs_dentry_t * dentry; 1881 1882 // get client cluster identifier and pointer on RPC descriptor 1883 cxy_t client_cxy = GET_CXY( xp ); 1884 rpc_desc_t * desc = GET_PTR( xp ); 1885 1886 // get input arguments 1887 parent = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 1888 dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 1889 1890 // call the kernel function 1891 error = vfs_fs_add_dentry( parent , dentry ); 1892 1893 // set output argument 1894 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)error ); 1895 1896 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 1897 cycle = (uint32_t)hal_get_cycles(); 1898 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 1899 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1900 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1901 #endif 1902 } 1903 1904 ///////////////////////////////////////////////////////////////////////////////////////// 1905 // [18] Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY 1906 ///////////////////////////////////////////////////////////////////////////////////////// 1907 1908 void rpc_vfs_fs_remove_dentry_client( cxy_t cxy, 1909 vfs_inode_t * parent, // in 1910 vfs_dentry_t * dentry, // in 1911 error_t * error ) // out 1912 { 1913 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 1914 thread_t * this = CURRENT_THREAD; 1915 uint32_t cycle = (uint32_t)hal_get_cycles(); 1916 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 1917 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1918 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1919 #endif 1920 1921 uint32_t responses = 1; 1922 1923 // initialise RPC descriptor header 1924 rpc_desc_t rpc; 1925 rpc.index = RPC_VFS_FS_REMOVE_DENTRY; 1926 rpc.blocking = true; 1927 rpc.rsp = &responses; 1928 1929 // set input arguments in RPC descriptor 1930 rpc.args[0] = (uint64_t)(intptr_t)parent; 1931 rpc.args[1] = (uint64_t)(intptr_t)dentry; 1932 1933 // register RPC request in remote RPC fifo 1934 rpc_send( cxy , &rpc ); 1935 1936 // get output values from RPC descriptor 1937 *error = (error_t)rpc.args[2]; 1938 1939 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 1940 cycle = (uint32_t)hal_get_cycles(); 1941 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 1942 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1943 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1944 #endif 1945 } 1946 1947 ///////////////////////////////////////////////// 1948 void rpc_vfs_fs_remove_dentry_server( xptr_t xp ) 1949 { 1950 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 1951 thread_t * this = CURRENT_THREAD; 1952 uint32_t cycle = (uint32_t)hal_get_cycles(); 1953 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 1954 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1955 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1956 #endif 1957 1958 error_t error; 1959 vfs_inode_t * parent; 1960 vfs_dentry_t * dentry; 1961 1962 // get client cluster identifier and pointer on RPC descriptor 1963 cxy_t client_cxy = GET_CXY( xp ); 1964 rpc_desc_t * desc = GET_PTR( xp ); 1965 1966 // get input arguments 1967 parent = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 1968 dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 1969 1970 // call the kernel function 1971 error = vfs_fs_remove_dentry( parent , dentry ); 1972 1973 // set output argument 1974 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)error ); 1975 1976 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 1977 cycle = (uint32_t)hal_get_cycles(); 1978 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 1979 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1980 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1981 #endif 1982 } 1983 1984 ///////////////////////////////////////////////////////////////////////////////////////// 1985 // [19] Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES 1986 ///////////////////////////////////////////////////////////////////////////////////////// 1987 1988 //////////////////////////////////////////////////////////// 1989 void rpc_vfs_inode_load_all_pages_client( cxy_t cxy, 1990 vfs_inode_t * inode, // in 1991 error_t * error ) // out 1992 { 1993 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 1994 thread_t * this = CURRENT_THREAD; 1995 uint32_t cycle = (uint32_t)hal_get_cycles(); 1996 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 1997 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1998 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1999 #endif 2000 2001 uint32_t responses = 1; 2002 2003 // initialise RPC descriptor header 2004 rpc_desc_t rpc; 2005 rpc.index = RPC_VFS_INODE_LOAD_ALL_PAGES; 2006 rpc.blocking = true; 2007 rpc.rsp = &responses; 2008 2009 // set input arguments in RPC descriptor 2010 rpc.args[0] = (uint64_t)(intptr_t)inode; 2011 2012 // register RPC request in remote RPC fifo 2013 rpc_send( cxy , &rpc ); 2014 2015 // get output values from RPC descriptor 2016 *error = (error_t)rpc.args[1]; 2017 2018 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2019 cycle = (uint32_t)hal_get_cycles(); 2020 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2021 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2022 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2023 #endif 2024 } 2025 2026 ///////////////////////////////////////////////////// 2027 void rpc_vfs_inode_load_all_pages_server( xptr_t xp ) 2028 { 2029 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2030 thread_t * this = CURRENT_THREAD; 2031 uint32_t cycle = (uint32_t)hal_get_cycles(); 2032 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2033 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2034 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2035 #endif 2036 2037 error_t error; 2038 vfs_inode_t * inode; 2039 2040 // get client cluster identifier and pointer on RPC descriptor 2041 cxy_t client_cxy = GET_CXY( xp ); 2042 rpc_desc_t * desc = GET_PTR( xp ); 2043 2044 // get input argument 2045 inode = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 2046 2047 // call the kernel function 2048 error = vfs_inode_load_all_pages( inode ); 2049 2050 // set output argument 2051 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 2052 2053 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2054 cycle = (uint32_t)hal_get_cycles(); 2055 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2056 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2057 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2058 #endif 2059 } 2060 2061 ///////////////////////////////////////////////////////////////////////////////////////// 2062 // [20] RPC_VMM_GET_VSEG deprecated [AG] sept 2019 2063 ///////////////////////////////////////////////////////////////////////////////////////// 2064 2065 /* 2066 ////////////////////////////////////////////////// 2067 void rpc_vmm_get_vseg_client( cxy_t cxy, 2068 process_t * process, // in 2069 intptr_t vaddr, // in 2070 xptr_t * vseg_xp, // out 2071 error_t * error ) // out 2072 { 2073 #if DEBUG_RPC_VMM_GET_VSEG 2074 thread_t * this = CURRENT_THREAD; 2075 uint32_t cycle = (uint32_t)hal_get_cycles(); 2076 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2077 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2078 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2079 #endif 2080 2081 uint32_t responses = 1; 2082 2083 // initialise RPC descriptor header 2084 rpc_desc_t rpc; 2085 rpc.index = RPC_VMM_GET_VSEG; 2086 rpc.blocking = true; 2087 rpc.rsp = &responses; 2088 2089 // set input arguments in RPC descriptor 2090 rpc.args[0] = (uint64_t)(intptr_t)process; 2091 rpc.args[1] = (uint64_t)vaddr; 2092 2093 // register RPC request in remote RPC fifo 2094 rpc_send( cxy , &rpc ); 2095 2096 // get output argument from rpc descriptor 2097 *vseg_xp = rpc.args[2]; 2098 *error = (error_t)rpc.args[3]; 2099 2100 #if DEBUG_RPC_VMM_GET_VSEG 2101 cycle = (uint32_t)hal_get_cycles(); 2102 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2103 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2104 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2105 #endif 2106 } 2107 2108 ///////////////////////////////////////// 2109 void rpc_vmm_get_vseg_server( xptr_t xp ) 2110 { 2111 #if DEBUG_RPC_VMM_GET_VSEG 2112 thread_t * this = CURRENT_THREAD; 2113 uint32_t cycle = (uint32_t)hal_get_cycles(); 2114 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2115 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2116 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2117 #endif 2118 2119 process_t * process; 2120 intptr_t vaddr; 2121 vseg_t * vseg_ptr; 2122 xptr_t vseg_xp; 2123 error_t error; 2124 2125 // get client cluster identifier and pointer on RPC descriptor 2126 cxy_t client_cxy = GET_CXY( xp ); 2127 rpc_desc_t * desc = GET_PTR( xp ); 2128 2129 // get input argument from client RPC descriptor 2130 process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2131 vaddr = (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2132 2133 // call local kernel function 2134 error = vmm_get_vseg( process , vaddr , &vseg_ptr ); 2135 2136 // set output arguments to client RPC descriptor 2137 vseg_xp = XPTR( local_cxy , vseg_ptr ); 2138 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp ); 2139 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 2140 2141 #if DEBUG_RPC_VMM_GET_VSEG 2142 cycle = (uint32_t)hal_get_cycles(); 2143 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2144 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2145 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2146 #endif 2147 } 2148 */ 2149 2150 ///////////////////////////////////////////////////////////////////////////////////////// 2151 // [21] undefined 2152 ///////////////////////////////////////////////////////////////////////////////////////// 2153 2154 ///////////////////////////////////////////////////////////////////////////////////////// 2155 // [22] RPC_KCM_ALLOC deprecated [AG] sept 2019 2156 ///////////////////////////////////////////////////////////////////////////////////////// 2157 2158 /* 2159 ////////////////////////////////////////// 2160 void rpc_kcm_alloc_client( cxy_t cxy, 2161 uint32_t kmem_type, // in 2162 xptr_t * buf_xp ) // out 2163 { 2164 #if DEBUG_RPC_KCM_ALLOC 2165 thread_t * this = CURRENT_THREAD; 2166 uint32_t cycle = (uint32_t)hal_get_cycles(); 2167 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2168 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2169 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2170 #endif 2171 2172 uint32_t responses = 1; 2173 2174 // initialise RPC descriptor header 2175 rpc_desc_t rpc; 2176 rpc.index = RPC_KCM_ALLOC; 2177 rpc.blocking = true; 2178 rpc.rsp = &responses; 2179 2180 // set input arguments in RPC descriptor 2181 rpc.args[0] = (uint64_t)kmem_type; 2182 2183 // register RPC request in remote RPC fifo 2184 rpc_send( cxy , &rpc ); 2185 2186 // get output arguments from RPC descriptor 2187 *buf_xp = (xptr_t)rpc.args[1]; 2188 2189 #if DEBUG_RPC_KCM_ALLOC 2190 cycle = (uint32_t)hal_get_cycles(); 2191 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2192 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2193 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2194 #endif 2195 } 2196 2197 ////////////////////////////////////// 2198 void rpc_kcm_alloc_server( xptr_t xp ) 2199 { 2200 #if DEBUG_RPC_KCM_ALLOC 2201 thread_t * this = CURRENT_THREAD; 2202 uint32_t cycle = (uint32_t)hal_get_cycles(); 2203 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2204 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2205 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2206 #endif 2207 2208 // get client cluster identifier and pointer on RPC descriptor 2209 cxy_t client_cxy = GET_CXY( xp ); 2210 rpc_desc_t * desc = GET_PTR( xp ); 2211 2212 // get input argument "kmem_type" from client RPC descriptor 2213 uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2214 2215 // allocates memory for kcm 2216 kmem_req_t req; 2217 req.type = kmem_type; 2218 req.flags = AF_ZERO; 2219 void * buf_ptr = kmem_alloc( &req ); 2220 2221 // set output argument 2222 xptr_t buf_xp = XPTR( local_cxy , buf_ptr ); 2223 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp ); 2224 2225 #if DEBUG_RPC_KCM_ALLOC 2226 cycle = (uint32_t)hal_get_cycles(); 2227 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2228 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2229 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2230 #endif 2231 } 2232 */ 2233 2234 ///////////////////////////////////////////////////////////////////////////////////////// 2235 // [23] RPC_KCM_FREE deprecated [AG] sept 2019 2236 ///////////////////////////////////////////////////////////////////////////////////////// 2237 2238 /* 2239 ///////////////////////////////////////// 2240 void rpc_kcm_free_client( cxy_t cxy, 2241 void * buf, // in 2242 uint32_t kmem_type ) // in 2243 { 2244 #if DEBUG_RPC_KCM_FREE 2245 thread_t * this = CURRENT_THREAD; 2246 uint32_t cycle = (uint32_t)hal_get_cycles(); 2247 if( cycle > DEBUG_RPC_KCM_FREE ) 2248 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2249 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2250 #endif 2251 2252 uint32_t responses = 1; 2253 2254 // initialise RPC descriptor header 2255 rpc_desc_t rpc; 2256 rpc.index = RPC_KCM_FREE; 2257 rpc.blocking = true; 2258 rpc.rsp = &responses; 2259 2260 // set input arguments in RPC descriptor 2261 rpc.args[0] = (uint64_t)(intptr_t)buf; 2262 rpc.args[1] = (uint64_t)kmem_type; 2263 2264 // register RPC request in remote RPC fifo 2265 rpc_send( cxy , &rpc ); 2266 2267 #if DEBUG_RPC_KCM_FREE 2268 cycle = (uint32_t)hal_get_cycles(); 2269 if( cycle > DEBUG_RPC_KCM_FREE ) 2270 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2271 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2272 #endif 2273 } 2274 2275 ///////////////////////////////////// 2276 void rpc_kcm_free_server( xptr_t xp ) 2277 { 2278 #if DEBUG_RPC_KCM_FREE 2279 thread_t * this = CURRENT_THREAD; 2280 uint32_t cycle = (uint32_t)hal_get_cycles(); 2281 if( cycle > DEBUG_RPC_KCM_FREE ) 2282 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2283 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2284 #endif 2285 2286 // get client cluster identifier and pointer on RPC descriptor 2287 cxy_t client_cxy = GET_CXY( xp ); 2288 rpc_desc_t * desc = GET_PTR( xp ); 2289 2290 // get input arguments "buf" and "kmem_type" from client RPC descriptor 2291 void * buf = (void *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2292 uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2293 2294 // releases memory 2295 kmem_req_t req; 2296 req.type = kmem_type; 2297 req.ptr = buf; 2298 kmem_free( &req ); 2299 2300 #if DEBUG_RPC_KCM_FREE 2301 cycle = (uint32_t)hal_get_cycles(); 2302 if( cycle > DEBUG_RPC_KCM_FREE ) 2303 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2304 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2305 #endif 2306 } 2307 */ 2308 2309 ///////////////////////////////////////////////////////////////////////////////////////// 2310 // [24] Marshaling functions attached to RPC_MAPPER_SYNC 2311 ///////////////////////////////////////////////////////////////////////////////////////// 2312 2313 /////////////////////////////////////////////////// 2314 void rpc_mapper_sync_client( cxy_t cxy, 2315 struct mapper_s * mapper, 2316 error_t * error ) 2317 { 2318 #if DEBUG_RPC_MAPPER_SYNC 2319 thread_t * this = CURRENT_THREAD; 2320 uint32_t cycle = (uint32_t)hal_get_cycles(); 2321 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2322 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2323 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2324 #endif 2325 2326 uint32_t responses = 1; 2327 2328 // initialise RPC descriptor header 2329 rpc_desc_t rpc; 2330 rpc.index = RPC_MAPPER_SYNC; 2331 rpc.blocking = true; 2332 rpc.rsp = &responses; 2333 2334 // set input arguments in RPC descriptor 2335 rpc.args[0] = (uint64_t)(intptr_t)mapper; 2336 2337 // register RPC request in remote RPC fifo 2338 rpc_send( cxy , &rpc ); 2339 2340 // get output values from RPC descriptor 2341 *error = (error_t)rpc.args[1]; 2342 2343 #if DEBUG_RPC_MAPPER_SYNC 2344 cycle = (uint32_t)hal_get_cycles(); 2345 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2346 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2347 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2348 #endif 2349 } 2350 2351 //////////////////////////////////////// 2352 void rpc_mapper_sync_server( xptr_t xp ) 2353 { 2354 #if DEBUG_RPC_MAPPER_SYNC 2355 thread_t * this = CURRENT_THREAD; 2356 uint32_t cycle = (uint32_t)hal_get_cycles(); 2357 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2358 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2359 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2360 #endif 2361 2362 mapper_t * mapper; 2363 error_t error; 2364 2365 // get client cluster identifier and pointer on RPC descriptor 2366 cxy_t client_cxy = GET_CXY( xp ); 2367 rpc_desc_t * desc = GET_PTR( xp ); 2368 2369 // get arguments from client RPC descriptor 2370 mapper = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2371 2372 // call local kernel function 2373 error = mapper_sync( mapper ); 2374 2375 // set output argument to client RPC descriptor 2376 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 2377 2378 #if DEBUG_RPC_MAPPER_SYNC 2379 cycle = (uint32_t)hal_get_cycles(); 2380 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2381 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2382 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2383 #endif 2384 } 2385 2386 ///////////////////////////////////////////////////////////////////////////////////////// 2387 // [25] Marshaling functions attached to RPC_VMM_RESIZE_VSEG 952 } 953 954 ///////////////////////////////////////////////////////////////////////////////////////// 955 // [10] undefined 956 ///////////////////////////////////////////////////////////////////////////////////////// 957 958 ///////////////////////////////////////////////////////////////////////////////////////// 959 // [11] undefined 960 ///////////////////////////////////////////////////////////////////////////////////////// 961 962 ///////////////////////////////////////////////////////////////////////////////////////// 963 // [12] undefined 964 ///////////////////////////////////////////////////////////////////////////////////////// 965 966 ///////////////////////////////////////////////////////////////////////////////////////// 967 // [13] undefined 968 ///////////////////////////////////////////////////////////////////////////////////////// 969 970 ///////////////////////////////////////////////////////////////////////////////////////// 971 // [14] undefined 972 ///////////////////////////////////////////////////////////////////////////////////////// 973 974 ///////////////////////////////////////////////////////////////////////////////////////// 975 // [15] Marshaling functions attached to RPC_VMM_RESIZE_VSEG 2388 976 ///////////////////////////////////////////////////////////////////////////////////////// 2389 977 … … 2478 1066 2479 1067 ///////////////////////////////////////////////////////////////////////////////////////// 2480 // [ 26] Marshaling functions attached to RPC_VMM_REMOVE_VSEG1068 // [16] Marshaling functions attached to RPC_VMM_REMOVE_VSEG 2481 1069 ///////////////////////////////////////////////////////////////////////////////////////// 2482 1070 … … 2560 1148 2561 1149 ///////////////////////////////////////////////////////////////////////////////////////// 2562 // [ 27] Marshaling functions attached to RPC_VMM_CREATE_VSEG1150 // [17] Marshaling functions attached to RPC_VMM_CREATE_VSEG 2563 1151 ///////////////////////////////////////////////////////////////////////////////////////// 2564 1152 … … 2662 1250 2663 1251 ///////////////////////////////////////////////////////////////////////////////////////// 2664 // [ 28] Marshaling functions attached to RPC_VMM_SET_COW1252 // [18] Marshaling functions attached to RPC_VMM_SET_COW 2665 1253 ///////////////////////////////////////////////////////////////////////////////////////// 2666 1254 … … 2730 1318 } 2731 1319 1320 1321 1322 ///////////////////////////////////////////////////////////////////////////////////////// 1323 ///////////////////////////////////////////////////////////////////////////////////////// 1324 // DEPRECATED RPCs 1325 ///////////////////////////////////////////////////////////////////////////////////////// 1326 ///////////////////////////////////////////////////////////////////////////////////////// 1327 1328 /* 1329 1330 ///////////////////////////////////////////////////////////////////////////////////////// 1331 // [0] RPC_PMEM_GET_PAGES deprecated [AG] May 2019 1332 ///////////////////////////////////////////////////////////////////////////////////////// 1333 void rpc_pmem_get_pages_client( cxy_t cxy, 1334 uint32_t order, // in 1335 page_t ** page ) // out 1336 { 1337 #if DEBUG_RPC_PMEM_GET_PAGES 1338 thread_t * this = CURRENT_THREAD; 1339 uint32_t cycle = (uint32_t)hal_get_cycles(); 1340 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 1341 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1342 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1343 #endif 1344 1345 uint32_t responses = 1; 1346 1347 // initialise RPC descriptor header 1348 rpc_desc_t rpc; 1349 rpc.index = RPC_PMEM_GET_PAGES; 1350 rpc.blocking = true; 1351 rpc.rsp = &responses; 1352 1353 // set input arguments in RPC descriptor 1354 rpc.args[0] = (uint64_t)order; 1355 1356 // register RPC request in remote RPC fifo 1357 rpc_send( cxy , &rpc ); 1358 1359 // get output arguments from RPC descriptor 1360 *page = (page_t *)(intptr_t)rpc.args[1]; 1361 1362 #if DEBUG_RPC_PMEM_GET_PAGES 1363 cycle = (uint32_t)hal_get_cycles(); 1364 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 1365 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1366 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1367 #endif 1368 } 1369 1370 /////////////////////////////////////////// 1371 void rpc_pmem_get_pages_server( xptr_t xp ) 1372 { 1373 #if DEBUG_RPC_PMEM_GET_PAGES 1374 thread_t * this = CURRENT_THREAD; 1375 uint32_t cycle = (uint32_t)hal_get_cycles(); 1376 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 1377 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1378 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1379 #endif 1380 1381 // get client cluster identifier and pointer on RPC descriptor 1382 cxy_t cxy = GET_CXY( xp ); 1383 rpc_desc_t * desc = GET_PTR( xp ); 1384 1385 // get input arguments from client RPC descriptor 1386 uint32_t order = (uint32_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) ); 1387 1388 // call local pmem allocator 1389 page_t * page = ppm_alloc_pages( order ); 1390 1391 // set output arguments into client RPC descriptor 1392 hal_remote_s64( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); 1393 1394 #if DEBUG_RPC_PMEM_GET_PAGES 1395 cycle = (uint32_t)hal_get_cycles(); 1396 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 1397 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1398 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1399 #endif 1400 } 1401 1402 ///////////////////////////////////////////////////////////////////////////////////////// 1403 // [1] RPC_PMEM_RELEASE_PAGES deprecated [AG] may 2019 1404 ///////////////////////////////////////////////////////////////////////////////////////// 1405 void rpc_pmem_release_pages_client( cxy_t cxy, 1406 page_t * page ) // out 1407 { 1408 #if DEBUG_RPC_PMEM_RELEASE_PAGES 1409 thread_t * this = CURRENT_THREAD; 1410 uint32_t cycle = (uint32_t)hal_get_cycles(); 1411 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 1412 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1413 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1414 #endif 1415 1416 uint32_t responses = 1; 1417 1418 // initialise RPC descriptor header 1419 rpc_desc_t rpc; 1420 rpc.index = RPC_PMEM_RELEASE_PAGES; 1421 rpc.blocking = true; 1422 rpc.rsp = &responses; 1423 1424 // set input arguments in RPC descriptor 1425 rpc.args[0] = (uint64_t)(intptr_t)page; 1426 1427 // register RPC request in remote RPC fifo 1428 rpc_send( cxy , &rpc ); 1429 1430 #if DEBUG_RPC_PMEM_RELEASE_PAGES 1431 cycle = (uint32_t)hal_get_cycles(); 1432 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 1433 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1434 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1435 #endif 1436 } 1437 1438 /////////////////////////////////////////////// 1439 void rpc_pmem_release_pages_server( xptr_t xp ) 1440 { 1441 #if DEBUG_RPC_PMEM_RELEASE_PAGES 1442 thread_t * this = CURRENT_THREAD; 1443 uint32_t cycle = (uint32_t)hal_get_cycles(); 1444 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 1445 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1446 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1447 #endif 1448 1449 // get client cluster identifier and pointer on RPC descriptor 1450 cxy_t cxy = GET_CXY( xp ); 1451 rpc_desc_t * desc = GET_PTR( xp ); 1452 1453 // get input arguments from client RPC descriptor 1454 page_t * page = (page_t *)(intptr_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) ); 1455 1456 // release memory to local pmem 1457 kmem_req_t req; 1458 req.type = KMEM_PPM; 1459 req.ptr = page; 1460 kmem_free( &req ); 1461 1462 #if DEBUG_RPC_PMEM_RELEASE_PAGES 1463 cycle = (uint32_t)hal_get_cycles(); 1464 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 1465 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1466 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1467 #endif 1468 } 1469 1470 ///////////////////////////////////////////////////////////////////////////////////////// 1471 // [2] RPC_PPM_DISPLAY deprecated [AG] May 2019 1472 ///////////////////////////////////////////////////////////////////////////////////////// 1473 void rpc_ppm_display_client( cxy_t cxy ) 1474 { 1475 #if DEBUG_RPC_PPM_DISPLAY 1476 thread_t * this = CURRENT_THREAD; 1477 uint32_t cycle = (uint32_t)hal_get_cycles(); 1478 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 1479 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1480 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1481 #endif 1482 1483 uint32_t responses = 1; 1484 1485 // initialise RPC descriptor header 1486 rpc_desc_t rpc; 1487 rpc.index = RPC_PPM_DISPLAY; 1488 rpc.blocking = true; 1489 rpc.rsp = &responses; 1490 1491 // register RPC request in remote RPC fifo 1492 rpc_send( cxy , &rpc ); 1493 1494 #if DEBUG_RPC_PPM_DISPLAY 1495 cycle = (uint32_t)hal_get_cycles(); 1496 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 1497 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1498 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1499 #endif 1500 } 1501 1502 //////////////////////////////////////////////////////////////////// 1503 void rpc_ppm_display_server( xptr_t __attribute__((__unused__)) xp ) 1504 { 1505 #if DEBUG_RPC_PPM_DISPLAY 1506 thread_t * this = CURRENT_THREAD; 1507 uint32_t cycle = (uint32_t)hal_get_cycles(); 1508 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 1509 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1510 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1511 #endif 1512 1513 // call local kernel function 1514 ppm_display(); 1515 1516 #if DEBUG_RPC_PPM_DISPLAY 1517 cycle = (uint32_t)hal_get_cycles(); 1518 if( cycle > DEBUG_RPC_PPM_DISPLAY ) 1519 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1520 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1521 #endif 1522 } 1523 1524 ///////////////////////////////////////////////////////////////////////////////////////// 1525 // [8] RPC_VFS_FS_UPDATE_DENTRY deprecated [AG] dec 2019 1526 ///////////////////////////////////////////////////////////////////////////////////////// 1527 void rpc_vfs_fs_update_dentry_client( cxy_t cxy, 1528 vfs_inode_t * inode, 1529 vfs_dentry_t * dentry, 1530 uint32_t size, 1531 error_t * error ) 1532 { 1533 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1534 thread_t * this = CURRENT_THREAD; 1535 uint32_t cycle = (uint32_t)hal_get_cycles(); 1536 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1537 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1538 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1539 #endif 1540 1541 uint32_t responses = 1; 1542 1543 // initialise RPC descriptor header 1544 rpc_desc_t rpc; 1545 rpc.index = RPC_VFS_FS_UPDATE_DENTRY; 1546 rpc.blocking = true; 1547 rpc.rsp = &responses; 1548 1549 // set input arguments in RPC descriptor 1550 rpc.args[0] = (uint64_t)(intptr_t)inode; 1551 rpc.args[1] = (uint64_t)(intptr_t)dentry; 1552 rpc.args[2] = (uint64_t)size; 1553 1554 // register RPC request in remote RPC fifo 1555 rpc_send( cxy , &rpc ); 1556 1557 // get output values from RPC descriptor 1558 *error = (error_t)rpc.args[3]; 1559 1560 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1561 cycle = (uint32_t)hal_get_cycles(); 1562 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1563 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1564 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1565 #endif 1566 } 1567 1568 ///////////////////////////////////////////////// 1569 void rpc_vfs_fs_update_dentry_server( xptr_t xp ) 1570 { 1571 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1572 thread_t * this = CURRENT_THREAD; 1573 uint32_t cycle = (uint32_t)hal_get_cycles(); 1574 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1575 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1576 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1577 #endif 1578 1579 error_t error; 1580 vfs_inode_t * inode; 1581 vfs_dentry_t * dentry; 1582 uint32_t size; 1583 1584 // get client cluster identifier and pointer on RPC descriptor 1585 cxy_t client_cxy = GET_CXY( xp ); 1586 rpc_desc_t * desc = GET_PTR( xp ); 1587 1588 // get input arguments 1589 inode = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 1590 dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 1591 size = (uint32_t) hal_remote_l64(XPTR(client_cxy , &desc->args[2])); 1592 1593 // call the kernel function 1594 error = vfs_fs_update_dentry( inode , dentry , size ); 1595 1596 // set output argument 1597 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1598 1599 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1600 cycle = (uint32_t)hal_get_cycles(); 1601 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1602 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1603 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1604 #endif 1605 } 1606 1607 2732 1608 ///////////////////////////////////////////////////////////////////////////////////////// 2733 1609 // [29] RPC_VMM_DISPLAY deprecated [AG] June 2019 2734 1610 ///////////////////////////////////////////////////////////////////////////////////////// 2735 2736 /*2737 /////////////////////////////////////////////2738 1611 void rpc_hal_vmm_display_client( cxy_t cxy, 2739 1612 process_t * process, … … 2804 1677 } 2805 1678 1679 ///////////////////////////////////////////////////////////////////////////////////////// 1680 // [10] to RPC_VFS_INODE_CREATE deprecated [AG] dec 2019 1681 ///////////////////////////////////////////////////////////////////////////////////////// 1682 void rpc_vfs_inode_create_client( cxy_t cxy, 1683 uint32_t fs_type, // in 1684 uint32_t attr, // in 1685 uint32_t rights, // in 1686 uint32_t uid, // in 1687 uint32_t gid, // in 1688 xptr_t * inode_xp, // out 1689 error_t * error ) // out 1690 { 1691 #if DEBUG_RPC_VFS_INODE_CREATE 1692 thread_t * this = CURRENT_THREAD; 1693 uint32_t cycle = (uint32_t)hal_get_cycles(); 1694 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1695 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1696 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1697 #endif 1698 1699 uint32_t responses = 1; 1700 1701 // initialise RPC descriptor header 1702 rpc_desc_t rpc; 1703 rpc.index = RPC_VFS_INODE_CREATE; 1704 rpc.blocking = true; 1705 rpc.rsp = &responses; 1706 1707 // set input arguments in RPC descriptor 1708 rpc.args[0] = (uint64_t)fs_type; 1709 rpc.args[1] = (uint64_t)attr; 1710 rpc.args[2] = (uint64_t)rights; 1711 rpc.args[3] = (uint64_t)uid; 1712 rpc.args[4] = (uint64_t)gid; 1713 1714 // register RPC request in remote RPC fifo 1715 rpc_send( cxy , &rpc ); 1716 1717 // get output values from RPC descriptor 1718 *inode_xp = (xptr_t)rpc.args[5]; 1719 *error = (error_t)rpc.args[6]; 1720 1721 #if DEBUG_RPC_VFS_INODE_CREATE 1722 cycle = (uint32_t)hal_get_cycles(); 1723 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1724 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1725 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1726 #endif 1727 } 1728 1729 ///////////////////////////////////////////// 1730 void rpc_vfs_inode_create_server( xptr_t xp ) 1731 { 1732 #if DEBUG_RPC_VFS_INODE_CREATE 1733 thread_t * this = CURRENT_THREAD; 1734 uint32_t cycle = (uint32_t)hal_get_cycles(); 1735 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1736 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1737 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1738 #endif 1739 1740 uint32_t fs_type; 1741 uint32_t attr; 1742 uint32_t rights; 1743 uint32_t uid; 1744 uint32_t gid; 1745 xptr_t inode_xp; 1746 error_t error; 1747 1748 // get client cluster identifier and pointer on RPC descriptor 1749 cxy_t client_cxy = GET_CXY( xp ); 1750 rpc_desc_t * desc = GET_PTR( xp ); 1751 1752 // get input arguments from client rpc descriptor 1753 fs_type = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1754 attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 1755 rights = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); 1756 uid = (uid_t) hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) ); 1757 gid = (gid_t) hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) ); 1758 1759 // call local kernel function 1760 error = vfs_inode_create( fs_type, 1761 attr, 1762 rights, 1763 uid, 1764 gid, 1765 &inode_xp ); 1766 1767 // set output arguments 1768 hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)inode_xp ); 1769 hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error ); 1770 1771 #if DEBUG_RPC_VFS_INODE_CREATE 1772 cycle = (uint32_t)hal_get_cycles(); 1773 if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) 1774 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1775 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1776 #endif 1777 } 1778 1779 ///////////////////////////////////////////////////////////////////////////////////////// 1780 // [11] to RPC_VFS_INODE_DESTROY deprecated [AG] dec 2019 1781 ///////////////////////////////////////////////////////////////////////////////////////// 1782 void rpc_vfs_inode_destroy_client( cxy_t cxy, 1783 struct vfs_inode_s * inode ) 1784 { 1785 #if DEBUG_RPC_VFS_INODE_DESTROY 1786 thread_t * this = CURRENT_THREAD; 1787 uint32_t cycle = (uint32_t)hal_get_cycles(); 1788 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1789 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1790 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1791 #endif 1792 1793 uint32_t responses = 1; 1794 1795 // initialise RPC descriptor header 1796 rpc_desc_t rpc; 1797 rpc.index = RPC_VFS_INODE_DESTROY; 1798 rpc.blocking = true; 1799 rpc.rsp = &responses; 1800 1801 // set input arguments in RPC descriptor 1802 rpc.args[0] = (uint64_t)(intptr_t)inode; 1803 1804 // register RPC request in remote RPC fifo 1805 rpc_send( cxy , &rpc ); 1806 1807 #if DEBUG_RPC_VFS_INODE_DESTROY 1808 cycle = (uint32_t)hal_get_cycles(); 1809 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1810 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1811 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1812 #endif 1813 } 1814 1815 ////////////////////////////////////////////// 1816 void rpc_vfs_inode_destroy_server( xptr_t xp ) 1817 { 1818 #if DEBUG_RPC_VFS_INODE_DESTROY 1819 thread_t * this = CURRENT_THREAD; 1820 uint32_t cycle = (uint32_t)hal_get_cycles(); 1821 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1822 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1823 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1824 #endif 1825 1826 vfs_inode_t * inode; 1827 1828 // get client cluster identifier and pointer on RPC descriptor 1829 cxy_t client_cxy = GET_CXY( xp ); 1830 rpc_desc_t * desc = GET_PTR( xp ); 1831 1832 // get argument "inode" from client RPC descriptor 1833 inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1834 1835 // call local kernel function 1836 vfs_inode_destroy( inode ); 1837 1838 #if DEBUG_RPC_VFS_INODE_DESTROY 1839 cycle = (uint32_t)hal_get_cycles(); 1840 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) 1841 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1842 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1843 #endif 1844 } 1845 1846 ///////////////////////////////////////////////////////////////////////////////////////// 1847 // [12] RPC_VFS_DENTRY_CREATE deprecated [AG] dec 2019 1848 ///////////////////////////////////////////////////////////////////////////////////////// 1849 void rpc_vfs_dentry_create_client( cxy_t cxy, 1850 uint32_t type, // in 1851 char * name, // in 1852 xptr_t * dentry_xp, // out 1853 error_t * error ) // out 1854 { 1855 #if DEBUG_RPC_VFS_DENTRY_CREATE 1856 thread_t * this = CURRENT_THREAD; 1857 uint32_t cycle = (uint32_t)hal_get_cycles(); 1858 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1859 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1860 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1861 #endif 1862 1863 uint32_t responses = 1; 1864 1865 // initialise RPC descriptor header 1866 rpc_desc_t rpc; 1867 rpc.index = RPC_VFS_DENTRY_CREATE; 1868 rpc.blocking = true; 1869 rpc.rsp = &responses; 1870 1871 // set input arguments in RPC descriptor 1872 rpc.args[0] = (uint64_t)type; 1873 rpc.args[1] = (uint64_t)(intptr_t)name; 1874 1875 // register RPC request in remote RPC fifo 1876 rpc_send( cxy , &rpc ); 1877 1878 // get output values from RPC descriptor 1879 *dentry_xp = (xptr_t)rpc.args[2]; 1880 *error = (error_t)rpc.args[3]; 1881 1882 #if DEBUG_RPC_VFS_DENTRY_CREATE 1883 cycle = (uint32_t)hal_get_cycles(); 1884 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1885 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1886 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1887 #endif 1888 } 1889 1890 ////////////////////////////////////////////// 1891 void rpc_vfs_dentry_create_server( xptr_t xp ) 1892 { 1893 #if DEBUG_RPC_VFS_DENTRY_CREATE 1894 thread_t * this = CURRENT_THREAD; 1895 uint32_t cycle = (uint32_t)hal_get_cycles(); 1896 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1897 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1898 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1899 #endif 1900 1901 uint32_t type; 1902 char * name; 1903 xptr_t dentry_xp; 1904 error_t error; 1905 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 1906 1907 // get client cluster identifier and pointer on RPC descriptor 1908 cxy_t client_cxy = GET_CXY( xp ); 1909 rpc_desc_t * desc = GET_PTR( xp ); 1910 1911 // get arguments "name", "type", and "parent" from client RPC descriptor 1912 type = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1913 name = (char *)(intptr_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 1914 1915 // makes a local copy of name 1916 hal_remote_strcpy( XPTR( local_cxy , name_copy ), 1917 XPTR( client_cxy , name ) ); 1918 1919 // call local kernel function 1920 error = vfs_dentry_create( type, 1921 name_copy, 1922 &dentry_xp ); 1923 // set output arguments 1924 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)dentry_xp ); 1925 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1926 1927 #if DEBUG_RPC_VFS_DENTRY_CREATE 1928 cycle = (uint32_t)hal_get_cycles(); 1929 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1930 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1931 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1932 #endif 1933 } 1934 1935 ///////////////////////////////////////////////////////////////////////////////////////// 1936 // [13] RPC_VFS_DENTRY_DESTROY deprecated [AG] dec 2019 1937 ///////////////////////////////////////////////////////////////////////////////////////// 1938 void rpc_vfs_dentry_destroy_client( cxy_t cxy, 1939 vfs_dentry_t * dentry ) 1940 { 1941 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1942 thread_t * this = CURRENT_THREAD; 1943 uint32_t cycle = (uint32_t)hal_get_cycles(); 1944 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1945 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1946 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1947 #endif 1948 1949 uint32_t responses = 1; 1950 1951 // initialise RPC descriptor header 1952 rpc_desc_t rpc; 1953 rpc.index = RPC_VFS_DENTRY_DESTROY; 1954 rpc.blocking = true; 1955 rpc.rsp = &responses; 1956 1957 // set input arguments in RPC descriptor 1958 rpc.args[0] = (uint64_t)(intptr_t)dentry; 1959 1960 // register RPC request in remote RPC fifo 1961 rpc_send( cxy , &rpc ); 1962 1963 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1964 cycle = (uint32_t)hal_get_cycles(); 1965 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1966 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1967 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1968 #endif 1969 } 1970 1971 /////////////////////////////////////////////// 1972 void rpc_vfs_dentry_destroy_server( xptr_t xp ) 1973 { 1974 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1975 thread_t * this = CURRENT_THREAD; 1976 uint32_t cycle = (uint32_t)hal_get_cycles(); 1977 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1978 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1979 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 1980 #endif 1981 1982 vfs_dentry_t * dentry; 1983 1984 // get client cluster identifier and pointer on RPC descriptor 1985 cxy_t client_cxy = GET_CXY( xp ); 1986 rpc_desc_t * desc = GET_PTR( xp ); 1987 1988 // get arguments "dentry" from client RPC descriptor 1989 dentry = (vfs_dentry_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1990 1991 // call local kernel function 1992 vfs_dentry_destroy( dentry ); 1993 1994 #if DEBUG_RPC_VFS_DENTRY_DESTROY 1995 cycle = (uint32_t)hal_get_cycles(); 1996 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) 1997 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1998 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1999 #endif 2000 } 2001 2002 2003 ///////////////////////////////////////////////////////////////////////////////////////// 2004 // [14] RPC_VFS_FILE_CREATE deprecated [AG] dec 2019 2005 ///////////////////////////////////////////////////////////////////////////////////////// 2006 void rpc_vfs_file_create_client( cxy_t cxy, 2007 struct vfs_inode_s * inode, // in 2008 uint32_t file_attr, // in 2009 xptr_t * file_xp, // out 2010 error_t * error ) // out 2011 { 2012 #if DEBUG_RPC_VFS_FILE_CREATE 2013 thread_t * this = CURRENT_THREAD; 2014 uint32_t cycle = (uint32_t)hal_get_cycles(); 2015 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 2016 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2017 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2018 #endif 2019 2020 uint32_t responses = 1; 2021 2022 // initialise RPC descriptor header 2023 rpc_desc_t rpc; 2024 rpc.index = RPC_VFS_FILE_CREATE; 2025 rpc.blocking = true; 2026 rpc.rsp = &responses; 2027 2028 // set input arguments in RPC descriptor 2029 rpc.args[0] = (uint64_t)(intptr_t)inode; 2030 rpc.args[1] = (uint64_t)file_attr; 2031 2032 // register RPC request in remote RPC fifo 2033 rpc_send( cxy , &rpc ); 2034 2035 // get output values from RPC descriptor 2036 *file_xp = (xptr_t)rpc.args[2]; 2037 *error = (error_t)rpc.args[3]; 2038 2039 #if DEBUG_RPC_VFS_FILE_CREATE 2040 cycle = (uint32_t)hal_get_cycles(); 2041 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 2042 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2043 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2044 #endif 2045 } 2046 2047 //////////////////////////////////////////// 2048 void rpc_vfs_file_create_server( xptr_t xp ) 2049 { 2050 #if DEBUG_RPC_VFS_FILE_CREATE 2051 thread_t * this = CURRENT_THREAD; 2052 uint32_t cycle = (uint32_t)hal_get_cycles(); 2053 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 2054 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2055 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2056 #endif 2057 2058 uint32_t file_attr; 2059 vfs_inode_t * inode; 2060 xptr_t file_xp; 2061 error_t error; 2062 2063 // get client cluster identifier and pointer on RPC descriptor 2064 cxy_t client_cxy = GET_CXY( xp ); 2065 rpc_desc_t * desc = GET_PTR( xp ); 2066 2067 // get arguments "file_attr" and "inode" from client RPC descriptor 2068 inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2069 file_attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2070 2071 // call local kernel function 2072 error = vfs_file_create( inode, 2073 file_attr, 2074 &file_xp ); 2075 2076 // set output arguments 2077 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp ); 2078 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 2079 2080 #if DEBUG_RPC_VFS_FILE_CREATE 2081 cycle = (uint32_t)hal_get_cycles(); 2082 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 2083 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2084 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2085 #endif 2086 } 2087 2088 ///////////////////////////////////////////////////////////////////////////////////////// 2089 // [15] RPC_VFS_FILE_DESTROY deprecated [AG] dec 2019 2090 ///////////////////////////////////////////////////////////////////////////////////////// 2091 void rpc_vfs_file_destroy_client( cxy_t cxy, 2092 vfs_file_t * file ) 2093 { 2094 #if DEBUG_RPC_VFS_FILE_DESTROY 2095 thread_t * this = CURRENT_THREAD; 2096 uint32_t cycle = (uint32_t)hal_get_cycles(); 2097 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 2098 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2099 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2100 #endif 2101 2102 uint32_t responses = 1; 2103 2104 // initialise RPC descriptor header 2105 rpc_desc_t rpc; 2106 rpc.index = RPC_VFS_FILE_DESTROY; 2107 rpc.blocking = true; 2108 rpc.rsp = &responses; 2109 2110 // set input arguments in RPC descriptor 2111 rpc.args[0] = (uint64_t)(intptr_t)file; 2112 2113 // register RPC request in remote RPC fifo 2114 rpc_send( cxy , &rpc ); 2115 2116 #if DEBUG_RPC_VFS_FILE_DESTROY 2117 cycle = (uint32_t)hal_get_cycles(); 2118 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 2119 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2120 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2121 #endif 2122 } 2123 2124 ///////////////////////////////////////////// 2125 void rpc_vfs_file_destroy_server( xptr_t xp ) 2126 { 2127 #if DEBUG_RPC_VFS_FILE_DESTROY 2128 thread_t * this = CURRENT_THREAD; 2129 uint32_t cycle = (uint32_t)hal_get_cycles(); 2130 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 2131 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2132 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2133 #endif 2134 2135 vfs_file_t * file; 2136 2137 // get client cluster identifier and pointer on RPC descriptor 2138 cxy_t client_cxy = GET_CXY( xp ); 2139 rpc_desc_t * desc = GET_PTR( xp ); 2140 2141 // get arguments "dentry" from client RPC descriptor 2142 file = (vfs_file_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2143 2144 // call local kernel function 2145 vfs_file_destroy( file ); 2146 2147 #if DEBUG_RPC_VFS_FILE_DESTROY 2148 cycle = (uint32_t)hal_get_cycles(); 2149 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) 2150 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2151 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2152 #endif 2153 } 2154 2155 ///////////////////////////////////////////////////////////////////////////////////////// 2156 // [16] RPC_VFS_FS_GET_DENTRY deprecated [AG] dec 2019 2157 ///////////////////////////////////////////////////////////////////////////////////////// 2158 void rpc_vfs_fs_new_dentry_client( cxy_t cxy, 2159 vfs_inode_t * parent_inode, // in 2160 char * name, // in 2161 xptr_t child_inode_xp, // in 2162 error_t * error ) // out 2163 { 2164 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 2165 thread_t * this = CURRENT_THREAD; 2166 uint32_t cycle = (uint32_t)hal_get_cycles(); 2167 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 2168 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2169 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2170 #endif 2171 2172 uint32_t responses = 1; 2173 2174 // initialise RPC descriptor header 2175 rpc_desc_t rpc; 2176 rpc.index = RPC_VFS_FS_NEW_DENTRY; 2177 rpc.blocking = true; 2178 rpc.rsp = &responses; 2179 2180 // set input arguments in RPC descriptor 2181 rpc.args[0] = (uint64_t)(intptr_t)parent_inode; 2182 rpc.args[1] = (uint64_t)(intptr_t)name; 2183 rpc.args[2] = (uint64_t)child_inode_xp; 2184 2185 // register RPC request in remote RPC fifo 2186 rpc_send( cxy , &rpc ); 2187 2188 // get output values from RPC descriptor 2189 *error = (error_t)rpc.args[3]; 2190 2191 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 2192 cycle = (uint32_t)hal_get_cycles(); 2193 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 2194 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2195 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2196 #endif 2197 } 2198 2199 ////////////////////////////////////////////// 2200 void rpc_vfs_fs_new_dentry_server( xptr_t xp ) 2201 { 2202 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 2203 thread_t * this = CURRENT_THREAD; 2204 uint32_t cycle = (uint32_t)hal_get_cycles(); 2205 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 2206 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2207 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2208 #endif 2209 2210 error_t error; 2211 vfs_inode_t * parent; 2212 xptr_t child_xp; 2213 char * name; 2214 2215 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 2216 2217 // get client cluster identifier and pointer on RPC descriptor 2218 cxy_t client_cxy = GET_CXY( xp ); 2219 rpc_desc_t * desc = GET_PTR( xp ); 2220 2221 // get arguments "parent", "name", and "child_xp" 2222 parent = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 2223 name = (char*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 2224 child_xp = (xptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[2])); 2225 2226 // get name local copy 2227 hal_remote_strcpy( XPTR( local_cxy , name_copy ) , 2228 XPTR( client_cxy , name ) ); 2229 2230 // call the kernel function 2231 error = vfs_fs_new_dentry( parent , name_copy , child_xp ); 2232 2233 // set output argument 2234 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 2235 2236 #if DEBUG_RPC_VFS_FS_NEW_DENTRY 2237 cycle = (uint32_t)hal_get_cycles(); 2238 if( cycle > DEBUG_RPC_VFS_FS_NEW_DENTRY ) 2239 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2240 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2241 #endif 2242 } 2243 2244 ///////////////////////////////////////////////////////////////////////////////////////// 2245 // [17] RPC_VFS_FS_ADD_DENTRY deprecated [AG] dec 2019 2246 ///////////////////////////////////////////////////////////////////////////////////////// 2247 void rpc_vfs_fs_add_dentry_client( cxy_t cxy, 2248 vfs_inode_t * parent, // in 2249 vfs_dentry_t * dentry, // in 2250 error_t * error ) // out 2251 { 2252 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 2253 thread_t * this = CURRENT_THREAD; 2254 uint32_t cycle = (uint32_t)hal_get_cycles(); 2255 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 2256 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2257 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2258 #endif 2259 2260 uint32_t responses = 1; 2261 2262 // initialise RPC descriptor header 2263 rpc_desc_t rpc; 2264 rpc.index = RPC_VFS_FS_ADD_DENTRY; 2265 rpc.blocking = true; 2266 rpc.rsp = &responses; 2267 2268 // set input arguments in RPC descriptor 2269 rpc.args[0] = (uint64_t)(intptr_t)parent; 2270 rpc.args[1] = (uint64_t)(intptr_t)dentry; 2271 2272 // register RPC request in remote RPC fifo 2273 rpc_send( cxy , &rpc ); 2274 2275 // get output values from RPC descriptor 2276 *error = (error_t)rpc.args[2]; 2277 2278 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 2279 cycle = (uint32_t)hal_get_cycles(); 2280 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 2281 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2282 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2283 #endif 2284 } 2285 2286 ////////////////////////////////////////////// 2287 void rpc_vfs_fs_add_dentry_server( xptr_t xp ) 2288 { 2289 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 2290 thread_t * this = CURRENT_THREAD; 2291 uint32_t cycle = (uint32_t)hal_get_cycles(); 2292 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 2293 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2294 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2295 #endif 2296 2297 error_t error; 2298 vfs_inode_t * parent; 2299 vfs_dentry_t * dentry; 2300 2301 // get client cluster identifier and pointer on RPC descriptor 2302 cxy_t client_cxy = GET_CXY( xp ); 2303 rpc_desc_t * desc = GET_PTR( xp ); 2304 2305 // get input arguments 2306 parent = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 2307 dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 2308 2309 // call the kernel function 2310 error = vfs_fs_add_dentry( parent , dentry ); 2311 2312 // set output argument 2313 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)error ); 2314 2315 #if DEBUG_RPC_VFS_FS_ADD_DENTRY 2316 cycle = (uint32_t)hal_get_cycles(); 2317 if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) 2318 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2319 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2320 #endif 2321 } 2322 2323 ///////////////////////////////////////////////////////////////////////////////////////// 2324 // [18] RPC_VFS_FS_REMOVE_DENTRY deprecated [AG] dec 2019 2325 ///////////////////////////////////////////////////////////////////////////////////////// 2326 void rpc_vfs_fs_remove_dentry_client( cxy_t cxy, 2327 vfs_inode_t * parent, // in 2328 vfs_dentry_t * dentry, // in 2329 error_t * error ) // out 2330 { 2331 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 2332 thread_t * this = CURRENT_THREAD; 2333 uint32_t cycle = (uint32_t)hal_get_cycles(); 2334 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 2335 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2336 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2337 #endif 2338 2339 uint32_t responses = 1; 2340 2341 // initialise RPC descriptor header 2342 rpc_desc_t rpc; 2343 rpc.index = RPC_VFS_FS_REMOVE_DENTRY; 2344 rpc.blocking = true; 2345 rpc.rsp = &responses; 2346 2347 // set input arguments in RPC descriptor 2348 rpc.args[0] = (uint64_t)(intptr_t)parent; 2349 rpc.args[1] = (uint64_t)(intptr_t)dentry; 2350 2351 // register RPC request in remote RPC fifo 2352 rpc_send( cxy , &rpc ); 2353 2354 // get output values from RPC descriptor 2355 *error = (error_t)rpc.args[2]; 2356 2357 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 2358 cycle = (uint32_t)hal_get_cycles(); 2359 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 2360 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2361 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2362 #endif 2363 } 2364 2365 ///////////////////////////////////////////////// 2366 void rpc_vfs_fs_remove_dentry_server( xptr_t xp ) 2367 { 2368 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 2369 thread_t * this = CURRENT_THREAD; 2370 uint32_t cycle = (uint32_t)hal_get_cycles(); 2371 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 2372 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2373 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2374 #endif 2375 2376 error_t error; 2377 vfs_inode_t * parent; 2378 vfs_dentry_t * dentry; 2379 2380 // get client cluster identifier and pointer on RPC descriptor 2381 cxy_t client_cxy = GET_CXY( xp ); 2382 rpc_desc_t * desc = GET_PTR( xp ); 2383 2384 // get input arguments 2385 parent = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 2386 dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); 2387 2388 // call the kernel function 2389 error = vfs_fs_remove_dentry( parent , dentry ); 2390 2391 // set output argument 2392 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)error ); 2393 2394 #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY 2395 cycle = (uint32_t)hal_get_cycles(); 2396 if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) 2397 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2398 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2399 #endif 2400 } 2401 2402 ///////////////////////////////////////////////////////////////////////////////////////// 2403 // [19] RPC_VFS_INODE_LOAD_ALL_PAGES deprecated [AG] dec 2019 2404 ///////////////////////////////////////////////////////////////////////////////////////// 2405 void rpc_vfs_inode_load_all_pages_client( cxy_t cxy, 2406 vfs_inode_t * inode, // in 2407 error_t * error ) // out 2408 { 2409 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2410 thread_t * this = CURRENT_THREAD; 2411 uint32_t cycle = (uint32_t)hal_get_cycles(); 2412 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2413 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2414 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2415 #endif 2416 2417 uint32_t responses = 1; 2418 2419 // initialise RPC descriptor header 2420 rpc_desc_t rpc; 2421 rpc.index = RPC_VFS_INODE_LOAD_ALL_PAGES; 2422 rpc.blocking = true; 2423 rpc.rsp = &responses; 2424 2425 // set input arguments in RPC descriptor 2426 rpc.args[0] = (uint64_t)(intptr_t)inode; 2427 2428 // register RPC request in remote RPC fifo 2429 rpc_send( cxy , &rpc ); 2430 2431 // get output values from RPC descriptor 2432 *error = (error_t)rpc.args[1]; 2433 2434 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2435 cycle = (uint32_t)hal_get_cycles(); 2436 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2437 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2438 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2439 #endif 2440 } 2441 2442 ///////////////////////////////////////////////////// 2443 void rpc_vfs_inode_load_all_pages_server( xptr_t xp ) 2444 { 2445 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2446 thread_t * this = CURRENT_THREAD; 2447 uint32_t cycle = (uint32_t)hal_get_cycles(); 2448 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2449 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2450 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2451 #endif 2452 2453 error_t error; 2454 vfs_inode_t * inode; 2455 2456 // get client cluster identifier and pointer on RPC descriptor 2457 cxy_t client_cxy = GET_CXY( xp ); 2458 rpc_desc_t * desc = GET_PTR( xp ); 2459 2460 // get input argument 2461 inode = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 2462 2463 // call the kernel function 2464 error = vfs_inode_load_all_pages( inode ); 2465 2466 // set output argument 2467 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 2468 2469 #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES 2470 cycle = (uint32_t)hal_get_cycles(); 2471 if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) 2472 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2473 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2474 #endif 2475 } 2476 2477 ///////////////////////////////////////////////////////////////////////////////////////// 2478 // [20] RPC_VMM_GET_VSEG deprecated [AG] sept 2019 2479 ///////////////////////////////////////////////////////////////////////////////////////// 2480 void rpc_vmm_get_vseg_client( cxy_t cxy, 2481 process_t * process, // in 2482 intptr_t vaddr, // in 2483 xptr_t * vseg_xp, // out 2484 error_t * error ) // out 2485 { 2486 #if DEBUG_RPC_VMM_GET_VSEG 2487 thread_t * this = CURRENT_THREAD; 2488 uint32_t cycle = (uint32_t)hal_get_cycles(); 2489 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2490 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2491 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2492 #endif 2493 2494 uint32_t responses = 1; 2495 2496 // initialise RPC descriptor header 2497 rpc_desc_t rpc; 2498 rpc.index = RPC_VMM_GET_VSEG; 2499 rpc.blocking = true; 2500 rpc.rsp = &responses; 2501 2502 // set input arguments in RPC descriptor 2503 rpc.args[0] = (uint64_t)(intptr_t)process; 2504 rpc.args[1] = (uint64_t)vaddr; 2505 2506 // register RPC request in remote RPC fifo 2507 rpc_send( cxy , &rpc ); 2508 2509 // get output argument from rpc descriptor 2510 *vseg_xp = rpc.args[2]; 2511 *error = (error_t)rpc.args[3]; 2512 2513 #if DEBUG_RPC_VMM_GET_VSEG 2514 cycle = (uint32_t)hal_get_cycles(); 2515 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2516 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2517 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2518 #endif 2519 } 2520 2521 ///////////////////////////////////////// 2522 void rpc_vmm_get_vseg_server( xptr_t xp ) 2523 { 2524 #if DEBUG_RPC_VMM_GET_VSEG 2525 thread_t * this = CURRENT_THREAD; 2526 uint32_t cycle = (uint32_t)hal_get_cycles(); 2527 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2528 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2529 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2530 #endif 2531 2532 process_t * process; 2533 intptr_t vaddr; 2534 vseg_t * vseg_ptr; 2535 xptr_t vseg_xp; 2536 error_t error; 2537 2538 // get client cluster identifier and pointer on RPC descriptor 2539 cxy_t client_cxy = GET_CXY( xp ); 2540 rpc_desc_t * desc = GET_PTR( xp ); 2541 2542 // get input argument from client RPC descriptor 2543 process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2544 vaddr = (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2545 2546 // call local kernel function 2547 error = vmm_get_vseg( process , vaddr , &vseg_ptr ); 2548 2549 // set output arguments to client RPC descriptor 2550 vseg_xp = XPTR( local_cxy , vseg_ptr ); 2551 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp ); 2552 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 2553 2554 #if DEBUG_RPC_VMM_GET_VSEG 2555 cycle = (uint32_t)hal_get_cycles(); 2556 if( cycle > DEBUG_RPC_VMM_GET_VSEG ) 2557 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2558 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2559 #endif 2560 } 2561 2562 ///////////////////////////////////////////////////////////////////////////////////////// 2563 // [22] RPC_KCM_ALLOC deprecated [AG] sept 2019 2564 ///////////////////////////////////////////////////////////////////////////////////////// 2565 void rpc_kcm_alloc_client( cxy_t cxy, 2566 uint32_t kmem_type, // in 2567 xptr_t * buf_xp ) // out 2568 { 2569 #if DEBUG_RPC_KCM_ALLOC 2570 thread_t * this = CURRENT_THREAD; 2571 uint32_t cycle = (uint32_t)hal_get_cycles(); 2572 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2573 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2574 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2575 #endif 2576 2577 uint32_t responses = 1; 2578 2579 // initialise RPC descriptor header 2580 rpc_desc_t rpc; 2581 rpc.index = RPC_KCM_ALLOC; 2582 rpc.blocking = true; 2583 rpc.rsp = &responses; 2584 2585 // set input arguments in RPC descriptor 2586 rpc.args[0] = (uint64_t)kmem_type; 2587 2588 // register RPC request in remote RPC fifo 2589 rpc_send( cxy , &rpc ); 2590 2591 // get output arguments from RPC descriptor 2592 *buf_xp = (xptr_t)rpc.args[1]; 2593 2594 #if DEBUG_RPC_KCM_ALLOC 2595 cycle = (uint32_t)hal_get_cycles(); 2596 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2597 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2598 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2599 #endif 2600 } 2601 2602 ////////////////////////////////////// 2603 void rpc_kcm_alloc_server( xptr_t xp ) 2604 { 2605 #if DEBUG_RPC_KCM_ALLOC 2606 thread_t * this = CURRENT_THREAD; 2607 uint32_t cycle = (uint32_t)hal_get_cycles(); 2608 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2609 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2610 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2611 #endif 2612 2613 // get client cluster identifier and pointer on RPC descriptor 2614 cxy_t client_cxy = GET_CXY( xp ); 2615 rpc_desc_t * desc = GET_PTR( xp ); 2616 2617 // get input argument "kmem_type" from client RPC descriptor 2618 uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2619 2620 // allocates memory for kcm 2621 kmem_req_t req; 2622 req.type = kmem_type; 2623 req.flags = AF_ZERO; 2624 void * buf_ptr = kmem_alloc( &req ); 2625 2626 // set output argument 2627 xptr_t buf_xp = XPTR( local_cxy , buf_ptr ); 2628 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp ); 2629 2630 #if DEBUG_RPC_KCM_ALLOC 2631 cycle = (uint32_t)hal_get_cycles(); 2632 if( cycle > DEBUG_RPC_KCM_ALLOC ) 2633 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2634 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2635 #endif 2636 } 2637 2638 ///////////////////////////////////////////////////////////////////////////////////////// 2639 // [23] RPC_KCM_FREE deprecated [AG] sept 2019 2640 ///////////////////////////////////////////////////////////////////////////////////////// 2641 void rpc_kcm_free_client( cxy_t cxy, 2642 void * buf, // in 2643 uint32_t kmem_type ) // in 2644 { 2645 #if DEBUG_RPC_KCM_FREE 2646 thread_t * this = CURRENT_THREAD; 2647 uint32_t cycle = (uint32_t)hal_get_cycles(); 2648 if( cycle > DEBUG_RPC_KCM_FREE ) 2649 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2650 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2651 #endif 2652 2653 uint32_t responses = 1; 2654 2655 // initialise RPC descriptor header 2656 rpc_desc_t rpc; 2657 rpc.index = RPC_KCM_FREE; 2658 rpc.blocking = true; 2659 rpc.rsp = &responses; 2660 2661 // set input arguments in RPC descriptor 2662 rpc.args[0] = (uint64_t)(intptr_t)buf; 2663 rpc.args[1] = (uint64_t)kmem_type; 2664 2665 // register RPC request in remote RPC fifo 2666 rpc_send( cxy , &rpc ); 2667 2668 #if DEBUG_RPC_KCM_FREE 2669 cycle = (uint32_t)hal_get_cycles(); 2670 if( cycle > DEBUG_RPC_KCM_FREE ) 2671 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2672 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2673 #endif 2674 } 2675 2676 ///////////////////////////////////// 2677 void rpc_kcm_free_server( xptr_t xp ) 2678 { 2679 #if DEBUG_RPC_KCM_FREE 2680 thread_t * this = CURRENT_THREAD; 2681 uint32_t cycle = (uint32_t)hal_get_cycles(); 2682 if( cycle > DEBUG_RPC_KCM_FREE ) 2683 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2684 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2685 #endif 2686 2687 // get client cluster identifier and pointer on RPC descriptor 2688 cxy_t client_cxy = GET_CXY( xp ); 2689 rpc_desc_t * desc = GET_PTR( xp ); 2690 2691 // get input arguments "buf" and "kmem_type" from client RPC descriptor 2692 void * buf = (void *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2693 uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2694 2695 // releases memory 2696 kmem_req_t req; 2697 req.type = kmem_type; 2698 req.ptr = buf; 2699 kmem_free( &req ); 2700 2701 #if DEBUG_RPC_KCM_FREE 2702 cycle = (uint32_t)hal_get_cycles(); 2703 if( cycle > DEBUG_RPC_KCM_FREE ) 2704 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2705 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2706 #endif 2707 } 2708 2709 ///////////////////////////////////////////////////////////////////////////////////////// 2710 // [24] Marshaling functions attached to RPC_MAPPER_SYNC 2711 ///////////////////////////////////////////////////////////////////////////////////////// 2712 void rpc_mapper_sync_client( cxy_t cxy, 2713 struct mapper_s * mapper, 2714 error_t * error ) 2715 { 2716 #if DEBUG_RPC_MAPPER_SYNC 2717 thread_t * this = CURRENT_THREAD; 2718 uint32_t cycle = (uint32_t)hal_get_cycles(); 2719 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2720 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2721 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2722 #endif 2723 2724 uint32_t responses = 1; 2725 2726 // initialise RPC descriptor header 2727 rpc_desc_t rpc; 2728 rpc.index = RPC_MAPPER_SYNC; 2729 rpc.blocking = true; 2730 rpc.rsp = &responses; 2731 2732 // set input arguments in RPC descriptor 2733 rpc.args[0] = (uint64_t)(intptr_t)mapper; 2734 2735 // register RPC request in remote RPC fifo 2736 rpc_send( cxy , &rpc ); 2737 2738 // get output values from RPC descriptor 2739 *error = (error_t)rpc.args[1]; 2740 2741 #if DEBUG_RPC_MAPPER_SYNC 2742 cycle = (uint32_t)hal_get_cycles(); 2743 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2744 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2745 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2746 #endif 2747 } 2748 2749 //////////////////////////////////////// 2750 void rpc_mapper_sync_server( xptr_t xp ) 2751 { 2752 #if DEBUG_RPC_MAPPER_SYNC 2753 thread_t * this = CURRENT_THREAD; 2754 uint32_t cycle = (uint32_t)hal_get_cycles(); 2755 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2756 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2757 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2758 #endif 2759 2760 mapper_t * mapper; 2761 error_t error; 2762 2763 // get client cluster identifier and pointer on RPC descriptor 2764 cxy_t client_cxy = GET_CXY( xp ); 2765 rpc_desc_t * desc = GET_PTR( xp ); 2766 2767 // get arguments from client RPC descriptor 2768 mapper = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2769 2770 // call local kernel function 2771 error = mapper_sync( mapper ); 2772 2773 // set output argument to client RPC descriptor 2774 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 2775 2776 #if DEBUG_RPC_MAPPER_SYNC 2777 cycle = (uint32_t)hal_get_cycles(); 2778 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2779 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2780 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2781 #endif 2782 } 2783 2806 2784 */ 2785 2786 2787 2788 /* 2789 //////////////////////////////////////////////////// 2790 void rpc_fbf_display_client( cxy_t cxy, 2791 xptr_t window_xp, 2792 uint32_t cores, 2793 error_t * error ) 2794 { 2795 #if DEBUG_RPC_FBF_DISPLAY 2796 uint32_t cycle = (uint32_t)hal_get_cycles(); 2797 thread_t * this = CURRENT_THREAD; 2798 if( DEBUG_RPC_FBF_DISPLAY < cycle ) 2799 printk("\n[%s] thread[%x,%x] on core %d : enter / cycle %d\n", 2800 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2801 #endif 2802 2803 uint32_t responses = 1; 2804 rpc_desc_t rpc; 2805 2806 // initialise RPC descriptor header 2807 rpc.index = RPC_FBF_DISPLAY; 2808 rpc.blocking = true; 2809 rpc.rsp = &responses; 2810 2811 // set input arguments in RPC descriptor 2812 rpc.args[0] = (uint64_t)window_xp; 2813 rpc.args[1] = (uint64_t)cores; 2814 2815 // register RPC request in remote RPC fifo 2816 rpc_send( cxy , &rpc ); 2817 2818 // get output argument from RPC descriptor 2819 *error = (error_t)rpc.args[2]; 2820 2821 #if DEBUG_RPC_FBF_DISPLAY 2822 cycle = (uint32_t)hal_get_cycles(); 2823 if( DEBUG_RPC_FBF_DISPLAY < cycle ) 2824 printk("\n[%s] thread[%x,%x] on core %d : exit / cycle %d\n", 2825 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2826 #endif 2827 } 2828 2829 //////////////////////////////////////// 2830 void rpc_fbf_display_server( xptr_t xp ) 2831 { 2832 // get client cluster identifier and pointer on RPC descriptor 2833 cxy_t client_cxy = GET_CXY( xp ); 2834 rpc_desc_t * desc = GET_PTR( xp ); 2835 2836 // get arguments from RPC descriptor 2837 xptr_t window_xp = (xptr_t )hal_remote_l64( XPTR(client_cxy , &desc->args[0]) ); 2838 uint32_t ncores = (uint32_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) ); 2839 2840 #if DEBUG_RPC_FBF_DISPLAY 2841 uint32_t cycle = (uint32_t)hal_get_cycles(); 2842 thread_t * this = CURRENT_THREAD; 2843 if( DEBUG_RPC_FBF_DISPLAY < cycle ) 2844 printk("\n[%s] thread[%x,%x] on core %d : enter / cycle %d\n", 2845 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2846 #endif 2847 2848 // call relevant kernel function 2849 error_t error = dev_fbf_parallel_display( window_xp , ncores ); 2850 2851 // WARNING : for parallel RPCs, the return error argument is shared 2852 hal_remote_atomic_or( XPTR( client_cxy , &desc->args[2] ) , error ); 2853 2854 #if DEBUG_RPC_FBF_DISPLAY 2855 cycle = (uint32_t)hal_get_cycles(); 2856 if( DEBUG_RPC_FBF_DISPLAY < cycle ) 2857 printk("\n[%s] thread[%x,%x] on core %d : exit / cycle %d\n", 2858 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2859 #endif 2860 } 2861 */ 2862 2863 -
trunk/kernel/kern/rpc.h
r641 r657 2 2 * rpc.h - RPC (Remote Procedure Call) operations definition. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 68 68 RPC_THREAD_USER_CREATE = 6, 69 69 RPC_THREAD_KERNEL_CREATE = 7, 70 RPC_ VFS_FS_UPDATE_DENTRY= 8,70 RPC_UNDEFINED_8 = 8, 71 71 RPC_PROCESS_SIGACTION = 9, 72 72 73 RPC_VFS_INODE_CREATE = 10, 74 RPC_VFS_INODE_DESTROY = 11, 75 RPC_VFS_DENTRY_CREATE = 12, 76 RPC_VFS_DENTRY_DESTROY = 13, 77 RPC_VFS_FILE_CREATE = 14, 78 RPC_VFS_FILE_DESTROY = 15, 79 RPC_VFS_FS_NEW_DENTRY = 16, 80 RPC_VFS_FS_ADD_DENTRY = 17, 81 RPC_VFS_FS_REMOVE_DENTRY = 18, 82 RPC_VFS_INODE_LOAD_ALL_PAGES = 19, 83 84 RPC_UNDEFINED_20 = 20, // 85 RPC_UNDEFINED_21 = 21, // 86 RPC_UNDEFINED_22 = 22, // 87 RPC_UNDEFINED_23 = 23, // 88 RPC_MAPPER_SYNC = 24, 89 RPC_VMM_RESIZE_VSEG = 25, 90 RPC_VMM_REMOVE_VSEG = 26, 91 RPC_VMM_CREATE_VSEG = 27, 92 RPC_VMM_SET_COW = 28, 93 RPC_UNDEFINED_29 = 29, // 94 95 RPC_MAX_INDEX = 30, 73 RPC_UNDEFINED_10 = 10, // 74 RPC_UNDEFINED_11 = 11, // 75 RPC_UNDEFINED_12 = 12, // 76 RPC_UNDEFINED_13 = 13, // 77 RPC_UNDEFINED_14 = 14, // 78 RPC_VMM_RESIZE_VSEG = 15, 79 RPC_VMM_REMOVE_VSEG = 16, 80 RPC_VMM_CREATE_VSEG = 17, 81 RPC_VMM_SET_COW = 18, 82 RPC_UNDEFINED_19 = 19, // 83 84 RPC_MAX_INDEX = 20, 96 85 } 97 86 rpc_index_t; … … 288 277 289 278 /*********************************************************************************** 290 * [8] The RPC_VFS_FS_UPDATE_DENTRY allows a client thread to request a remote 291 * cluster to update the <size> field of a directory entry in the mapper of a 292 * remote directory inode, identified by the <inode> local pointer. 293 * The target entry name is identified by the <dentry> local pointer. 294 *********************************************************************************** 295 * @ cxy : server cluster identifier. 296 * @ inode : [in] local pointer on remote directory inode. 297 * @ dentry : [in] local pointer on remote dentry. 298 * @ size : [in] new size value. 299 * @ error : [out] error status (0 if success). 300 **********************************************************************************/ 301 void rpc_vfs_fs_update_dentry_client( cxy_t cxy, 302 struct vfs_inode_s * inode, 303 struct vfs_dentry_s * dentry, 304 uint32_t size, 305 error_t * error ); 306 307 void rpc_vfs_fs_update_dentry_server( xptr_t xp ); 279 * [8] undefined 280 **********************************************************************************/ 308 281 309 282 /*********************************************************************************** 310 283 * [9] The RPC_PROCESS_SIGACTION allows a client thread to request a remote cluster 311 284 * to execute a given sigaction, defined by the <action_type> for a given process, 312 * identified by the <pid> argument. 285 * identified by the <pid> argument. When this RPC is used in parallel mode, 286 * the rpc_process_sigaction_client() function is not used. 313 287 *********************************************************************************** 314 288 * @ cxy : server cluster identifier. … … 323 297 324 298 /*********************************************************************************** 325 * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a 326 * remote cluster. The parent dentry must have been previously created. 327 * It returns an extended pointer on the created inode. 328 *********************************************************************************** 329 * @ cxy : server cluster identifier. 330 * @ fs_type : [in] file system type. 331 * @ inode_type : [in] file system type. 332 * @ attr : [in] inode attributes. 333 * @ rights : [in] access rights 334 * @ uid : [in] user ID 335 * @ gid : [in] group ID 336 * @ inode_xp : [out] buffer for extended pointer on created inode. 337 * @ error : [out] error status (0 if success). 338 **********************************************************************************/ 339 void rpc_vfs_inode_create_client( cxy_t cxy, 340 uint32_t fs_type, 341 uint32_t attr, 342 uint32_t rights, 343 uint32_t uid, 344 uint32_t gid, 345 xptr_t * inode_xp, 346 error_t * error ); 347 348 void rpc_vfs_inode_create_server( xptr_t xp ); 299 * [10] undefined 300 **********************************************************************************/ 349 301 350 302 /*********************************************************************************** 351 * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor 352 * and for the associated mapper in a remote cluster. 353 *********************************************************************************** 354 * @ cxy : server cluster identifier 355 * @ inode : [in] local pointer on inode. 356 **********************************************************************************/ 357 void rpc_vfs_inode_destroy_client( cxy_t cxy, 358 struct vfs_inode_s * inode ); 359 360 void rpc_vfs_inode_destroy_server( xptr_t xp ); 303 * [11] undefined 304 **********************************************************************************/ 361 305 362 306 /*********************************************************************************** 363 * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster. 364 * It returns an extended pointer on the created dentry. 365 *********************************************************************************** 366 * @ cxy : server cluster identifier 367 * @ type : [in] file system type. 368 * @ name : [in] directory entry name. 369 * @ dentry_xp : [out] buffer for extended pointer on created dentry. 370 * @ error : [out] error status (0 if success). 371 **********************************************************************************/ 372 void rpc_vfs_dentry_create_client( cxy_t cxy, 373 uint32_t type, 374 char * name, 375 xptr_t * dentry_xp, 376 error_t * error ); 377 378 void rpc_vfs_dentry_create_server( xptr_t xp ); 307 * [12] undefined 308 **********************************************************************************/ 379 309 380 310 /*********************************************************************************** 381 * [13] The RPC_VFS_DENTRY_DESTROY remove a denfry from the parent inode XHTAB, 382 * and releases memory allocated for the dentry descriptor in a remote cluster. 383 *********************************************************************************** 384 * @ cxy : server cluster identifier 385 * @ dentry : [in] local pointer on dentry. 386 **********************************************************************************/ 387 void rpc_vfs_dentry_destroy_client( cxy_t cxy, 388 struct vfs_dentry_s * dentry ); 389 390 void rpc_vfs_dentry_destroy_server( xptr_t xp ); 391 392 /*********************************************************************************** 393 * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster. 394 * It returns an extended pointer on the created file structure. 395 *********************************************************************************** 396 * @ cxy : server cluster identifier 397 * @ inode : [in] local pointer on parent inode. 398 * @ file_attr : [in] new file attributes. 399 * @ file_xp : [out] buffer for extended pointer on created file. 400 * @ error : [out] error status (0 if success). 401 **********************************************************************************/ 402 void rpc_vfs_file_create_client( cxy_t cxy, 403 struct vfs_inode_s * inode, 404 uint32_t file_attr, 405 xptr_t * file_xp, 406 error_t * error ); 407 408 void rpc_vfs_file_create_server( xptr_t xp ); 409 410 /*********************************************************************************** 411 * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor 412 * in a remote cluster. 413 *********************************************************************************** 414 * @ cxy : server cluster identifier 415 * @ file : [in] local pointer on file. 416 **********************************************************************************/ 417 void rpc_vfs_file_destroy_client( cxy_t cxy, 418 struct vfs_file_s * file ); 419 420 void rpc_vfs_file_destroy_server( xptr_t xp ); 421 422 /*********************************************************************************** 423 * [16] The RPC_VFS_FS_GET_DENTRY calls the vfs_fs_new_dentry() 424 * function in a remote cluster containing a parent inode directory to scan the 425 * associated mapper, find a directory entry identified by its name, and update 426 * both the - existing - child inode and dentry. 427 *********************************************************************************** 428 * @ cxy : server cluster identifier 429 * @ parent_inode : [in] local pointer on parent inode. 430 * @ name : [in] local pointer on child name (in client cluster). 431 * @ child_inode_xp : [in] extended pointer on child inode (in another cluster). 432 * @ error : [out] error status (0 if success). 433 **********************************************************************************/ 434 void rpc_vfs_fs_new_dentry_client( cxy_t cxy, 435 struct vfs_inode_s * parent_inode, 436 char * name, 437 xptr_t child_inode_xp, 438 error_t * error ); 439 440 void rpc_vfs_fs_new_dentry_server( xptr_t xp ); 441 442 /*********************************************************************************** 443 * [17] The RPC_VFS_FS_ADD_DENTRY calls the vfs_fs_add_dentry() function in a 444 * remote cluster containing a directory inode and mapper, to add a new dentry 445 * in the mapper of this directory. 446 *********************************************************************************** 447 * @ cxy : server cluster identifier 448 * @ parent : [in] local pointer on directory inode. 449 * @ dentry : [in] local pointer on dentry. 450 * @ error : [out] error status (0 if success). 451 **********************************************************************************/ 452 void rpc_vfs_fs_add_dentry_client( cxy_t, 453 struct vfs_inode_s * parent, 454 struct vfs_dentry_s * dentry, 455 error_t * error ); 456 457 void rpc_vfs_fs_add_dentry_server( xptr_t xp ); 458 459 /*********************************************************************************** 460 * [18] The RPC_VFS_FS_REMOVE_DENTRY calls the vfs_fs_remove_dentry() function in a 461 * remote cluster containing a directory inode and mapper, to remove a dentry from 462 * the mapper of this directory. 463 *********************************************************************************** 464 * @ cxy : server cluster identifier 465 * @ parent : [in] local pointer on directory inode. 466 * @ dentry : [in] local pointer on dentry. 467 * @ error : [out] error status (0 if success). 468 **********************************************************************************/ 469 void rpc_vfs_fs_remove_dentry_client( cxy_t, 470 struct vfs_inode_s * parent, 471 struct vfs_dentry_s * dentry, 472 error_t * error ); 473 474 void rpc_vfs_fs_remove_dentry_server( xptr_t xp ); 475 476 /*********************************************************************************** 477 * [19] The RPC_VFS_INODE_LOAD_ALL_PAGES calls the vfs_inode_load_all_pages() 478 * function a remote cluster containing an inode to load all pages in the 479 * associated mapper. 480 *********************************************************************************** 481 * @ cxy : server cluster identifier 482 * @ inode : [in] local pointer on inode in server cluster. 483 * @ error : [out] error status (0 if success). 484 **********************************************************************************/ 485 void rpc_vfs_inode_load_all_pages_client( cxy_t cxy, 486 struct vfs_inode_s * inode, 487 error_t * error ); 488 489 void rpc_vfs_inode_load_all_pages_server( xptr_t xp ); 490 491 /*********************************************************************************** 492 * [20] undefined 493 **********************************************************************************/ 494 495 /*********************************************************************************** 496 * [21] undefined 497 **********************************************************************************/ 498 499 /*********************************************************************************** 500 * [22] undefined 501 **********************************************************************************/ 502 503 /*********************************************************************************** 504 * [23] undefined 505 **********************************************************************************/ 506 507 /*********************************************************************************** 508 * [24] The RPC_MAPPER_SYNC allows a client thread to synchronize on disk 509 * all dirty pages of a remote mapper. 510 *********************************************************************************** 511 * @ cxy : server cluster identifier. 512 * @ mapper : [in] local pointer on mapper in server cluster. 513 * @ error : [out] error status (0 if success). 514 **********************************************************************************/ 515 void rpc_mapper_sync_client( cxy_t cxy, 516 struct mapper_s * mapper, 517 error_t * error ); 518 519 void rpc_mapper_sync_server( xptr_t xp ); 520 521 /*********************************************************************************** 522 * [25] The RPC_VMM_RESIZE_VSEG allows a client thread to request a remote cluster 311 * [13] undefined 312 **********************************************************************************/ 313 314 /*********************************************************************************** 315 * [14] undefined 316 **********************************************************************************/ 317 318 /*********************************************************************************** 319 * [15] The RPC_VMM_RESIZE_VSEG allows a client thread to request a remote cluster 523 320 * to resize a vseg identified by the <base> argument in a process descriptor 524 321 * identified by the <pid> argument, as defined by the <new_base> and <new_size> … … 540 337 541 338 /*********************************************************************************** 542 * [ 26] The RPC_VMM_REMOVE_VSEG allows a client thread to request a remote cluster339 * [16] The RPC_VMM_REMOVE_VSEG allows a client thread to request a remote cluster 543 340 * to delete a vseg identified by the <vaddr> argument in a process descriptor 544 341 * identified by the <pid> argument. … … 556 353 557 354 /*********************************************************************************** 558 * [ 27] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote355 * [17] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote 559 356 * reference cluster of a given process to allocate and register in the reference 560 357 * process VMM a new vseg descriptor. … … 587 384 588 385 /*********************************************************************************** 589 * [ 28] The RPC_VMM_SET_COW allows a client thread to request the remote reference386 * [18] The RPC_VMM_SET_COW allows a client thread to request the remote reference 590 387 * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for 591 388 * the DATA, MMAP and REMOTE vsegs of process identified by the <process> argument. … … 602 399 603 400 /*********************************************************************************** 604 * [ 29] undefined401 * [19] undefined 605 402 **********************************************************************************/ 606 403 -
trunk/kernel/kern/thread.h
r651 r657 3 3 * 4 4 * Author Ghassan Almaless (2008,2009,2010,2011,2012) 5 * Alain Greiner (2016,2017,2018,2019 )5 * Alain Greiner (2016,2017,2018,2019,2020) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites … … 81 81 **************************************************************************************/ 82 82 83 #define THREAD_BLOCKED_GLOBAL 0x0001 /*! thread deactivated / wait activation */ 84 #define THREAD_BLOCKED_IO 0x0002 /*! thread wait IO operation completion */ 85 #define THREAD_BLOCKED_MAPPER 0x0004 /*! thread wait mapper */ 86 #define THREAD_BLOCKED_EXIT 0x0008 /*! thread blocked in join / wait exit */ 87 #define THREAD_BLOCKED_JOIN 0x0010 /*! thread blocked in exit / wait join */ 88 #define THREAD_BLOCKED_SEM 0x0020 /*! thread wait semaphore */ 89 #define THREAD_BLOCKED_PAGE 0x0040 /*! thread wait page access */ 90 #define THREAD_BLOCKED_IDLE 0x0080 /*! thread RPC wait RPC_FIFO non empty */ 91 #define THREAD_BLOCKED_USERSYNC 0x0100 /*! thread wait (cond/mutex/barrier) */ 92 #define THREAD_BLOCKED_RPC 0x0200 /*! thread wait RPC completion */ 93 #define THREAD_BLOCKED_ISR 0x0400 /*! thread DEV wait ISR */ 94 #define THREAD_BLOCKED_WAIT 0x0800 /*! thread wait child process termination */ 95 #define THREAD_BLOCKED_LOCK 0x1000 /*! thread wait queuelock or rwlock */ 83 #define THREAD_BLOCKED_GLOBAL 0x0001 /*! ANY : deactivated / wait activation */ 84 #define THREAD_BLOCKED_IO 0x0002 /*! USR : wait IO operation completion */ 85 #define THREAD_BLOCKED_MAPPER 0x0004 /*! ??? : wait mapper */ 86 #define THREAD_BLOCKED_EXIT 0x0008 /*! USR : blocked in join / wait exit */ 87 #define THREAD_BLOCKED_JOIN 0x0010 /*! USR : blocked in exit / wait join */ 88 #define THREAD_BLOCKED_SEM 0x0020 /*! USR : wait semaphore */ 89 #define THREAD_BLOCKED_PAGE 0x0040 /*! ??? : wait page access */ 90 #define THREAD_BLOCKED_IDLE 0x0080 /*! RPC : RPC_FIFO non empty */ 91 #define THREAD_BLOCKED_USERSYNC 0x0100 /*! USR : wait cond / mutex / barrier */ 92 #define THREAD_BLOCKED_RPC 0x0200 /*! ANY : RPC completion */ 93 #define THREAD_BLOCKED_ISR 0x0400 /*! DEV : wait hardware IRQ */ 94 #define THREAD_BLOCKED_WAIT 0x0800 /*! USR : wait child process termination */ 95 #define THREAD_BLOCKED_LOCK 0x1000 /*! ANY : wait queuelock or rwlock */ 96 #define THREAD_BLOCKED_CLIENT 0x2000 /*! DEV : client threads queue non empty */ 96 97 97 98 /*************************************************************************************** … … 190 191 list_entry_t wait_list; /*! member of a local waiting queue */ 191 192 xlist_entry_t wait_xlist; /*! member of a trans-cluster waiting queue */ 193 xlist_entry_t tmp_xlist; /*! member of a trans-cluster kleenex queue */ 192 194 193 195 uint32_t busylocks; /*! number of taken busylocks */
Note: See TracChangeset
for help on using the changeset viewer.