From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Andrew Lynch" Message-Id: <1040626135604.ZM882@Sindy> Date: Sat, 26 Jun 2004 13:56:04 +0200 In-Reply-To: rog@vitanuova.com "Re: [9fans] which register is used as FP on the x86" (Jun 25, 6:53pm) References: <90a3e63881750a184ef8b70e226c99ae@vitanuova.com> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] which register is used as FP on the x86 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Topicbox-Message-UUID: aeea4d34-eacd-11e9-9e20-41e7f4b1d025 On Jun 25, 6:53pm, rog@vitanuova.com wrote: > no register is dedicated as a frame pointer. > > if you know the PC, you can find out the FP from the SP. Maybe not dedicated, in the sense that you can also use it for other stuff, but the EBP register is intended to be used as FP: "3. Stack-Frame Base Pointer (EBP) Register: The EBP register typically is used to access data structures passed on the stack. [...] If the stack pointer is copied into the base pointer before anything is pushed on the stack, the base pointer can be used to reference data structures with fixed offsets. [...] Instructions, such as ENTER and LEAVE instructions, are provided which automatically set up the EBP register for convenient access to variables." intel 386DX Microprocessor Programmer's Reference Manual 1990 Andrew. P.S. If you have a gcc targeted for x86 you can see for yourself by comparing the output of "gcc -S" with "gcc -fomit-frame-pointer -S".