| 1 | = GIET-VM / CP0 access functions = |
| 2 | |
| 3 | [[PageOutline]] |
| 4 | |
| 5 | The [source:soft/giet_vm/giet_common/utils.c utils.c] and [source:soft/giet_vm/giet_common/utils.h util.h] files define kernel functions that are used both by the boot-loader and by the kernel. |
| 6 | They are prefixed by ''_'' to remind that they can only be executed by a processor in kernel mode. |
| 7 | |
| 8 | === unsigned int _get_sched( void ) === |
| 9 | Returns the virtual address of the scheduler, stored in the CP0_SCHED register, for the processor running the calling task. |
| 10 | |
| 11 | === unsigned int _get_epc( void ) === |
| 12 | Returns the value stored in the CP0_EPC register, for the processor running the calling task. |
| 13 | |
| 14 | === unsigned int _get_cr( void ) === |
| 15 | Returns the value stored in the CP0_CR register, for the processor running the calling task. |
| 16 | |
| 17 | === unsigned int _get_sr( void ) === |
| 18 | Returns the value stored in the CP0_SR register, for the processor running the calling task. |
| 19 | |
| 20 | === unsigned int _get_bvar( void ) === |
| 21 | Returns the value stored in the CP0_BVAR register, for the processor running the calling task. |
| 22 | |
| 23 | === unsigned int _get_procid( void ) === |
| 24 | Returns the global processor identifier stored in the CP0_PROCID register for the processor running the calling task. |
| 25 | |
| 26 | === unsigned int _get_protime( void ) === |
| 27 | Returns the cycle count stored in the CP0_TIME register for the processor running the calling task. |
| 28 | |
| 29 | === void _set_sched( unsigned int value ) === |
| 30 | Writes ''value'' in the CP0_SCHED register, for the processor running the calling task. |
| 31 | |
| 32 | === void _set_sr( unsigned int value ) === |
| 33 | Writes ''value'' in the CP0_SR register, for the processor running the calling task. |
| 34 | |
| 35 | === void _it_disable( unsigned int* save_sr_ptr ) === |
| 36 | Disables interrupts for the processor running the calling task and save the CP0_SR value at address ''save_sr_ptr''. |
| 37 | |
| 38 | === void _it_restore( unsigned int* save_sr_ptr ) === |
| 39 | Writes the value pointed by ''save_sr_ptr'' into the CP0_SR register, for the processor running the calling task. |
| 40 | |
| 41 | |