Hi Oliver,

The 16-byte stack alignment requirement is to maintain SSE
compatibility.

Sherry

On Tue, Apr 28, 2009 at 11:29:26AM +0800, Oliver Yang wrote:
>
> Hi All,
>
> While reading the code of usr/src/uts/intel/ia32/sys/stack.h, I found  
> the STACK_ALIGN on amd64 is defined as 16.
>
> In the comments of the same file, it says,
>
>
> * The end of the input argument area must be aligned on a 16-byte
> * boundary; i.e. (%rsp - 8) % 16 == 0 at function entry.
>
>
> My question is what's the meaning or purpose for end of the input  
> argument alignment?
>
> The ASSERT_STACK_ALIGNED will use this definition,
>
>
>
> #define ASSERT_STACK_ALIGNED()                                          \
>        {                                                               \
>                long double __tmp;                                      \
>                ASSERT((((uintptr_t)&__tmp) & (STACK_ALIGN - 1)) == 0); \
>        }
> #endif
>
>
> Since ASSERT_STACK_ALIGNED is used in many critical code path  in the  
> kernel, I think the 16bytes alignments must be verify important for  
> performance on AMD64 platform.
>
> But on AMD64 manual, I just found the 16bytes stack alignment for  
> 16-byte XMM registers load/store optimizations, and I don't think it's  
> the related to ASSERT_STACK_ALIGNED.
>
>
> _______________________________________________
> opensolaris-code mailing list
> opensolaris-code@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

-- 
Sherry Moore, Solaris Core Kernel       http://blogs.sun.com/sherrym
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to