Generating function epilogue
Ken Brakey
brakeykr@poncacity.net
Sun Nov 28 19:41:00 GMT 1999
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.
More information about the Gcc-help
mailing list