Changeset 561 for trunk/kernel/kern
- Timestamp:
- Sep 21, 2018, 10:26:47 PM (6 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.c
r557 r561 45 45 #include <process.h> 46 46 #include <dqdt.h> 47 #include <cluster_info.h> 47 48 48 49 ///////////////////////////////////////////////////////////////////////////////////// … … 212 213 } // end cluster_init() 213 214 215 ///////////////////////////////// 216 cxy_t cluster_random_select( void ) 217 { 218 uint32_t x_size; 219 uint32_t y_size; 220 uint32_t y_width; 221 uint32_t index; 222 uint32_t x; 223 uint32_t y; 224 225 do { 226 x_size = LOCAL_CLUSTER->x_size; 227 y_size = LOCAL_CLUSTER->y_size; 228 y_width = LOCAL_CLUSTER->y_width; 229 index = ( hal_get_cycles() + hal_get_gid() ) % (x_size * y_size); 230 x = index / y_size; 231 y = index % y_size; 232 } while ( cluster_info_is_active( LOCAL_CLUSTER->cluster_info[x][y] ) == 0 ); 233 234 return (x<<y_width) + y; 235 } 236 214 237 //////////////////////////////////////// 215 238 bool_t cluster_is_undefined( cxy_t cxy ) -
trunk/kernel/kern/cluster.h
r557 r561 176 176 error_t cluster_init( boot_info_t * info ); 177 177 178 /****************************************************************************************** 179 * This function randomly selects a cluster. 180 ****************************************************************************************** 181 * @ returns the selected cluster identifier. 182 *****************************************************************************************/ 183 cxy_t cluster_random_select( void ); 184 178 185 /****************************************************************************************** 179 186 * This function checks the validity of a cluster identifier. -
trunk/kernel/kern/kernel_init.c
r560 r561 621 621 622 622 // compute target cluster for chdev[func,channel,direction] 623 uint32_t offset = ext_chdev_gid % ( info->x_size * (info->y_max) ); // [FIXME] 624 uint32_t cx = offset / (info->y_max); // [FIXME] 625 uint32_t cy = offset % (info->y_max); // [FIXME] 626 uint32_t target_cxy = (cx<<info->y_width) + cy; 627 623 uint32_t offset; 624 uint32_t cx; 625 uint32_t cy; 626 uint32_t target_cxy; 627 while (1) { 628 offset = ext_chdev_gid % ( info->x_size * (info->y_size) ); 629 cx = offset / (info->y_size); 630 cy = offset % (info->y_size); 631 target_cxy = (cx<<info->y_width) + cy; 632 // ext_chdev_gid that results in empty target clusters are skipped 633 if ( cluster_info_is_active( LOCAL_CLUSTER->cluster_info[cx][cy] ) == 0 ) { 634 ext_chdev_gid++; 635 } else { // The ext_chdev_gid resulted in a full target cluster 636 break; 637 } 638 } 628 639 // allocate and initialize a local chdev 629 640 // when local cluster matches target cluster
Note: See TracChangeset
for help on using the changeset viewer.