2 ms·
We even have the legacy of that in x86 - the ENTER opcode, the second argument for which is "nesting level of the function": "If the nesting level is 0, the pr
by int_19h 8y ago
We even have the legacy of that in x86 - the ENTER opcode, the second argument for which is "nesting level of the function":
"If the nesting level is 0, the processor pushes the frame pointer from the BP/EBP/RBP register onto the stack, copies the current stack pointer from the SP/ESP/RSP register into the BP/EBP/RBP register, and loads the SP/ESP/RSP register with the current stack-pointer value minus the value in the size operand. For nesting levels of 1 or greater, the processor pushes additional frame pointers on the stack before adjusting the stack pointer. These additional frame pointers provide the called procedure with access points to other nested frames on the stack. See “Procedure Calls for Block-Structured Languages” in Chapter 6 of the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1, for more information about the actions of the ENTER instruction."
(Although, curiously, Free Pascal - which also implements this feature - doesn't use ENTER in assembly, last I checked.)