wiki:kernel_miscelaneous

Version 1 (modified by alain, 10 years ago) (diff)

--

GIET-VM / Miscelaneous common kernel functions

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 _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.