On Wed, Sep 23, 2009 at 12:25 PM, Phil Dawes <[email protected]> wrote:
> Hi Slava,
>
> Why is STACK_PADDING=56 in cpu-x86.64.S?

So that on entry to a procedure that calls other procedures, you can
subtract STACK_PADDING from esp to get a 16-byte aligned stack
pointer.

On Windows x86-64, you have to reserve space in your stack frame for
the return address together with 4 saved registers, for a total of 40
bytes; rounding this up to a multiple of 16 gives 48, but for some
reason I chose 64. It doesn't really matter.

> I originally assumed this was because the return address got pushed
> during the call instruction (which would then align rsp to 16bytes), but
> if that's the case what happens to the calls in cpu-x86.S that don't
> have this padding?

All subroutines in cpu-x86.S that call other procedures align the
stack correctly. Leaf procedures do not need to align the stack.

Slava

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to