#include <private/bionic_asm.h>
-// These are only the callee-saved registers. Code calling setjmp
-// will expect the rest to be clobbered anyway.
+
+// The internal structure of a jmp_buf is totally private.
+// Current layout (changes from release to release):
+//
+// word name description
+// 0 rbx registers
+// 1 rbp
+// 2 r12
+// 3 r13
+// 4 r14
+// 5 r15
+// 6 rsp
+// 7 pc
+// 8 sigflag/cookie setjmp cookie in top 31 bits, signal mask flag in low bit
+// 9 sigmask signal mask (includes rt signals as well)
+// 10 reserved
#define _JB_RBX 0
#define _JB_RBP 1
#define _JB_PC 7
#define _JB_SIGFLAG 8
#define _JB_SIGMASK 9
-#define _JB_SIGMASK_RT 10 // sigprocmask will write here too.
#define MANGLE_REGISTERS 1
.macro m_mangle_registers reg
<< sent.si_code << ", received " << received.si_code
<< error_msg;
}
+
+#if defined(__arm__) || defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
+TEST(signal, sigset_size) {
+ // The setjmp implementations for ARM, AArch64, x86, and x86_64 assume that sigset_t can fit in a
+ // long. This is true because ARM and x86 have broken rt signal support, and AArch64 and x86_64
+ // both have a SIGRTMAX defined as 64.
+ static_assert(sizeof(sigset_t) <= sizeof(long), "sigset_t doesn't fit in a long");
+}
+
+#endif
#endif