| 1 | = GIET-VM / Miscelaneous common kernel functions = |
| 2 | |
| 3 | [[PageOutline]] |
| 4 | |
| 5 | The [source:soft/giet_vm/giet_common/utils.c utils.c] and [source:soft/giet_vm/giet_common/utils.h utils.h] files define various kernel functions that can be used by both the kernel code and the boot code. |
| 6 | |
| 7 | === void '''_exit'''(void) === |
| 8 | This function is called in case of kernel error. |
| 9 | The processor try to displays an error message on TTY0, and suicide (enter infinite loop)... |
| 10 | |
| 11 | === void '''_random_wait'''( unsigned int value ) === |
| 12 | This function implements a pseudo-random delay. |
| 13 | The 5 LSB bits of the '''value''' argument (number between 0 and 31) define the average delay value: 2 * (2**(value[4:0] |
| 14 | |
| 15 | === void '''_break'''( char* str ) === |
| 16 | This function can be used for interactive kernel debug. It displays the '''str''' string on TTY0, |
| 17 | and waits until a character typed on TTY0. |
| 18 | |
| 19 | === unsigned int '''_strncmp'''( const char* s1, const char* s2, unsigned int n ); |
| 20 | This function compares the '''n''' first characters of the two '''s1''' and '''s2''' strings. |
| 21 | Returns 0 if all characters are identical. returns 1 otherwise. |
| 22 | |
| 23 | === char* '''_strcpy'''( char* dest, char* source ) === |
| 24 | This function copies the '''source''' string to the '''dest''' string, and returns a pointer on the '''dest''' string. |
| 25 | |
| 26 | === void '''_dcache_buf_invalidate'''( unsigned int buf_vbase, unsigned int buf_size ) === |
| 27 | This function invalidates all cache lines contained in the L1 data cache that overlap the buffer defined by |
| 28 | the '''buf_vbase''' and '''buf_size''' arguments. |
| 29 | |