I was wondering, what are $k0
and $k1
registers in MIPS architecture.
As there is on WikiBooks MIPS Assembly
The k registers are reserved for use by the OS kernel.
But I couldn't find anything about what are they usefull for? and also how to use them?
Thank you.
An interrupt handler must save any general - purpose registers that it is going to use (to be restored at return). But to do so requires you to modify at least one register first (something
like sw $t0, saved_t0
expands to two machine instructions using $at
).
This situation is resolved by forbidding user programs from using two general - purpose registers, $k0
and $k1
(The k stands for kernel, which an exception handler is part of). The interrupt handler is allowed to use $k0
and $k1
without having to save or restore their values. This allows just enough leeway to start saving registers, as well as making returning from the interrupt handler possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With