News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

MASM article at codeproject.com

Started by aw27, September 06, 2016, 07:09:38 PM

Previous topic - Next topic

aw27

Hello members,

I found this article at http://www.codeproject.com/Articles/1123638/MASM-Stack-Memory-Alignment
The author would appreciate any comments in order to help improve it.

Cheers,

aw27

jj2007

SAVE_XMM_IN_ALIGNED_STACK_MEMORY macro PtrToStackMem, reg
    push eax ;; Now we are safe to "push" and "pop" registers.
    mov eax, PtrToStackMem
    movaps [eax], reg ;; Were the memory not aligned and an exception would occur here.
    pop eax
endm


Yep, we all know that movaps is much faster than movups 8)

aw27

And when you call a function that expects a 16-byte aligned parameter, we can always ask its developer to change it to accept unaligned memory and use movups to realign it.  :t