CPU registers can be classified as volatile and non-volatile by calling convension, how does does the meaning of word volatile
implies the classification?
In a volatile memory, the process can both read and write. It means that the process would have direct access to the data and information within it. In a non-volatile memory, the process can only read. It means that the processor won't have direct access to the data and information within.
They are volatile. So the second and forth options can be avoided.
Volatile registers' content may change over a subroutine call. A non-volatile register is a type of register with contents that must be preserved over subroutine calls.
Volatile memory is a type of memory that maintains its data only while the device is powered. If the power is interrupted for any reason, the data is lost.
From http://www.techopedia.com/definition/8591/non-volatile-register
Volatile registers' content may change over a subroutine call.
A non-volatile register is a type of register with contents that must be preserved over subroutine calls. Whenever the value of a nonvolatile register is changed by the routine, the old value has to be saved on the stack prior to changing the register and that value has to be restored before returning. A register is similar to a variable, except that there is a fixed number of registers. Every register is a unique location in the CPU in which a single value is saved. A register is the one and only place where mathematical functions, such as addition, multiplication, subtraction, etc., can be carried out. Registers often hold pointers that refer to the memory. Moving values between memory and registers is a common phenomenon.
In other words volatile registers are caller saved registers, as opposed to callee saved. See https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019#callercallee-saved-registers
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