- Timestamp:
- Aug 21, 2018, 6:01:01 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/boot/tsar_mips32/boot_fat32.c
r439 r473 50 50 static inline int get_offset(int offset, int size) 51 51 { 52 return offset;52 if( size + 1 ) return offset; 53 53 54 54 } // get_offset() … … 65 65 static inline int get_size(int offset, int size) 66 66 { 67 return size;67 if( offset + 1 ) return size; 68 68 69 69 } // get_size() -
trunk/hal/tsar_mips32/core/hal_shared_types.h
r459 r473 36 36 **********************************************************************************/ 37 37 38 #ifndef NULL39 #define NULL (void*)040 #endif41 42 38 typedef unsigned long int reg_t; // core register 43 39 -
trunk/kernel/Makefile
r457 r473 86 86 build/kern/dqdt.o \ 87 87 build/kern/do_syscall.o \ 88 build/kern/do_interrupt.o \89 88 build/kern/rpc.o 90 89 -
trunk/kernel/fs/fatfs.c
r463 r473 55 55 ////////////////////////////////////////////////////////////////////////////////////////// 56 56 57 static inline int get_length( int offset , int length ) { return length; }58 59 static inline int get_offset( int offset , int length ) { return offset; }57 static inline int get_length( int offset , int length ) { if( offset + 1 ) return length; } 58 59 static inline int get_offset( int offset , int length ) { if( length + 1 ) return offset; } 60 60 61 61 -
trunk/kernel/fs/vfs.c
r459 r473 94 94 uint32_t lid = bitmap_ffc( ctx->bitmap , CONFIG_VFS_MAX_INODES ); 95 95 96 if( lid == -1) // no more free slot => error96 if( lid == 0xFFFFFFFF ) // no more free slot => error 97 97 { 98 98 // release lock … … 321 321 // get inode cluster and local pointer 322 322 cxy_t inode_cxy = GET_CXY( inode_xp ); 323 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );323 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 324 324 325 325 hal_remote_atomic_add( XPTR( inode_cxy , &inode_ptr->refcount ) , 1 ); … … 331 331 // get inode cluster and local pointer 332 332 cxy_t inode_cxy = GET_CXY( inode_xp ); 333 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );333 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 334 334 335 335 hal_remote_atomic_add( XPTR( inode_cxy , &inode_ptr->refcount ) , -1 ); … … 341 341 // get inode cluster and local pointer 342 342 cxy_t cxy = GET_CXY( inode_xp ); 343 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );343 vfs_inode_t * ptr = GET_PTR( inode_xp ); 344 344 345 345 // get size … … 356 356 // get inode cluster and local pointer 357 357 cxy_t cxy = GET_CXY( inode_xp ); 358 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );358 vfs_inode_t * ptr = GET_PTR( inode_xp ); 359 359 360 360 // set size … … 369 369 // get inode cluster and local pointer 370 370 cxy_t cxy = GET_CXY( inode_xp ); 371 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );371 vfs_inode_t * ptr = GET_PTR( inode_xp ); 372 372 373 373 // release the main lock … … 380 380 // get inode cluster and local pointer 381 381 cxy_t cxy = GET_CXY( inode_xp ); 382 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );382 vfs_inode_t * ptr = GET_PTR( inode_xp ); 383 383 384 384 // get the main lock … … 398 398 // get inode cluster and local pointer 399 399 inode_cxy = GET_CXY( inode_xp ); 400 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );400 inode_ptr = GET_PTR( inode_xp ); 401 401 402 402 // get parent dentry … … 411 411 { 412 412 dentry_cxy = GET_CXY( dentry_xp ); 413 dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );413 dentry_ptr = GET_PTR( dentry_xp ); 414 414 415 415 hal_remote_strcpy( XPTR( local_cxy , name ) , … … 641 641 xptr_t file_xp; // extended pointer on created file descriptor 642 642 uint32_t file_id; // created file descriptor index in reference fd_array 643 644 assert( (mode == 0), __FUNCTION__, 645 "the mode parameter is not supported yet\n" ); 643 646 644 647 #if DEBUG_VFS_OPEN … … 670 673 // get target inode cluster and local pointer 671 674 inode_cxy = GET_CXY( inode_xp ); 672 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );675 inode_ptr = GET_PTR( inode_xp ); 673 676 674 677 // create a new file descriptor in cluster containing inode … … 721 724 // get cluster and local pointer on remote file descriptor 722 725 file_cxy = GET_CXY( file_xp ); 723 file_ptr = (vfs_file_t *)GET_PTR( file_xp );726 file_ptr = GET_PTR( file_xp ); 724 727 725 728 // get inode type from remote file descriptor … … 776 779 // get cluster and local pointer on remote file descriptor 777 780 file_cxy = GET_CXY( file_xp ); 778 file_ptr = (vfs_file_t *)GET_PTR( file_xp );781 file_ptr = GET_PTR( file_xp ); 779 782 780 783 // get inode type from remote file descriptor … … 836 839 // get cluster and local pointer on remote file descriptor 837 840 file_cxy = GET_CXY( file_xp ); 838 file_ptr = (vfs_file_t *)GET_PTR( file_xp );841 file_ptr = GET_PTR( file_xp ); 839 842 840 843 // build extended pointers on lock and offset … … 993 996 char * path ) 994 997 { 995 assert( false , __FUNCTION__ , "not implemented\n" );998 assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path ); 996 999 return 0; 997 1000 } … … 1001 1004 struct stat * k_stat ) 1002 1005 { 1003 assert( false , __FUNCTION__ , "not implemented\n" );1006 assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_stat ); 1004 1007 return 0; 1005 1008 } … … 1009 1012 struct dirent * k_dirent ) 1010 1013 { 1011 assert( false , __FUNCTION__ , "not implemented\n" );1014 assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_dirent ); 1012 1015 return 0; 1013 1016 } … … 1018 1021 uint32_t mode ) 1019 1022 { 1020 assert( false , __FUNCTION__ , "not implemented\n" );1023 assert( false , __FUNCTION__ , "not implemented\n", file_xp, path, mode ); 1021 1024 return 0; 1022 1025 } … … 1026 1029 char * path ) 1027 1030 { 1028 assert( false , __FUNCTION__ , "not implemented\n" );1031 assert( false , __FUNCTION__ , "not implemented\n", file_xp, path ); 1029 1032 return 0; 1030 1033 } … … 1051 1054 // get inode cluster and local pointer 1052 1055 inode_cxy = GET_CXY( inode_xp ); 1053 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1056 inode_ptr = GET_PTR( inode_xp ); 1054 1057 1055 1058 // get inode type from remote file … … 1075 1078 cxy_t inode_cxy; // inode cluster identifier 1076 1079 vfs_inode_t * inode_ptr; // inode local pointer 1077 uint32_t mode; // lookup working mode1078 1080 vfs_inode_type_t inode_type; // target inode type 1079 1081 1080 1082 // set lookup working mode 1081 mode = 0; 1083 assert( (rights == 0), __FUNCTION__, 1084 "access rights non implemented yet\n" ); 1082 1085 1083 1086 // get extended pointer on target inode 1084 error = vfs_lookup( cwd_xp , path , mode, &inode_xp );1087 error = vfs_lookup( cwd_xp , path , 0 , &inode_xp ); 1085 1088 1086 1089 if( error ) return error; … … 1088 1091 // get inode cluster and local pointer 1089 1092 inode_cxy = GET_CXY( inode_xp ); 1090 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1093 inode_ptr = GET_PTR( inode_xp ); 1091 1094 1092 1095 // get inode type from remote inode … … 1103 1106 uint32_t rights ) 1104 1107 { 1105 assert( false , __FUNCTION__ , "not implemented\n" );1108 assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path, rights ); 1106 1109 return 0; 1107 1110 } … … 1133 1136 static void vfs_recursive_display( xptr_t inode_xp, 1134 1137 xptr_t name_xp, 1135 xptr_t dentry_xp,1136 1138 uint32_t indent ) 1137 1139 { … … 1172 1174 // get inode cluster and local pointer 1173 1175 inode_cxy = GET_CXY( inode_xp ); 1174 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1176 inode_ptr = GET_PTR( inode_xp ); 1175 1177 1176 1178 // get inode type … … 1204 1206 // get dentry cluster and local pointer 1205 1207 child_dentry_cxy = GET_CXY( child_dentry_xp ); 1206 child_dentry_ptr = (vfs_dentry_t *)GET_PTR( child_dentry_xp );1208 child_dentry_ptr = GET_PTR( child_dentry_xp ); 1207 1209 1208 1210 // get extended pointer on child inode … … 1216 1218 vfs_recursive_display( child_inode_xp, 1217 1219 child_dentry_name_xp, 1218 child_dentry_xp,1219 1220 indent+1 ); 1220 1221 … … 1239 1240 // get target inode cluster and local pointer 1240 1241 cxy_t inode_cxy = GET_CXY( inode_xp ); 1241 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1242 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 1242 1243 1243 1244 // get extended pointer on associated dentry … … 1254 1255 // get dentry cluster and local pointer 1255 1256 dentry_cxy = GET_CXY( dentry_xp ); 1256 dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1257 dentry_ptr = GET_PTR( dentry_xp ); 1257 1258 1258 1259 // get extended pointer on dentry name … … 1275 1276 1276 1277 // call recursive function 1277 vfs_recursive_display( inode_xp , name_xp , dentry_xp ,0 );1278 vfs_recursive_display( inode_xp , name_xp , 0 ); 1278 1279 1279 1280 // release lock … … 1299 1300 // get found inode cluster and local pointer 1300 1301 cxy_t inode_cxy = GET_CXY( inode_xp ); 1301 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1302 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 1302 1303 1303 1304 // get inode access mode, UID, and GID … … 1331 1332 // get parent inode cluster and local pointer 1332 1333 cxy_t parent_cxy = GET_CXY( parent_xp ); 1333 vfs_inode_t * parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );1334 vfs_inode_t * parent_ptr = GET_PTR( parent_xp ); 1334 1335 1335 1336 // get extended pointer on hash table of children directory entries … … 1343 1344 // get dentry cluster and local pointer 1344 1345 cxy_t dentry_cxy = GET_CXY( dentry_xp ); 1345 vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1346 vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp ); 1346 1347 1347 1348 // return child inode … … 1701 1702 // get inode cluster and local pointer 1702 1703 cxy_t inode_cxy = GET_CXY( inode_xp ); 1703 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1704 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 1704 1705 1705 1706 // get extended pointer on parent dentry … … 1708 1709 // get dentry cluster and local pointer 1709 1710 cxy_t dentry_cxy = GET_CXY( dentry_xp ); 1710 vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1711 vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp ); 1711 1712 1712 1713 // get dentry name length and pointer … … 1864 1865 // 3. update extended pointer on inode in dentry 1865 1866 cxy_t dentry_cxy = GET_CXY( dentry_xp ); 1866 vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1867 vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp ); 1867 1868 hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp ); 1868 1869 -
trunk/kernel/kern/do_syscall.c
r457 r473 180 180 181 181 // update user time 182 thread_ user_time_update( this );182 thread_time_update( this , 1 ); 183 183 184 184 // check syscall index … … 204 204 205 205 // update kernel time 206 thread_ kernel_time_update( this);206 thread_time_update( this , 0 ); 207 207 208 208 return error; -
trunk/kernel/kern/rpc.c
r459 r473 1108 1108 rpc_send( cxy , &rpc ); 1109 1109 1110 // get output argument from RPC descriptor 1111 *error = (error_t)rpc.args[1]; 1112 1110 1113 #if DEBUG_RPC_VFS_INODE_DESTROY 1111 1114 uint32_t cycle = (uint32_t)hal_get_cycles(); … … 1248 1251 ///////////////////////////////////////////////////////////////////////////////////////// 1249 1252 1250 1251 1253 /////////////////////////////////////////////////////// 1252 1254 void rpc_vfs_dentry_destroy_client( cxy_t cxy, … … 1274 1276 // register RPC request in remote RPC fifo 1275 1277 rpc_send( cxy , &rpc ); 1278 1279 // get output argument from RPC descriptor 1280 *error = (error_t)rpc.args[1]; 1276 1281 1277 1282 #if DEBUG_RPC_VFS_DENTRY_DESTROY -
trunk/kernel/kern/thread.c
r469 r473 528 528 if( error ) 529 529 { 530 vseg_detach( &child_process->vmm ,vseg );530 vseg_detach( vseg ); 531 531 vseg_free( vseg ); 532 532 thread_release( child_ptr ); … … 549 549 // increment the forks counter 550 550 remote_spinlock_lock( lock_xp ); 551 hal_remote_atomic_add( XPTR( page_cxy , &page_ptr->forks ), 1 );551 hal_remote_atomic_add( forks_xp , 1 ); 552 552 remote_spinlock_unlock( lock_xp ); 553 553 … … 1130 1130 1131 1131 1132 ///////////////////////////////////////////////// 1133 void thread_user_time_update( thread_t * thread ) 1134 { 1135 // TODO 1136 // printk("\n[WARNING] function %s not implemented\n", __FUNCTION__ ); 1137 } 1138 1139 /////////////////////////////////////////////////// 1140 void thread_kernel_time_update( thread_t * thread ) 1141 { 1142 // TODO 1143 // printk("\n[WARNING] function %s not implemented\n", __FUNCTION__ ); 1132 /////////////////////////////////////////// 1133 void thread_time_update( thread_t * thread, 1134 uint32_t is_user ) 1135 { 1136 cycle_t current_cycle; // current cycle counter value 1137 cycle_t last_cycle; // last cycle counter value 1138 1139 // get pointer on thread_info structure 1140 thread_info_t * info = &thread->info; 1141 1142 // get last cycle counter value 1143 last_cycle = info->last_cycle; 1144 1145 // get current cycle counter value 1146 current_cycle = hal_get_cycles(); 1147 1148 // update thread_info structure 1149 info->last_cycle = current_cycle; 1150 1151 // update time in thread_info 1152 if( is_user ) info->usr_cycles += (current_cycle - last_cycle); 1153 else info->sys_cycles += (current_cycle - last_cycle); 1144 1154 } 1145 1155 -
trunk/kernel/kern/thread.h
r459 r473 103 103 uint32_t u_err_nr; /*! TODO ??? [AG] */ 104 104 uint32_t m_err_nr; /*! TODO ??? [AG] */ 105 uint32_t tm_tmp; /*! temp date to compute execution duration */ 106 uint32_t tm_exec; /*! TODO ??? [AG] */ 107 uint32_t tm_create; /*! date of the creation */ 108 uint32_t tm_born; /*! date of the thread loading */ 109 uint32_t tm_dead; /*! date of the death */ 110 cycle_t tm_sleep; /*! TODO ??? [AG] */ 111 cycle_t tm_wait; /*! TODO ??? [AG] */ 112 cycle_t tm_usr; /*! user execution duration */ 113 cycle_t tm_sys; /*! system execution duration */ 105 cycle_t last_cycle; /*! last cycle counter value (date) */ 106 cycle_t usr_cycles; /*! user execution duration (cycles) */ 107 cycle_t sys_cycles; /*! system execution duration (cycles) */ 114 108 } 115 109 thread_info_t; … … 435 429 436 430 /*************************************************************************************** 437 * This function updates the calling thread user_time counter, and resets the thread 438 * cycles counter. 439 * TODO This function is not implemented. 431 * This function updates the calling thread user_time or kernel_time counters. 440 432 *************************************************************************************** 441 433 * @ thread : local pointer on target thread. 442 **************************************************************************************/ 443 void thread_user_time_update( thread_t * thread ); 444 445 /**************************************************************************************n 446 * This function updates the calling thread kernel_time counter, and resets the thread 447 * cycles counter. 448 * TODO This function is not implemented. 449 *************************************************************************************** 450 * @ thread : local pointer on target thread. 451 **************************************************************************************/ 452 void thread_kernel_time_update( thread_t * thread ); 434 * @ is_user : update user time if non zero / update kernel time if zero 435 **************************************************************************************/ 436 void thread_time_update( thread_t * thread, 437 uint32_t is_user ); 453 438 454 439 /*************************************************************************************** -
trunk/kernel/libk/bits.c
r457 r473 81 81 if((len + bit) >= 32) 82 82 { 83 val = (bit == 0) ? 0xFFFFFFFF : (1 << (32 - bit)) - 1; 83 if( bit == 0 ) val = 0xFFFFFFFF; 84 else val = (uint32_t)((1 << (32 - bit)) - 1); 85 84 86 bitmap[word] |= (val << bit); 85 87 word++; … … 108 110 if((len + bit) >= 32) 109 111 { 110 val = (bit == 0) ? 0xFFFFFFFF : (1 << (32 - bit)) - 1; 112 if( bit == 0 ) val = 0xFFFFFFFF; 113 else val = (uint32_t)((1 << (32 - bit)) - 1); 114 111 115 bitmap[word] &= ~(val << bit); 112 116 word++; -
trunk/kernel/libk/grdxt.c
r457 r473 73 73 req.type = KMEM_GENERIC; 74 74 75 for( ix1=0 ; ix1 < ( 1 << w1) ; ix1++ )75 for( ix1=0 ; ix1 < (uint32_t)(1 << w1) ; ix1++ ) 76 76 { 77 77 ptr2 = ptr1[ix1]; … … 79 79 if( ptr2 == NULL ) continue; 80 80 81 for( ix2=0 ; ix2 < ( 1 << w2) ; ix2++ )81 for( ix2=0 ; ix2 < (uint32_t)(1 << w2) ; ix2++ ) 82 82 { 83 83 ptr3 = ptr2[ix2]; … … 129 129 name, 1<<w1 , 1<<w2 , 1<<w3 ); 130 130 131 for( ix1=0 ; ix1 < ( 1<<w1) ; ix1++ )131 for( ix1=0 ; ix1 < (uint32_t)(1<<w1) ; ix1++ ) 132 132 { 133 133 ptr2 = ptr1[ix1]; 134 134 if( ptr2 == NULL ) continue; 135 135 136 for( ix2=0 ; ix2 < ( 1<<w2) ; ix2++ )136 for( ix2=0 ; ix2 < (uint32_t)(1<<w2) ; ix2++ ) 137 137 { 138 138 ptr3 = ptr2[ix2]; 139 139 if( ptr3 == NULL ) continue; 140 140 141 for( ix3=0 ; ix3 < ( 1<<w3) ; ix3++ )141 for( ix3=0 ; ix3 < (uint32_t)(1<<w3) ; ix3++ ) 142 142 { 143 143 value = (intptr_t)ptr3[ix3]; -
trunk/kernel/libk/spinlock.c
r461 r473 47 47 /////////////////////////////////////////// 48 48 void spinlock_lock_busy( spinlock_t * lock, 49 uint32_t* irq_state )49 reg_t * irq_state ) 50 50 { 51 51 reg_t mode; … … 82 82 ////////////////////////////////////////////// 83 83 void spinlock_unlock_busy( spinlock_t * lock, 84 uint32_tirq_state )84 reg_t irq_state ) 85 85 { 86 86 thread_t * this = CURRENT_THREAD; -
trunk/kernel/mm/vmm.c
r469 r473 718 718 719 719 // remove vseg from VSL 720 vseg_detach( v mm , vseg );720 vseg_detach( vseg ); 721 721 722 722 // release memory allocated to vseg descriptor … … 747 747 __FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size ); 748 748 #endif 749 vseg_detach( v mm , vseg );749 vseg_detach( vseg ); 750 750 vseg_free( vseg ); 751 751 … … 1022 1022 // get pointers on calling process and VMM 1023 1023 thread_t * this = CURRENT_THREAD; 1024 process_t * process = this->process;1025 1024 vmm_t * vmm = &this->process->vmm; 1026 1025 uint32_t type = vseg->type; … … 1029 1028 xptr_t lock_xp = XPTR( local_cxy , &vmm->vsegs_lock ); 1030 1029 remote_rwlock_wr_lock( lock_xp ); 1031 vseg_detach( &process->vmm ,vseg );1030 vseg_detach( vseg ); 1032 1031 remote_rwlock_wr_unlock( lock_xp ); 1033 1032 -
trunk/kernel/mm/vseg.c
r457 r473 209 209 } 210 210 211 /////////////////////////////// 212 void vseg_detach( vmm_t * vmm, 213 vseg_t * vseg ) 211 ///////////////////////////////// 212 void vseg_detach( vseg_t * vseg ) 214 213 { 215 214 // update vseg descriptor -
trunk/kernel/mm/vseg.h
r457 r473 161 161 * The lock protecting the vsegs list in VMM must be taken by the caller. 162 162 ******************************************************************************************* 163 * @ vmm : pointer on the VMM164 163 * @ vseg : pointer on the vseg descriptor 165 164 ******************************************************************************************/ 166 void vseg_detach( struct vmm_s * vmm, 167 vseg_t * vseg ); 165 void vseg_detach( vseg_t * vseg ); 168 166 169 167 -
trunk/kernel/syscalls/shared_include/shared_stdlib.h
r445 r473 35 35 exit_statut_t; 36 36 37 38 #define RAND_MAX 6553539 40 #ifndef NULL41 #define NULL (void *)042 37 #endif 43 44 #endif -
trunk/kernel/syscalls/sys_alarm.c
r457 r473 37 37 38 38 printk("\n[ERROR] in %s for thread %x in process %x : not implemented yet\n", 39 __FUNCTION__ , this->trdid , process->pid ); 40 this->errno = EFAULT; 39 __FUNCTION__ , this->trdid , process->pid , cycles ); 41 40 return -1; 42 41 } -
trunk/kernel/syscalls/sys_closedir.c
r457 r473 34 34 int sys_closedir ( DIR * dirp ) 35 35 { 36 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 37 CURRENT_THREAD->errno = ENOMEM; 36 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__, dirp ); 38 37 return -1; 39 38 } // end sys_closedir() -
trunk/kernel/syscalls/sys_opendir.c
r457 r473 35 35 DIR ** dirp ) 36 36 { 37 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 38 CURRENT_THREAD->errno = ENOMEM; 37 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__, pathname, dirp ); 39 38 return -1; 40 39 } // end sys opendir() -
trunk/kernel/syscalls/sys_pipe.c
r457 r473 33 33 thread_t * this = CURRENT_THREAD; 34 34 35 printk("\n[ERROR] in %d : not implemented yet\n", __FUNCTION__ ); 36 this->errno = ENOSYS; 35 printk("\n[ERROR] in %d : not implemented yet\n", __FUNCTION__, file_fd ); 37 36 return -1; 38 37 } -
trunk/kernel/syscalls/sys_readdir.c
r457 r473 37 37 struct dirent ** dentp ) 38 38 { 39 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 40 CURRENT_THREAD->errno = ENOMEM; 39 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__, dirp, dentp ); 41 40 return -1; 42 41 } // end sys_readdir() -
trunk/kernel/syscalls/sys_signal.c
r457 r473 33 33 { 34 34 thread_t * this = CURRENT_THREAD; 35 process_t * process = this->process; 35 36 36 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ );37 this->errno = EINVAL;37 printk("\n[ERROR] in %s : thread %x in process %x / not implemented yet\n", 38 __FUNCTION__, this->trdid, process->pid, sig_id, handler ); 38 39 return -1; 39 40 } -
trunk/kernel/syscalls/sys_thread_join.c
r457 r473 96 96 97 97 #if DEBUG_SYSCALLS_ERROR 98 printk("\n[ERROR] in %s : this thread == target thread\n", __FUNCTION__ ); 98 printk("\n[ERROR] in %s : this thread (%x) == target thread(%x)\n", 99 __FUNCTION__, joining_ptr->trdid, trdid ); 99 100 #endif 100 101 joining_ptr->errno = EDEADLK; -
trunk/libs/libalmosmkh/almosmkh.c
r457 r473 434 434 435 435 // check store size power of 2 436 if( store_size != ( 1<<free_index) )436 if( store_size != (unsigned int)(1<<free_index) ) 437 437 { 438 438 printf("\n[ERROR] in %s : store[%x] size not power of 2 / size = %x\n", … … 557 557 { 558 558 // test terminal case 559 if ( ( 1<<searched_index) > store->store_size ) // failure : return a NULL value559 if ( (unsigned int)(1<<searched_index) > store->store_size ) // failure 560 560 { 561 561 return 0; … … 729 729 730 730 // compute old size 731 char * pchar= (char *) (store[cxy].alloc_base + index);732 int old_size = 1 << ((int) *pchar);731 char * pchar = (char *) (store[cxy].alloc_base + index); 732 unsigned int old_size = (unsigned int)(1 << ((int) *pchar)); 733 733 734 734 // allocate a new block … … 736 736 737 737 // save old data to new block 738 int min_size = ( size < old_size) ? size : old_size;738 int min_size = (int)((size < old_size) ? size : old_size); 739 739 memcpy( new_ptr, ptr, min_size ); 740 740 -
trunk/libs/libpthread/pthread.c
r457 r473 32 32 33 33 #define PTHREAD_MUTEX_DEBUG 0 34 #define PTHREAD_BARRIER_DEBUG 034 #define PTHREAD_BARRIER_DEBUG 1 35 35 36 36 //////////////////////////////////////////////////////////////////////////////////////////// … … 56 56 { 57 57 return hal_user_syscall( SYS_THREAD_JOIN, 58 (reg_t)exit_value, 0, 0, 0 ); 58 (reg_t)trdid, 59 (reg_t)exit_value, 0, 0 ); 59 60 } 60 61 … … 346 347 347 348 #if PTHREAD_BARRIER_DEBUG 348 printf("\n[BARRIER] %s : enter for core[%x,%d]/ barrier = %x / node = %x\n",349 printf("\n[BARRIER] %s : core[%x,%d] enter / barrier = %x / node = %x\n", 349 350 __FUNCTION__ , cxy , lid , barrier, barrier->node[x][y][0] ); 350 351 #endif -
trunk/libs/mini-libc/dirent.c
r457 r473 26 26 #include <hal_user.h> 27 27 #include <syscalls_numbers.h> 28 #include <stdio.h> 28 29 29 30 ////////////////////////////////////// -
trunk/libs/mini-libc/mman.c
r457 r473 26 26 #include <hal_user.h> 27 27 #include <syscalls_numbers.h> 28 #include <stdio.h> 28 29 29 30 ////////////////////////////////y -
trunk/libs/mini-libc/stdio.c
r459 r473 38 38 //////////////////////////////////////////////////////////////////////////////////////// 39 39 40 ////////////////////////////////////////// 41 static int xprintf( char * string,42 unsigned int length,43 const char * format,44 va_list * args )40 /////////////////////////////////////////////////// 41 static unsigned int xprintf( char * string, 42 unsigned int length, 43 const char * format, 44 va_list * args ) 45 45 { 46 46 unsigned int ps = 0; // write index to the string buffer … … 265 265 int printf( const char * format, ... ) 266 266 { 267 char string[4096];268 va_list args;269 int count;267 char string[4096]; 268 va_list args; 269 unsigned int count; 270 270 271 271 va_start( args, format ); … … 309 309 const char * format, ... ) 310 310 { 311 va_list args;312 int count;311 va_list args; 312 unsigned int count; 313 313 314 314 va_start( args, format ); … … 374 374 const char * format, ... ) 375 375 { 376 char string[4096];377 va_list args;378 int count;379 int fd;376 char string[4096]; 377 va_list args; 378 unsigned int count; 379 int fd; 380 380 381 381 // check stream valid -
trunk/libs/mini-libc/stdio.h
r459 r473 31 31 ********************************************************************************************/ 32 32 33 /*********************************************************************************************34 * This defines the user level FILE structure.35 ********************************************************************************************/36 37 33 #define MAX_OPEN_FILE_PER_PROCESS 256 38 34 #define VALID_OPEN_FILE 0x12345678 39 35 #define EOF -1 40 36 #define NULL (void *)0 37 38 /********************************************************************************************* 39 * This defines the user level FILE structure. 40 ********************************************************************************************/ 41 41 42 42 typedef struct file_s -
trunk/libs/mini-libc/stdlib.c
r457 r473 28 28 #include <almosmkh.h> 29 29 #include <stdio.h> 30 31 ////////////////////////////////////////////////////////////////////////////////////////// 32 // Global variables 33 ////////////////////////////////////////////////////////////////////////////////////////// 34 35 unsigned int rand_seed_value = 1; // set by srand() , used by rand() 30 36 31 37 ////////////////////////// … … 121 127 get_cycle( &cycle ); 122 128 123 unsigned int x = (unsigned int)cycle ;124 125 if ((x & 0xF ) > 7)126 { 127 return (x*x & 0xFFFF);129 unsigned int x = (unsigned int)cycle * rand_seed_value; 130 131 if ((x & 0xFF) > 0x7F) 132 { 133 return (x*x & RAND_MAX); 128 134 } 129 135 else 130 136 { 131 return (x*x*x & 0xFFFF);137 return (x*x*x & RAND_MAX); 132 138 } 133 139 } … … 136 142 void srand( unsigned int seed ) 137 143 { 138 printf("\n[ERROR] in %s : not implemented yet : do nothing\n", __FUNCTION__ );144 rand_seed_value = seed; 139 145 } 140 146 -
trunk/libs/mini-libc/stdlib.h
r445 r473 33 33 34 34 #include <shared_stdlib.h> 35 36 #define RAND_MAX 0xFFFF 35 37 36 38 /***************************************************************************************** -
trunk/libs/mini-libc/string.c
r445 r473 22 22 */ 23 23 24 #define NULL (void *)025 26 24 #include <string.h> 25 #include <stdio.h> 27 26 28 27 /////////////////////////////////////// -
trunk/libs/mini-libc/unistd.c
r457 r473 78 78 int pipe( int fd[2] ) 79 79 { 80 return -1;81 //return hal_user_syscall( SYS_PIPE,(reg_t)fd, 0, 0, 0 );80 return hal_user_syscall( SYS_PIPE, 81 (reg_t)fd, 0, 0, 0 ); 82 82 } 83 83 -
trunk/user/fft/fft.c
r469 r473 88 88 #define CHECK 0 89 89 #define DEBUG_MAIN 1 90 #define DEBUG_FFT1D 090 #define DEBUG_FFT1D 1 91 91 #define DEBUG_ONCE 0 92 92 #define MODE COSIN … … 102 102 unsigned int y_size; // number of clusters per column in the mesh 103 103 unsigned int ncores; // number of cores per cluster 104 longnthreads; // total number of threads (one thread per core)105 longnclusters; // total number of clusters106 longM = DEFAULT_M; // log2(number of points)107 longN; // number of points (N = 2^M)108 longrootN; // rootN = 2^M/2109 longrows_per_thread; // number of data "rows" handled by a single thread110 longpoints_per_cluster; // number of data points per cluster104 unsigned int nthreads; // total number of threads (one thread per core) 105 unsigned int nclusters; // total number of clusters 106 unsigned int M = DEFAULT_M; // log2(number of points) 107 unsigned int N; // number of points (N = 2^M) 108 unsigned int rootN; // rootN = 2^M/2 109 unsigned int rows_per_thread; // number of data "rows" handled by a single thread 110 unsigned int points_per_cluster; // number of data points per cluster 111 111 112 112 // arrays of pointers on distributed buffers (one sub-buffer per cluster) … … 129 129 pthread_t trdid[THREADS_MAX]; // kernel threads identifiers 130 130 pthread_attr_t attr[THREADS_MAX]; // POSIX thread attributes 131 longargs[THREADS_MAX]; // slave function arguments131 unsigned int args[THREADS_MAX]; // slave function arguments 132 132 133 133 ///////////////////////////////////////////////////////////////////////////////// … … 137 137 void slave(); 138 138 139 double CheckSum( double ** x);139 double CheckSum(); 140 140 141 141 void InitX(double ** x , unsigned int mode); … … 145 145 void InitT(double ** u); 146 146 147 long BitReverse( long k ); 148 149 void FFT1D( long direction , double ** x , double ** tmp , double * upriv, 150 double ** twid , long MyNum , long MyFirst , long MyLast ); 151 152 void TwiddleOneCol(long direction, long j, double ** u, double ** x, long offset_x ); 153 154 void Scale( double **x, long offset_x ); 155 156 void Transpose( double ** src, double ** dest, long MyFirst, long MyLast ); 157 158 void Copy( double ** src, double ** dest, long MyFirst , long MyLast ); 159 160 void Reverse( double ** x, long offset_x ); 161 162 void FFT1DOnce( long direction , double * u , double ** x , long offset_x ); 163 164 void PrintArray( double ** x , long size ); 165 166 void SimpleDft( long direction , long size , double ** src , long src_offset , 167 double ** dst , long dst_offset ); 147 unsigned int BitReverse( unsigned int k ); 148 149 void FFT1D( int direction, 150 double ** x, 151 double ** tmp, 152 double * upriv, 153 double ** twid, 154 unsigned int MyNum, 155 unsigned int MyFirst, 156 unsigned int MyLast ); 157 158 void TwiddleOneCol( int direction, 159 unsigned int j, 160 double ** u, 161 double ** x, 162 unsigned int offset_x ); 163 164 void Scale( double ** x, 165 unsigned int offset_x ); 166 167 void Transpose( double ** src, 168 double ** dest, 169 unsigned int MyFirst, 170 unsigned int MyLast ); 171 172 void Copy( double ** src, 173 double ** dest, 174 unsigned int MyFirst, 175 unsigned int MyLast ); 176 177 void Reverse( double ** x, 178 unsigned int offset_x ); 179 180 void FFT1DOnce( int direction, 181 double * u, 182 double ** x, 183 unsigned int offset_x ); 184 185 void PrintArray( double ** x, 186 unsigned int size ); 187 188 void SimpleDft( int direction, 189 unsigned int size, 190 double ** src, 191 unsigned int src_offset, 192 double ** dst, 193 unsigned int dst_offset ); 168 194 169 195 /////////////////////////////////////////////////////////////////// … … 256 282 // allocate memory for the distributed data[i], trans[i], umain[i], twid[i] buffers 257 283 // the index (i) is a continuous cluster index 258 longdata_size = (N / nclusters) * 2 * sizeof(double);259 longcoefs_size = (rootN / nclusters) * 2 * sizeof(double);284 unsigned int data_size = (N / nclusters) * 2 * sizeof(double); 285 unsigned int coefs_size = (rootN / nclusters) * 2 * sizeof(double); 260 286 for (x = 0 ; x < x_size ; x++) 261 287 { … … 278 304 279 305 #if CHECK 280 ck1 = CheckSum( data);306 ck1 = CheckSum(); 281 307 #endif 282 308 … … 298 324 barrierattr.y_size = y_size; 299 325 barrierattr.nthreads = ncores; 300 pthread_barrier_init( &barrier, &barrierattr , nthreads); 326 if( pthread_barrier_init( &barrier, &barrierattr , nthreads) ) 327 { 328 printf("\n[FFT ERROR] cannot initialize barrier\n"); 329 exit( 0 ); 330 } 331 332 printf("\n[FFT] main completes barrier init\n"); 301 333 302 334 // launch other threads to execute the slave() function … … 331 363 } 332 364 #if DEBUG_MAIN 333 printf("\n[FFT] thread %x created\n", trdid[tid] );365 printf("\n[FFT] main created thread %x\n", trdid[tid] ); 334 366 #endif 335 367 } … … 354 386 { 355 387 // compute thread continuous index 356 longtid = (((x * y_size) + y) * ncores) + lid;388 tid = (((x * y_size) + y) * ncores) + lid; 357 389 358 390 if( tid != main_tid ) … … 386 418 387 419 #if CHECK 388 ck3 = CheckSum( data);420 ck3 = CheckSum(); 389 421 printf("\n*** Results ***\n"); 390 422 printf("Checksum difference is %f (%f, %f)\n", ck1 - ck3, ck1, ck3); … … 446 478 // This function is executed in parallel by all threads. 447 479 /////////////////////////////////////////////////////////////// 448 void slave( long* tid )449 { 450 longi;451 longMyNum; // continuous thread index452 longMyFirst; // index first row allocated to thread453 longMyLast; // index last row allocated to thread454 double * upriv;455 longc_id;456 longc_offset;480 void slave( unsigned int * tid ) 481 { 482 unsigned int i; 483 unsigned int MyNum; // continuous thread index 484 unsigned int MyFirst; // index first row allocated to thread 485 unsigned int MyLast; // index last row allocated to thread 486 double * upriv; 487 unsigned int c_id; 488 unsigned int c_offset; 457 489 458 490 unsigned long long parallel_start; … … 517 549 // buffer, to the dst[nclusters][points_per_cluster] distributed buffer. 518 550 //////////////////////////////////////////////////////////////////////////////////////// 519 void SimpleDft( long direction,520 longsize, // number of points521 double ** src, // source distributed buffer522 longsrc_offset, // offset in source array523 double ** dst, // destination distributed buffer524 longdst_offset ) // offset in destination array525 { 526 longn , k;527 double phi; // 2*PI*n*k/N528 double u_r; // cos( phi )529 double u_c; // sin( phi )530 double d_r; // Re(data[n])531 double d_c; // Im(data[n])532 double accu_r; // Re(accu)533 double accu_c; // Im(accu)534 longc_id; // distributed buffer cluster index535 longc_offset; // offset in distributed buffer551 void SimpleDft( int direction, // 1 direct / -1 reverse 552 unsigned int size, // number of points 553 double ** src, // source distributed buffer 554 unsigned int src_offset, // offset in source array 555 double ** dst, // destination distributed buffer 556 unsigned int dst_offset ) // offset in destination array 557 { 558 unsigned int n , k; 559 double phi; // 2*PI*n*k/N 560 double u_r; // cos( phi ) 561 double u_c; // sin( phi ) 562 double d_r; // Re(data[n]) 563 double d_c; // Im(data[n]) 564 double accu_r; // Re(accu) 565 double accu_c; // Im(accu) 566 unsigned int c_id; // distributed buffer cluster index 567 unsigned int c_offset; // offset in distributed buffer 536 568 537 569 for ( k = 0 ; k < size ; k++ ) // loop on the output data points … … 551 583 c_id = (src_offset + n) / (points_per_cluster); 552 584 c_offset = (src_offset + n) % (points_per_cluster); 553 d_r = data[c_id][2*c_offset];554 d_c = data[c_id][2*c_offset+1];585 d_r = src[c_id][2*c_offset]; 586 d_c = src[c_id][2*c_offset+1]; 555 587 556 588 // increment accu … … 575 607 } // end SimpleDft() 576 608 577 ///////////////// ///////////578 double CheckSum( double ** x)579 { 580 longi , j;609 ///////////////// 610 double CheckSum() 611 { 612 unsigned int i , j; 581 613 double cks; 582 longc_id;583 longc_offset;614 unsigned int c_id; 615 unsigned int c_offset; 584 616 585 617 cks = 0.0; … … 602 634 unsigned int mode ) 603 635 { 604 longi , j;605 longc_id;606 longc_offset;607 longindex;636 unsigned int i , j; 637 unsigned int c_id; 638 unsigned int c_offset; 639 unsigned int index; 608 640 609 641 for ( j = 0 ; j < rootN ; j++ ) // loop on row index … … 618 650 if ( mode == RANDOM ) 619 651 { 620 data[c_id][2*c_offset] = ( (double)rand() ) / 65536;621 data[c_id][2*c_offset+1] = ( (double)rand() ) / 65536;652 x[c_id][2*c_offset] = ( (double)rand() ) / 65536; 653 x[c_id][2*c_offset+1] = ( (double)rand() ) / 65536; 622 654 } 623 655 … … 627 659 { 628 660 double phi = (double)( 2 * PI * index) / N; 629 data[c_id][2*c_offset] = cos( phi );630 data[c_id][2*c_offset+1] = sin( phi );661 x[c_id][2*c_offset] = cos( phi ); 662 x[c_id][2*c_offset+1] = sin( phi ); 631 663 } 632 664 … … 634 666 if ( mode == CONSTANT ) 635 667 { 636 data[c_id][2*c_offset] = 1.0;637 data[c_id][2*c_offset+1] = 0.0;668 x[c_id][2*c_offset] = 1.0; 669 x[c_id][2*c_offset+1] = 0.0; 638 670 } 639 671 } … … 644 676 void InitU( double ** u ) 645 677 { 646 longq;647 longj;648 longbase;649 longn1;650 longc_id;651 longc_offset;678 unsigned int q; 679 unsigned int j; 680 unsigned int base; 681 unsigned int n1; 682 unsigned int c_id; 683 unsigned int c_offset; 652 684 double phi; 653 longstop = 0;654 655 for (q = 0 ; (( 1 << q) < N) && (stop == 0) ; q++)685 unsigned int stop = 0; 686 687 for (q = 0 ; ((unsigned int)(1 << q) < N) && (stop == 0) ; q++) 656 688 { 657 689 n1 = 1 << q; … … 673 705 void InitT( double ** u ) 674 706 { 675 longi, j;676 longindex;677 longc_id;678 longc_offset;707 unsigned int i, j; 708 unsigned int index; 709 unsigned int c_id; 710 unsigned int c_offset; 679 711 double phi; 680 712 … … 697 729 // This function returns an index value that is the bit reverse of the input value. 698 730 //////////////////////////////////////////////////////////////////////////////////////// 699 long BitReverse( longk )700 { 701 longi;702 longj;703 longtmp;731 unsigned int BitReverse( unsigned int k ) 732 { 733 unsigned int i; 734 unsigned int j; 735 unsigned int tmp; 704 736 705 737 j = 0; … … 724 756 // on the rootN points contained in a row. 725 757 //////////////////////////////////////////////////////////////////////////////////////// 726 void FFT1D( long direction, // direct : 1 / inverse :-1727 double ** x, // input & output distributed data points array728 double ** tmp, // auxiliary distributed data points array729 double *upriv, // local array containing coefs for rootN FFT730 double ** twid, // distributed arrays containing N twiddle factors731 long MyNum,732 longMyFirst,733 longMyLast )734 { 735 longj;758 void FFT1D( int direction, // direct 1 / inverse -1 759 double ** x, // input & output distributed data points array 760 double ** tmp, // auxiliary distributed data points array 761 double * upriv, // local array containing coefs for rootN FFT 762 double ** twid, // distributed arrays containing N twiddle factors 763 unsigned int MyNum, // thread continuous index 764 unsigned int MyFirst, 765 unsigned int MyLast ) 766 { 767 unsigned int j; 736 768 unsigned long long barrier_start; 737 769 unsigned long long barrier_stop; … … 741 773 742 774 #if DEBUG_FFT1D 743 printf("\n @@@ tmp after first transpose\n");744 PrintArray( tmp , N );775 printf("\n[FFT] %s : thread %x after first transpose\n", __FUNCTION__, MyNum); 776 if( VERBOSE ) PrintArray( tmp , N ); 745 777 #endif 746 778 … … 755 787 for (j = MyFirst; j < MyLast; j++) 756 788 { 789 printf("@@@ before FFT1Once / j = %d\n", j ); 757 790 FFT1DOnce( direction , upriv , tmp , j * rootN ); 791 printf("@@@ after FFT1Once / j = %d\n", j ); 758 792 TwiddleOneCol( direction , j , twid , tmp , j * rootN ); 793 printf("@@@ after Twiddle / j = %d\n", j ); 759 794 } 760 795 761 796 #if DEBUG_FFT1D 762 printf("\n @@@ tmp after columns FFT + twiddle \n");763 PrintArray( tmp , N );797 printf("\n[FFT] %s : thread %x after first twiddle\n", __FUNCTION__, MyNum); 798 if( VERBOSE ) PrintArray( tmp , N ); 764 799 #endif 765 800 … … 775 810 776 811 #if DEBUG_FFT1D 777 printf("\n @@@ x after second transpose \n");778 PrintArray( x , N );812 printf("\n[FFT] %s : thread %x after second transpose\n", __FUNCTION__, MyNum); 813 if( VERBOSE ) PrintArray( x , N ); 779 814 #endif 780 815 … … 794 829 795 830 #if DEBUG_FFT1D 796 printf("\n @@@ x after rows FFT + scaling \n");797 PrintArray( x , N );831 printf("\n[FFT] %s : thread %x after FFT on rows\n", __FUNCTION__, MyNum); 832 if( VERBOSE ) PrintArray( x , N ); 798 833 #endif 799 834 … … 809 844 810 845 #if DEBUG_FFT1D 811 printf("\n @@@ tmp after third transpose \n");812 PrintArray( tmp, N );846 printf("\n[FFT] %s : thread %x after third transpose\n", __FUNCTION__, MyNum); 847 if( VERBOSE ) PrintArray( x , N ); 813 848 #endif 814 849 … … 824 859 825 860 #if DEBUG_FFT1D 826 printf("\n @@@ x after final copy \n");827 PrintArray( x , N );861 printf("\n[FFT] %s : thread %x after final copy\n", __FUNCTION__, MyNum); 862 if( VERBOSE ) PrintArray( x , N ); 828 863 #endif 829 864 … … 835 870 // x[] array by the corresponding twiddle factor, contained in the u[] array. 836 871 ///////////////////////////////////////////////////////////////////////////////////// 837 void TwiddleOneCol( longdirection,838 longj, // y coordinate in 2D view of coef array839 double ** u, // coef array base address840 double ** x, // data array base address841 longoffset_x ) // first point in N points data array842 { 843 longi;872 void TwiddleOneCol( int direction, 873 unsigned int j, // y coordinate in 2D view of coef array 874 double ** u, // coef array base address 875 double ** x, // data array base address 876 unsigned int offset_x ) // first point in N points data array 877 { 878 unsigned int i; 844 879 double omega_r; 845 880 double omega_c; 846 881 double x_r; 847 882 double x_c; 848 longc_id;849 longc_offset;883 unsigned int c_id; 884 unsigned int c_offset; 850 885 851 886 for (i = 0; i < rootN ; i++) // loop on the rootN points … … 868 903 } // end TwiddleOneCol() 869 904 870 //////////////////////// 871 void Scale( double ** x, // data array base address872 longoffset_x ) // first point of the row to be scaled873 { 874 longi;875 longc_id;876 longc_offset;905 //////////////////////////// 906 void Scale( double ** x, // data array base address 907 unsigned int offset_x ) // first point of the row to be scaled 908 { 909 unsigned int i; 910 unsigned int c_id; 911 unsigned int c_offset; 877 912 878 913 for (i = 0; i < rootN ; i++) … … 880 915 c_id = (offset_x + i) / (points_per_cluster); 881 916 c_offset = (offset_x + i) % (points_per_cluster); 882 data[c_id][2*c_offset] /= N;883 data[c_id][2*c_offset + 1] /= N;917 x[c_id][2*c_offset] /= N; 918 x[c_id][2*c_offset + 1] /= N; 884 919 } 885 920 } 886 921 887 //////////////////////////// 888 void Transpose( double ** src, // source buffer (array of pointers)889 double ** dest, // destination buffer (array of pointers)890 longMyFirst, // first row allocated to the thread891 longMyLast ) // last row allocated to the thread892 { 893 longrow; // row index894 longpoint; // data point index in a row895 896 longindex_src; // absolute index in the source N points array897 longc_id_src; // cluster for the source buffer898 longc_offset_src; // offset in the source buffer899 900 longindex_dst; // absolute index in the dest N points array901 longc_id_dst; // cluster for the dest buffer902 longc_offset_dst; // offset in the dest buffer922 /////////////////////////////////// 923 void Transpose( double ** src, // source buffer (array of pointers) 924 double ** dest, // destination buffer (array of pointers) 925 unsigned int MyFirst, // first row allocated to the thread 926 unsigned int MyLast ) // last row allocated to the thread 927 { 928 unsigned int row; // row index 929 unsigned int point; // data point index in a row 930 931 unsigned int index_src; // absolute index in the source N points array 932 unsigned int c_id_src; // cluster for the source buffer 933 unsigned int c_offset_src; // offset in the source buffer 934 935 unsigned int index_dst; // absolute index in the dest N points array 936 unsigned int c_id_dst; // cluster for the dest buffer 937 unsigned int c_offset_dst; // offset in the dest buffer 903 938 904 939 … … 924 959 } // end Transpose() 925 960 926 ///////////////////////// 927 void Copy( double ** src, // source buffer (array of pointers)928 double ** dest, // destination buffer (array of pointers)929 longMyFirst, // first row allocated to the thread930 longMyLast ) // last row allocated to the thread931 { 932 longrow; // row index933 longpoint; // data point index in a row934 935 longindex; // absolute index in the N points array936 longc_id; // cluster index937 longc_offset; // offset in local buffer961 ////////////////////////////// 962 void Copy( double ** src, // source buffer (array of pointers) 963 double ** dest, // destination buffer (array of pointers) 964 unsigned int MyFirst, // first row allocated to the thread 965 unsigned int MyLast ) // last row allocated to the thread 966 { 967 unsigned int row; // row index 968 unsigned int point; // data point index in a row 969 970 unsigned int index; // absolute index in the N points array 971 unsigned int c_id; // cluster index 972 unsigned int c_offset; // offset in local buffer 938 973 939 974 // scan all data points allocated to the thread … … 952 987 } // end Copy() 953 988 954 ////////////////////////// 955 void Reverse( double ** x,956 longoffset_x )957 { 958 longj, k;959 longc_id_j;960 longc_offset_j;961 longc_id_k;962 longc_offset_k;989 /////////////////////////////// 990 void Reverse( double ** x, 991 unsigned int offset_x ) 992 { 993 unsigned int j, k; 994 unsigned int c_id_j; 995 unsigned int c_offset_j; 996 unsigned int c_id_k; 997 unsigned int c_offset_k; 963 998 964 999 for (k = 0 ; k < rootN ; k++) … … 982 1017 // (i.e. rootN points) of the x[nclusters][points_per_cluster] array. 983 1018 ///////////////////////////////////////////////////////////////////////////// 984 void FFT1DOnce( long direction, // direct /inverse985 double *u, // private coefs array986 double ** x, // array of pointers on distributed buffers987 longoffset_x ) // absolute offset in the x array988 { 989 longj;990 longk;991 longq;992 longL;993 longr;994 longLstar;1019 void FFT1DOnce( int direction, // 1 direct / -1 inverse 1020 double * u, // private coefs array 1021 double ** x, // array of pointers on distributed buffers 1022 unsigned int offset_x ) // absolute offset in the x array 1023 { 1024 unsigned int j; 1025 unsigned int k; 1026 unsigned int q; 1027 unsigned int L; 1028 unsigned int r; 1029 unsigned int Lstar; 995 1030 double * u1; 996 1031 997 longoffset_x1; // index first butterfly input998 longoffset_x2; // index second butterfly output999 1000 double omega_r; // real part butterfy coef1001 double omega_c; // complex part butterfly coef1002 1003 double tau_r;1004 double tau_c;1005 1006 double d1_r; // real part first butterfly input1007 double d1_c; // imag part first butterfly input1008 double d2_r; // real part second butterfly input1009 double d2_c; // imag part second butterfly input1010 1011 longc_id_1; // cluster index for first butterfly input1012 longc_offset_1; // offset for first butterfly input1013 longc_id_2; // cluster index for second butterfly input1014 longc_offset_2; // offset for second butterfly input1032 unsigned int offset_x1; // index first butterfly input 1033 unsigned int offset_x2; // index second butterfly output 1034 1035 double omega_r; // real part butterfy coef 1036 double omega_c; // complex part butterfly coef 1037 1038 double tau_r; 1039 double tau_c; 1040 1041 double d1_r; // real part first butterfly input 1042 double d1_c; // imag part first butterfly input 1043 double d2_r; // real part second butterfly input 1044 double d2_c; // imag part second butterfly input 1045 1046 unsigned int c_id_1; // cluster index for first butterfly input 1047 unsigned int c_offset_1; // offset for first butterfly input 1048 unsigned int c_id_2; // cluster index for second butterfly input 1049 unsigned int c_offset_2; // offset for second butterfly input 1015 1050 1016 1051 #if DEBUG_ONCE … … 1020 1055 for ( p = 0 ; p < rootN ; p++ ) 1021 1056 { 1022 longindex = offset_x + p;1023 longc_id = index / (points_per_cluster);1024 longc_offset = index % (points_per_cluster);1057 unsigned int index = offset_x + p; 1058 unsigned int c_id = index / (points_per_cluster); 1059 unsigned int c_offset = index % (points_per_cluster); 1025 1060 printf("%f , %f | ", x[c_id][2*c_offset] , x[c_id][2*c_offset+1] ); 1026 1061 } … … 1035 1070 for ( p = 0 ; p < rootN ; p++ ) 1036 1071 { 1037 longindex = offset_x + p;1038 longc_id = index / (points_per_cluster);1039 longc_offset = index % (points_per_cluster);1072 unsigned int index = offset_x + p; 1073 unsigned int c_id = index / (points_per_cluster); 1074 unsigned int c_offset = index % (points_per_cluster); 1040 1075 printf("%f , %f | ", x[c_id][2*c_offset] , x[c_id][2*c_offset+1] ); 1041 1076 } … … 1106 1141 for ( p = 0 ; p < rootN ; p++ ) 1107 1142 { 1108 longindex = offset_x + p;1109 longc_id = index / (points_per_cluster);1110 longc_offset = index % (points_per_cluster);1143 unsigned int index = offset_x + p; 1144 unsigned int c_id = index / (points_per_cluster); 1145 unsigned int c_offset = index % (points_per_cluster); 1111 1146 printf("%f , %f | ", x[c_id][2*c_offset] , x[c_id][2*c_offset+1] ); 1112 1147 } … … 1116 1151 } // end FFT1DOnce() 1117 1152 1118 ////////////////////////////////// 1119 void PrintArray( double ** array,1120 longsize )1121 { 1122 longi;1123 longc_id;1124 longc_offset;1153 /////////////////////////////////////// 1154 void PrintArray( double ** array, 1155 unsigned int size ) 1156 { 1157 unsigned int i; 1158 unsigned int c_id; 1159 unsigned int c_offset; 1125 1160 1126 1161 // float display -
trunk/user/ksh/ksh.c
r469 r473 108 108 path = argv[1]; 109 109 110 printf(" error: not implemented yet\n" );110 printf(" error: not implemented yet\n", argc, argv ); 111 111 112 112 /* … … 167 167 path = argv[1]; 168 168 169 printf(" error: not implemented yet\n" );169 printf(" error: not implemented yet\n", argc, argv ); 170 170 171 171 // release semaphore to get next command … … 189 189 } 190 190 191 printf(" error: not implemented yet\n" );191 printf(" error: not implemented yet\n", argc, argv ); 192 192 193 193 /* … … 546 546 unsigned int i; 547 547 548 if (argc != 1) 549 { 550 printf(" usage: %s\n", argv[0], argc ); 551 return; 552 } 553 548 554 printf("--- registered commands ---\n"); 549 555 for (i = 0; i < LOG_DEPTH; i++) … … 639 645 if (argc != 1) 640 646 { 641 printf(" usage: pwd\n");647 printf(" usage: %s\n", argv[0]); 642 648 return; 643 649 } … … 664 670 if (argc != 2) 665 671 { 666 printf(" usage: rm pathname\n");672 printf(" usage: %s pathname\n", argv[0]); 667 673 return; 668 674 } … … 1041 1047 } // end interactive() 1042 1048 1043 ////////// /////////////////////////1044 int main( int argc , char *argv[])1049 ////////// 1050 int main() 1045 1051 { 1046 1052 unsigned int cxy; // owner cluster identifier for this KSH process … … 1067 1073 exit( 1 ); 1068 1074 } 1069 1070 printf("\n@@@ in KSH %s : &semaphore = %x\n", __FUNCTION__, &semaphore );1071 1075 1072 1076 // initialize interactive thread attributes -
trunk/user/sort/sort.c
r469 r473 64 64 unsigned int init_pos ) 65 65 { 66 int i;67 int j;68 int aux;66 unsigned int i; 67 unsigned int j; 68 int aux; 69 69 70 70 for(i = 0; i < length; i++) … … 263 263 } 264 264 265 get_cycle( &cycle ); 266 printf("\n[SORT] main completes barrier init at cycle %d\n", (unsigned int)cycle ); 265 printf("\n[SORT] main completes barrier init\n"); 267 266 268 267 // Array to sort initialization … … 277 276 #endif 278 277 279 get_cycle( &cycle ); 280 printf("\n[SORT] main completes array init at cycle %d\n", (unsigned int)cycle ); 278 printf("\n[SORT] main completes array init\n"); 281 279 282 280 // launch other threads to execute sort() function
Note: See TracChangeset
for help on using the changeset viewer.