ia-32_instruction-set-ref_a-m

The registers in the x87 fpu data register stack

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: BP/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. The ENTER instruction causes a page fault whenever a write using the final value of the stack pointer (within the current stack segment) would do so. In 64-bit mode, default operation size is 64 bits; 32-bit operation size cannot be encoded. 3-280 Vol. 2 INSTRUCTION SET REFERENCE, A-M Operation NestingLevel NestingLevel MOD 32 IF 64-Bit Mode (StackSize = 64) THEN Push(RBP); FrameTemp RSP; ELSE IF StackSize = 32 THEN Push(EBP); FrameTemp ESP; FI; ELSE (* StackSize = 16 *) Push(BP); FrameTemp SP; FI; IF NestingLevel = 0 THEN GOTO CONTINUE; FI; IF (NestingLevel > 1) THEN FOR i 1 to (NestingLevel - 1) DO IF 64-Bit Mode (StackSize = 64) THEN RBP RBP - 8; Push([RBP]); (* Quadword push *) ELSE IF OperandSize = 32 THEN IF StackSize = 32 EBP EBP - 4; Push([EBP]); (* Doubleword push *) ELSE (* StackSize = 16 *) BP BP - 4; Push([BP]); (* Doubleword push *) FI; FI; ELSE (* OperandSize = 16 *) IF StackSize = 32 THEN EBP EBP - 2; Push([EBP]); (* Word push *) ELSE (* StackSize = 16 *) BP BP - 2; Push([BP]); (* Word push *) Vol. 2 3-281 INSTRUCTION SET REFERENCE, A-M FI; FI; OD; FI; IF 64-Bit Mode (StackSize = 64) THEN Push(FrameTemp); (* Quadword push *) ELSE IF OperandSize = 32 THEN Push(FrameTemp); FI; (* Doubleword push *) ELSE (* OperandSize = 16 *) Push(FrameTemp); (* Word push *) FI; CONTINUE: IF 64-Bit Mode (StackSize = 64) THEN RBP FrameTemp; RSP RSP - Size; ELSE IF StackSize = 32 THEN EBP FrameTemp; ESP ESP - Size; FI; ELSE (* StackSize = 16 *) BP FrameTemp; SP SP - Size; FI; END; Flags Affected None. Protected Mode Exceptions #SS(0) #PF(fault-code) If the new value of the SP or ESP register is outside the stack segment limit. If a page fault occurs or if a write using the final value of the stack pointer (within the current stack segment) would cause a page fault. 3-282 Vol. 2 INSTRUCTION SET REFERENCE, A-M Real-Address Mode Exceptions #SS(0) If the new value of the SP or ESP register is outside the stack segment limit. Virtual-8086 Mode Exceptions #SS(0) #PF(fault-code) If the new value of the SP or ESP register is outside the stack segment limit. If a page fault occurs or if a write using the final value of the stack pointer (within the current stack segment) would cause a page fault. Compatibility Mode Exceptions Same exceptions as in Protected Mode. 64-Bit Mode Exceptio...
View Full Document

Ask a homework question - tutors are online