The MASM Forum

General => The Campus => Topic started by: aw27 on September 06, 2016, 07:09:38 PM

Title: MASM article at codeproject.com
Post by: aw27 on September 06, 2016, 07:09:38 PM
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
Title: Re: MASM article at codeproject.com
Post by: jj2007 on September 06, 2016, 07:34:09 PM
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)
Title: Re: MASM article at codeproject.com
Post by: aw27 on September 07, 2016, 01:12:01 AM
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