Version 3 (modified by 10 years ago) (diff) | ,
---|
Kernel Utilities
The utils.c and util.h files define useful 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.
- They are used by the boot-loader in the static phase, to build the page tables and initialize the schedulers and the peripherals.
- They are also used by the kernel in the dynamic phase, to handle events such as interrupts, exceptions and syscalls.
-
Kernel Utilities
-
1) CP0 registers access functions
- unsigned int _get_sched( void )
- unsigned int _get_epc( void )
- unsigned int _get_cr( void )
- unsigned int _get_sr( void )
- unsigned int _get_bvar( void )
- unsigned int _get_procid( void )
- void _set_sched( unsigned int value )
- void _set_sr( unsigned int value )
- void _it_disable( unsigned int* save_sr_ptr )
- void _it_restore( unsigned int* save_sr_ptr )
- 2) Physical addressing functions
-
1) CP0 registers access functions
1) CP0 registers access functions
unsigned int _get_sched( void )
Returns the virtual address of the scheduler stored in the SCHED register for the processor running the calling task.
unsigned int _get_epc( void )
Returns the value stored in the EPC register for the processor running the calling task.
unsigned int _get_cr( void )
Returns the value stored in the CR register for the processor running the calling task.
unsigned int _get_sr( void )
Returns the value stored in the SR register for the processor running the calling task.
unsigned int _get_bvar( void )
Returns the value stored in the BVAR register, for the processor running the calling task.
unsigned int _get_procid( void )
Returns the global processor identifier stored in the EBASE register for the processor running the calling task.
void _set_sched( unsigned int value )
Writes value in the SCHED register, for the processor running the calling task.
void _set_sr( unsigned int value )
Writes value in the 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 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 SR register, for the processor running the calling task.
These functions can be used to access the MIPS32 protected registers
2) Physical addressing functions
===