On 6 January 2012 05:42, Manu <turkeyman@gmail.com> wrote:
On 6 January 2012 05:22, Walter Bright <newshound2@digitalmars.com> wrote:
On 1/5/2012 6:25 PM, Manu wrote:
Are you talking about for parameter passing, or for local variable assignment on
the stack?
For parameter passing, I understand the x32 problems with aligning the arguments
(I think it's possible to work around though), but there should be no problem
with aligning the stack for allocating local variables.

Aligning the stack. Before I say anything, I want to hear your suggestion for how to do it efficiently.

Perhaps I misunderstand, I can't see the problem?
In the function preamble, you just align it... something like:
  mov reg, esp ; take a backup of the stack pointer
  and esp, -16 ; align it

... function

  mov esp, reg ; restore the stack pointer
  ret 0

That said, most of the time values used in smaller functions will only ever exist in regs, and won't ever be written to the stack... in this case, there's no problem.