This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Generating function epilogue
- To: help-gcc at gnu dot org
- Subject: Re: Generating function epilogue
- From: Ken Brakey <brakeykr at poncacity dot net>
- Date: Sun, 28 Nov 1999 21:37:26 -0600
- Newsgroups: gnu.gcc.help
- Organization: Sandbox
- References: <819ou7$nql$1@nnrp1.deja.com>
- Reply-To: brakeykr at poncacity dot net
- Xref: wodc7nx0 gnu.gcc.help:1995
gmirchev@usa.net wrote:
> Hello,
> I have the following problem:
>
> I need to generate the right function epilogue, but without the ret
> instruction on the end. Instead a jmp to another function, as if
> my function has never been called.
> Using the address of the first argument I can restore the frame and jmp
> to the other function, but the registers don't get restored, so it all
> fails, changing the subroutine that calls my function is not an option.
> HELP !
When you CALL, the return address is saved on the stack, if stack is large enough.
When you JUMP, the return address is forgotten
You could save regs to, and restore regs from a struc.
If something happens in 'OTHER FUNC' that determins you could call everytime
but if not returning to 'MY FUNC' pop the return address off the stack and return
to
'SUBROUTINE'
Ken
>
>
> Here is the map:
>
> SUBROUTINE MY FUNC OTHER FUNC
>
> call -----> may if called
> return will ret to
> MY FUNC, if
> may call ---> jmped will ret
> to SUBROUTINE
> may jmp --->
>
> Regs: George
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.