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
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)
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