wiki:kernel_tty0

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

--

GIET-VM / TTY0 access functions

The tty0.c and tty0.h files define the functions used to access the kernel terminal TTY[0]. The _put* functions do not take the lock protecting exclusive access to TTY0. The _printf function takes the lock protecting exclusive access to TTY0..

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

void _puts( char* string )

Displays a string on kernel TTY0. This function does NOT take the TTY0 lock.

void _putx( unsigned int value )

Displays a 32 bits word as an hexadecimal string on kernel TTY0. This function does NOT take the TTY0 lock.

void _putl( unsigned long long value )

Displays a 64 bits word as an hexadecimal string on kernel TTY0. This function does NOT take the TTY0 lock.

void _putd( unsigned int value )

Displays a 32 bits word as an decimal string on kernel TTY0. This function does NOT take the TTY0 lock.

void _getc( char* byte )

This blocking function uses a polling strategy on the TTY0 status register to get a single character.

void _printf( char* format, ... )

This function displays a formated string on TTY0, after taking the simple_lock_t to get exclusive access. Only the following formats are supported:

  • %s : character string (0 terminated)
  • %x : hexadecimal representation for an unsigned int (32 bits)
  • %l : hexadecimal representation for an unsigned long long (64 bits)
  • %d : decimal representation for a signed int (32 bits)