News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

raw function prolog/epilog ....

Started by James Ladd, September 25, 2006, 11:05:47 PM

Previous topic - Next topic

James Ladd

For my library of functions I am coding without macros in Gnu Assembler.
The functions work, but im interested in feedback on the function prolog/epilog.
Essentially im just asking you if all looks right.

The functions are for a 'C' calling convention and currently do nothing and
return 0.

Rgs, James.


        push ebp
        mov ebp, esp
        push ebx

        xor eax, eax

        pop ebx
        mov esp, ebp
        pop ebp
        ret

hutch--

James,

It looks fine but note that if you pass parameters on the stack like normal, you either balance the stack with RET NUMBER or if its C calling convention, you balance the stack after the function has returned.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Yep, looks good, assuming a) the function has arguments and/or 'local' variables (otherwise there's no need for the stack frame), and b) ebx will be used. (Yes I'm quite sure you know all of this already - too many people on high horses around here ::) :bdg)
Just depends how picky you want to be :wink
No snowflake in an avalanche feels responsible.