diff options
author | Vitaliy Gusev <gusev.vitaliy@gmail.com> | 2020-07-20 13:58:21 -0700 |
---|---|---|
committer | Joshua M. Clulow <josh@sysmgr.org> | 2020-07-21 10:44:14 -0700 |
commit | 6a8fa7ea16d9870b21c82af67a2053cb47ed1fb4 (patch) | |
tree | 96408da85939e462d75f0600ddc5e88db0d33c21 /usr/src/lib/libc/inc/sigjmp_struct.h | |
parent | 9b65801e8bd9a9007efed89ac479e99b9dab83d1 (diff) | |
download | illumos-gate-6a8fa7ea16d9870b21c82af67a2053cb47ed1fb4.tar.gz |
12747 sigsetjmp should allow for 8 byte aligned buffer on amd64
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Approved by: Joshua M. Clulow <josh@sysmgr.org>
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 |