diff options
Diffstat (limited to 'usr/src/lib/libc/inc/sigjmp_struct.h')
-rw-r--r-- | usr/src/lib/libc/inc/sigjmp_struct.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/usr/src/lib/libc/inc/sigjmp_struct.h b/usr/src/lib/libc/inc/sigjmp_struct.h index 988e6ca14c..7d347c2d3c 100644 --- a/usr/src/lib/libc/inc/sigjmp_struct.h +++ b/usr/src/lib/libc/inc/sigjmp_struct.h @@ -32,6 +32,7 @@ extern "C" { #include <sys/types.h> #include <sys/stack.h> +#include <sys/sysmacros.h> #include <ucontext.h> #include <setjmp.h> @@ -73,6 +74,20 @@ typedef struct { #endif /* __sparc */ +#if defined(__amd64) +/* + * The "sigjmp_buf" type is an array of long and thus can have 8-byte alignment + * on AMD64 systems. The "ucontext_t" type has a stricter 16-byte alignment + * requirement, so we must round the pointer up when casting. + * + * This is not required on other architectures: + * - SPARC does not store the ucontext_t in the sigjmp_buf + * - i386 only requires 4-byte alignment for ucontext_t + */ +#define SIGJMP2UCONTEXT(x) \ + ((ucontext_t *)P2ROUNDUP((uintptr_t)(x), sizeof (upad128_t))) +#endif + #ifdef __cplusplus } #endif |