Changeset 473 for trunk/libs
- Timestamp:
- Aug 21, 2018, 6:01:01 PM (6 years ago)
- Location:
- trunk/libs
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.