wiki:kernel_cp0

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

--

GIET-VM / CP0 access functions

The utils.c and util.h files define 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.

unsigned int _get_sched( void )

Returns the virtual address of the scheduler, stored in the CP0_SCHED register, for the processor running the calling task.

unsigned int _get_epc( void )

Returns the value stored in the CP0_EPC register, for the processor running the calling task.

unsigned int _get_cr( void )

Returns the value stored in the CP0_CR register, for the processor running the calling task.

unsigned int _get_sr( void )

Returns the value stored in the CP0_SR register, for the processor running the calling task.

unsigned int _get_bvar( void )

Returns the value stored in the CP0_BVAR register, for the processor running the calling task.

unsigned int _get_procid( void )

Returns the global processor identifier stored in the CP0_PROCID register for the processor running the calling task.

unsigned int _get_protime( void )

Returns the cycle count stored in the CP0_TIME register for the processor running the calling task.

void _set_sched( unsigned int value )

Writes value in the CP0_SCHED register, for the processor running the calling task.

void _set_sr( unsigned int value )

Writes value in the CP0_SR register, for the processor running the calling task.

void _it_disable( unsigned int* save_sr_ptr )

Disables interrupts for the processor running the calling task and save the CP0_SR value at address save_sr_ptr.

void _it_restore( unsigned int* save_sr_ptr )

Writes the value pointed by save_sr_ptr into the CP0_SR register, for the processor running the calling task.