Version 7 (modified by 10 years ago) (diff) | ,
---|
GIET-VM / Miscelaneous common kernel functions
-
GIET-VM / Miscelaneous common kernel functions
-
- void _exit(void)
- void _random_wait( unsigned int value )
- void _break( char* str )
- unsigned int _strlen( char* str )
- unsigned int _strncmp( const char* s1, const char* s2, …
- char* _strcpy( char* dest, char* source )
- void _dcache_buf_invalidate( unsigned int buf_vbase, unsigned …
- void _get_sqt_footprint( unsigned int* xmax, unsigned int* …
-
The utils.c and utils.h files define various kernel functions that can be used by both the kernel code and the boot code.
void _exit(void)
This function is called in case of kernel error. The processor try to displays an error message on TTY0, and suicide (enter infinite loop)...
void _random_wait( unsigned int value )
This function implements a pseudo-random delay. The 5 LSB bits of the value argument (number between 0 and 31) define the average delay value: 2 * (2(value[4:0])
void _break( char* str )
This function can be used for interactive kernel debug. It displays the str string on TTY0, and waits until a character typed on TTY0.
unsigned int _strlen( char* str )
This function returns the length of the str string (without the terminating NUL charater).
unsigned int _strncmp( const char* s1, const char* s2, unsigned int n );
This function compares the n first characters of the two s1 and s2 strings. Returns 0 if all characters are identical. returns 1 otherwise.
char* _strcpy( char* dest, char* source )
This function copies the source string to the dest string, and returns a pointer on the dest string.
void _dcache_buf_invalidate( unsigned int buf_vbase, unsigned int buf_size )
This function invalidates all cache lines contained in the L1 data cache that overlap the buffer defined by the buf_vbase and buf_size arguments.
void _get_sqt_footprint( unsigned int* xmax, unsigned int* ymax, unsigned int* levels )
Scalable, distributed synchronisation mechanisms, such as barriers or locks use Synchronisation Quad Tree (SQT). This function computes the smallest SQT covering all clusters containing processors in a platform. The SQT footprint is defined by the xmax (max number of clusters in a row) and ymax (max number of clusters in a column) parameters. The levels parameter define the number of levels between the SQT root and the SQT bottom, with the following features:
- cluster[0][0] is always covered by the SQT
- xmax & ymax are not always power of 2
- xmax & ymax cannot be larger than the (X_SIZE/Y_SIZE) parameters, but can be smaller (when the upper rows, or the right columns do not contain processors).