- infostyle = UC_FLAVOR;
- }
- if(is_64signalregset() && (infostyle == UC_FLAVOR)) {
- dualcontext = 1;
- infostyle = UC_DUAL;
- }
- if (p->p_sigacts->ps_64regset & sigmask(sig)) {
- dualcontext = 0;
- ctx32 = 0;
- infostyle = UC_FLAVOR64;
- }
- /* treat 64 bit processes as having used 64 bit registers */
- if ((IS_64BIT_PROCESS(p) || is_64signalregset()) &&
- (infostyle == UC_TRAD)) {
- ctx32=0;
- infostyle = UC_TRAD64;
- }
- if (IS_64BIT_PROCESS(p)) {
- ctx32=0;
- dualcontext = 0;
+ /*
+ * If SA_SIGINFO is set, then we must provide the user
+ * process both a siginfo_t and a context argument. We call
+ * this "FLAVORED", as opposed to "TRADITIONAL", which doesn't
+ * expect a context. "DUAL" is a type of "FLAVORED".
+ */
+ if (is_64signalregset()) {
+ /*
+ * If this is a 64 bit CPU, we must include a 64 bit
+ * context in the data we pass to user space; we may
+ * or may not also include a 32 bit context at the
+ * same time, for non-leaf functions.
+ *
+ * The user may also explicitly choose to not receive
+ * a 32 bit context, at their option; we only allow
+ * this to happen on 64 bit processors, for obvious
+ * reasons.
+ */
+ if (IS_64BIT_PROCESS(p) ||
+ (p->p_sigacts->ps_64regset & sigmask(sig))) {
+ /*
+ * For a 64 bit process, there is no 32 bit
+ * context.
+ */
+ ctx32 = 0;
+ infostyle = UC_FLAVOR64;
+ } else {
+ /*
+ * For a 32 bit process on a 64 bit CPU, we
+ * may have 64 bit leaf functions, so we need
+ * both contexts.
+ */
+ dualcontext = 1;
+ infostyle = UC_DUAL;
+ }
+ } else {
+ /*
+ * If this is a 32 bit CPU, then we only have a 32 bit
+ * context to contend with.
+ */
+ infostyle = UC_FLAVOR;
+ }
+ } else {
+ /*
+ * If SA_SIGINFO is not set, then we have a traditional style
+ * call which does not need additional context passed. The
+ * default is 32 bit traditional.
+ *
+ * XXX The second check is redundant on PPC32; keep it anyway.
+ */
+ if (is_64signalregset() || IS_64BIT_PROCESS(p)) {
+ /*
+ * However, if this is a 64 bit CPU, we need to change
+ * this to 64 bit traditional, and drop the 32 bit
+ * context.
+ */
+ ctx32 = 0;
+ infostyle = UC_TRAD64;
+ }