wiki:common_utils

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

--

GIET-VM / Miscelaneous kernel functions

The utils.c and util.h files define various kernel functions that are used both by the boot-loader and by the kernel.

They are prefixed by "_" to remind that they can only be executed by a processor in kernel mode.

void _exit()

Processor suicide with a dated message on TTY0 in case of kernel panic.

void _random_wait( unsigned int value )

This function implements a pseudo-random delay. The value argument define the max number of bits for the delay. The average delay value is approximately : (2value) * 2 / 3

void _break( char* string )

This blocking function implements an interactive break for kernel debug.

unsigned int _strncmp( const char* s1, const char* s2, unsigned int n )

Compare two strings s1 and s2, no more than n characters.

char* _strcpy( char* dest, char* source )

Copy source string to dest string.

void _dcache_buf_invalidate( void* buffer, unsigned int size )

Invalidate all data cache lines corresponding to a memory buffer identified by a virtual base address and a size.

unsigned int _heap_info( unsigned int* vaddr, unsigned int* size, unsigned int x, unsigned int y )

This function returns in the vaddr and size arguments the information associated to a heap. If (x < X_SIZE) and (y < Y_SIZE), it return the heap associated to any task running in cluster(x,y). Else, it return the heap associated to the calling task. It uses the mapping_info structure to retrieve information, and return 0 if success. Return non zero if not found.