--- old/usr/src/lib/libm/common/m9x/__fex_hdlr.c	2019-06-06 20:40:04.347409979 +0000
+++ new/usr/src/lib/libm/common/m9x/__fex_hdlr.c	2019-06-06 20:40:04.368085549 +0000
@@ -22,6 +22,7 @@
 /*
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  */
+
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -47,16 +48,18 @@
 #include <sys/procfs.h>
 #endif
 
-/* 2.x signal.h doesn't declare sigemptyset or sigismember
-   if they're #defined (see sys/signal.h) */
+/*
+ * 2.x signal.h doesn't declare sigemptyset or sigismember
+ * if they're #define'd (see sys/signal.h)
+ */
 extern int sigemptyset(sigset_t *);
 extern int sigismember(const sigset_t *, int);
 
 /* external globals */
-void (*__mt_fex_sync)() = NULL; /* for synchronization with libmtsk */
+void (*__mt_fex_sync)() = NULL;		/* for synchronization with libmtsk */
 #pragma weak __mt_fex_sync
 
-void (*__libm_mt_fex_sync)() = NULL; /* new, improved version of above */
+void (*__libm_mt_fex_sync)() = NULL;	/* new, improved version of above */
 #pragma weak __libm_mt_fex_sync
 
 /* private variables */
@@ -64,63 +67,61 @@
 static int handlers_initialized = 0;
 static thread_key_t handlers_key;
 static mutex_t handlers_key_lock = DEFAULTMUTEX;
-
 static struct sigaction oact = { 0, SIG_DFL };
 static mutex_t hdlr_lock = DEFAULTMUTEX;
 static int hdlr_installed = 0;
 
 /* private const data */
 static const int te_bit[FEX_NUM_EXC] = {
-	1 << fp_trap_inexact,
-	1 << fp_trap_division,
-	1 << fp_trap_underflow,
-	1 << fp_trap_overflow,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid,
-	1 << fp_trap_invalid
+	1 << fp_trap_inexact, 1 << fp_trap_division, 1 << fp_trap_underflow,
+	1 << fp_trap_overflow, 1 << fp_trap_invalid, 1 << fp_trap_invalid,
+	1 << fp_trap_invalid, 1 << fp_trap_invalid, 1 << fp_trap_invalid,
+	1 << fp_trap_invalid, 1 << fp_trap_invalid, 1 << fp_trap_invalid
 };
 
 /*
-*  Return the traps to be enabled given the current handling modes
-*  and flags
-*/
+ *  Return the traps to be enabled given the current handling modes
+ *  and flags
+ */
 static int
 __fex_te_needed(struct fex_handler_data *thr_handlers, unsigned long fsr)
 {
-	int		i, ex, te;
+	int i, ex, te;
 
 	/* set traps for handling modes */
 	te = 0;
+
 	for (i = 0; i < FEX_NUM_EXC; i++)
 		if (thr_handlers[i].__mode != FEX_NONSTOP)
 			te |= te_bit[i];
 
 	/* add traps for retrospective diagnostics */
+
 	if (fex_get_log()) {
 		ex = (int)__fenv_get_ex(fsr);
+
 		if (!(ex & FE_INEXACT))
 			te |= (1 << fp_trap_inexact);
+
 		if (!(ex & FE_UNDERFLOW))
 			te |= (1 << fp_trap_underflow);
+
 		if (!(ex & FE_OVERFLOW))
 			te |= (1 << fp_trap_overflow);
+
 		if (!(ex & FE_DIVBYZERO))
 			te |= (1 << fp_trap_division);
+
 		if (!(ex & FE_INVALID))
 			te |= (1 << fp_trap_invalid);
 	}
 
-	return te;
+	return (te);
 }
 
 /*
-*  The following function synchronizes with libmtsk (SPARC only, for now)
-*/
+ *  The following function synchronizes with libmtsk (SPARC only, for now)
+ */
 static void
 __fex_sync_with_libmtsk(int begin, int master)
 {
@@ -130,38 +131,38 @@
 
 	if (begin) {
 		mutex_lock(&env_lock);
+
 		if (master) {
 			(void) fegetenv(&master_env);
 			env_initialized = 1;
-		}
-		else if (env_initialized)
+		} else if (env_initialized) {
 			(void) fesetenv(&master_env);
+		}
+
 		mutex_unlock(&env_lock);
-	}
-	else if (master && fex_get_log())
+	} else if (master && fex_get_log()) {
 		__fex_update_te();
+	}
 }
 
 /*
-*  The following function may be used for synchronization with any
-*  internal project that manages multiple threads
-*/
+ *  The following function may be used for synchronization with any
+ *  internal project that manages multiple threads
+ */
 enum __libm_mt_fex_sync_actions {
-	__libm_mt_fex_start_master = 0,
-	__libm_mt_fex_start_slave,
-	__libm_mt_fex_finish_master,
-	__libm_mt_fex_finish_slave
+	__libm_mt_fex_start_master = 0, __libm_mt_fex_start_slave,
+	__libm_mt_fex_finish_master, __libm_mt_fex_finish_slave
 };
 
 struct __libm_mt_fex_sync_data {
-	fenv_t	master_env;
-	int		initialized;
-	mutex_t	lock;
+	fenv_t master_env;
+	int initialized;
+	mutex_t lock;
 };
 
 static void
-__fex_sync_with_threads(enum __libm_mt_fex_sync_actions action,
-	struct __libm_mt_fex_sync_data *thr_env)
+__fex_sync_with_threads(enum __libm_mt_fex_sync_actions action, struct
+    __libm_mt_fex_sync_data *thr_env)
 {
 	switch (action) {
 	case __libm_mt_fex_start_master:
@@ -173,8 +174,10 @@
 
 	case __libm_mt_fex_start_slave:
 		mutex_lock(&thr_env->lock);
+
 		if (thr_env->initialized)
 			(void) fesetenv(&thr_env->master_env);
+
 		mutex_unlock(&thr_env->lock);
 		break;
 
@@ -189,9 +192,13 @@
 
 	case __libm_mt_fex_finish_slave:
 #if defined(__x86)
-		/* clear traps, making all accrued flags visible in status word */
+		/*
+		 * clear traps, making all accrued flags visible in status
+		 * word
+		 */
 		{
-			unsigned long   fsr;
+			unsigned long fsr;
+
 			__fenv_getfsr(&fsr);
 			__fenv_set_te(fsr, 0);
 			__fenv_setfsr(&fsr);
@@ -202,37 +209,38 @@
 }
 
 #if defined(__sparc)
-
 /*
-*  Code for setting or clearing interval mode on US-III and above.
-*  This is embedded as data so we don't have to mark the library
-*  as a v8plusb/v9b object.  (I could have just used one entry and
-*  modified the second word to set the bits I want, but that would
-*  have required another mutex.)
-*/
+ *  Code for setting or clearing interval mode on US-III and above.
+ *  This is embedded as data so we don't have to mark the library
+ *  as a v8plusb/v9b object.  (I could have just used one entry and
+ *  modified the second word to set the bits I want, but that would
+ *  have required another mutex.)
+ */
 static const unsigned int siam[][2] = {
-	{ 0x81c3e008, 0x81b01020 }, /* retl, siam 0 */
-	{ 0x81c3e008, 0x81b01024 }, /* retl, siam 4 */
-	{ 0x81c3e008, 0x81b01025 }, /* retl, siam 5 */
-	{ 0x81c3e008, 0x81b01026 }, /* retl, siam 6 */
-	{ 0x81c3e008, 0x81b01027 }  /* retl, siam 7 */
+	{ 0x81c3e008, 0x81b01020 },	/* retl, siam 0 */
+	{ 0x81c3e008, 0x81b01024 },	/* retl, siam 4 */
+	{ 0x81c3e008, 0x81b01025 },	/* retl, siam 5 */
+	{ 0x81c3e008, 0x81b01026 },	/* retl, siam 6 */
+	{ 0x81c3e008, 0x81b01027 }	/* retl, siam 7 */
 };
 
 /*
-*  If a handling mode is in effect, apply it; otherwise invoke the
-*  saved handler
-*/
+ *  If a handling mode is in effect, apply it; otherwise invoke the
+ *  saved handler
+ */
 static void
 __fex_hdlr(int sig, siginfo_t *sip, ucontext_t *uap)
 {
-	struct fex_handler_data	*thr_handlers;
-	struct sigaction	act;
-	void			(*handler)(), (*siamp)();
-	int			mode, i;
-	enum fex_exception	e;
-	fex_info_t		info;
-	unsigned long		fsr, tmpfsr, addr;
-	unsigned int		gsr;
+	struct fex_handler_data *thr_handlers;
+	struct sigaction act;
+
+	void (*handler)(), (*siamp)();
+
+	int mode, i;
+	enum fex_exception e;
+	fex_info_t info;
+	unsigned long fsr, tmpfsr, addr;
+	unsigned int gsr;
 
 	/* determine which exception occurred */
 	switch (sip->si_code) {
@@ -249,8 +257,10 @@
 		e = fex_inexact;
 		break;
 	case FPE_FLTINV:
+
 		if ((int)(e = __fex_get_invalid_type(sip, uap)) < 0)
 			goto not_ieee;
+
 		break;
 	default:
 		/* not an IEEE exception */
@@ -261,6 +271,7 @@
 	mode = FEX_NOHANDLER;
 	handler = oact.sa_handler; /* for log; just looking, no need to lock */
 	thr_handlers = __fex_get_thr_handlers();
+
 	if (thr_handlers && thr_handlers[(int)e].__mode != FEX_NOHANDLER) {
 		mode = thr_handlers[(int)e].__mode;
 		handler = thr_handlers[(int)e].__handler;
@@ -271,11 +282,11 @@
 	__fex_mklog(uap, (char *)sip->si_addr, i, e, mode, (void *)handler);
 
 	/* handle the exception based on the mode */
-	if (mode == FEX_NOHANDLER)
+	if (mode == FEX_NOHANDLER) {
 		goto not_ieee;
-	else if (mode == FEX_ABORT)
+	} else if (mode == FEX_ABORT) {
 		abort();
-	else if (mode == FEX_SIGNAL) {
+	} else if (mode == FEX_SIGNAL) {
 		handler(sig, sip, uap);
 		return;
 	}
@@ -285,23 +296,29 @@
 	__fenv_set_te(fsr, 0);
 	__fenv_set_ex(fsr, 0);
 
-	/* if interval mode was set, clear it, then substitute the
-	   interval rounding direction and clear ns mode in the fsr */
+	/*
+	 * if interval mode was set, clear it, then substitute the interval
+	 * rounding direction and clear ns mode in the fsr
+	 */
 #ifdef __sparcv9
 	gsr = uap->uc_mcontext.asrs[3];
 #else
 	gsr = 0;
+
 	if (uap->uc_mcontext.xrs.xrs_id == XRS_ID)
-		gsr = (*(unsigned long long*)((prxregset_t*)uap->uc_mcontext.
-		    xrs.xrs_ptr)->pr_un.pr_v8p.pr_filler);
+		gsr = (*(unsigned long long *)
+		    ((prxregset_t *)uap->uc_mcontext.xrs.xrs_ptr)->pr_un.
+		    pr_v8p.pr_filler);
 #endif
 	gsr = (gsr >> 25) & 7;
+
 	if (gsr & 4) {
-		siamp = (void (*)()) siam[0];
+		siamp = (void (*)())siam[0];
 		siamp();
 		tmpfsr = fsr;
 		fsr = (fsr & ~0xc0400000ul) | ((gsr & 3) << 30);
 	}
+
 	__fenv_setfsr(&fsr);
 
 	/* decode the operation */
@@ -311,18 +328,21 @@
 	if (mode == FEX_CUSTOM) {
 		/* if we got here from feraiseexcept, pass dummy info */
 		addr = (unsigned long)sip->si_addr;
-		if (addr >= (unsigned long)feraiseexcept &&
-		    addr < (unsigned long)fetestexcept) {
+
+		if (addr >= (unsigned long)feraiseexcept && addr < (unsigned
+		    long)fetestexcept) {
 			info.op = fex_other;
 			info.op1.type = info.op2.type = info.res.type =
 			    fex_nodata;
 		}
 
-		/* restore interval mode if it was set, and put the original
-		   rounding direction and ns mode back in the fsr */
+		/*
+		 * restore interval mode if it was set, and put the original
+		 * rounding direction and ns mode back in the fsr
+		 */
 		if (gsr & 4) {
 			__fenv_setfsr(&tmpfsr);
-			siamp = (void (*)()) siam[1 + (gsr & 3)];
+			siamp = (void (*)())siam[1 + (gsr & 3)];
 			siamp();
 		}
 
@@ -330,9 +350,10 @@
 
 		/* restore modes in case the user's handler changed them */
 		if (gsr & 4) {
-			siamp = (void (*)()) siam[0];
+			siamp = (void (*)())siam[0];
 			siamp();
 		}
+
 		__fenv_setfsr(&fsr);
 	}
 
@@ -352,6 +373,7 @@
 	mutex_lock(&hdlr_lock);
 	act = oact;
 	mutex_unlock(&hdlr_lock);
+
 	switch ((unsigned long)act.sa_handler) {
 	case (unsigned long)SIG_DFL:
 		/* simulate trap with no handler installed */
@@ -366,41 +388,43 @@
 		act.sa_handler(sig, sip, uap);
 	}
 }
-
 #elif defined(__x86)
-
 #if defined(__amd64)
-#define test_sse_hw	1
+#define	test_sse_hw		1
 #else
 extern int _sse_hw;
-#define test_sse_hw	_sse_hw
+
+#define	test_sse_hw		_sse_hw
 #endif
 
 #if !defined(REG_PC)
-#define REG_PC	EIP
+#define	REG_PC			EIP
 #endif
 
 /*
-*  If a handling mode is in effect, apply it; otherwise invoke the
-*  saved handler
-*/
+ *  If a handling mode is in effect, apply it; otherwise invoke the
+ *  saved handler
+ */
 static void
 __fex_hdlr(int sig, siginfo_t *sip, ucontext_t *uap)
 {
-	struct fex_handler_data	*thr_handlers;
-	struct sigaction	act;
-	void			(*handler)() = NULL, (*simd_handler[4])();
-	int			mode, simd_mode[4], i, len, accrued, *ap;
-	unsigned int		cwsw, oldcwsw, mxcsr, oldmxcsr;
-	enum fex_exception	e, simd_e[4];
-	fex_info_t		info, simd_info[4];
-	unsigned long		addr;
-	siginfo_t		osip = *sip;
-	sseinst_t		inst;
+	struct fex_handler_data *thr_handlers;
+	struct sigaction act;
+
+	void (*handler)() = NULL, (*simd_handler[4])();
+
+	int mode, simd_mode[4], i, len, accrued, *ap;
+	unsigned int cwsw, oldcwsw, mxcsr, oldmxcsr;
+	enum fex_exception e, simd_e[4];
+	fex_info_t info, simd_info[4];
+	unsigned long addr;
+	siginfo_t osip = *sip;
+	sseinst_t inst;
 
 	/* check for an exception caused by an SSE instruction */
 	if (!(uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.status & 0x80)) {
 		len = __fex_parse_sse(uap, &inst);
+
 		if (len == 0)
 			goto not_ieee;
 
@@ -417,11 +441,13 @@
 
 			thr_handlers = __fex_get_thr_handlers();
 			addr = (unsigned long)uap->uc_mcontext.gregs[REG_PC];
-			accrued = uap->uc_mcontext.fpregs.fp_reg_set.
-			    fpchip_state.mxcsr;
+			accrued =
+			    uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+			    mxcsr;
 
 			e = (enum fex_exception)-1;
 			mode = FEX_NONSTOP;
+
 			for (i = 0; i < 4; i++) {
 				if ((int)simd_e[i] < 0)
 					continue;
@@ -429,6 +455,7 @@
 				e = simd_e[i];
 				simd_mode[i] = FEX_NOHANDLER;
 				simd_handler[i] = oact.sa_handler;
+
 				if (thr_handlers &&
 				    thr_handlers[(int)e].__mode !=
 				    FEX_NOHANDLER) {
@@ -437,30 +464,39 @@
 					simd_handler[i] =
 					    thr_handlers[(int)e].__handler;
 				}
+
 				accrued &= ~te_bit[(int)e];
+
 				switch (simd_mode[i]) {
 				case FEX_ABORT:
 					mode = FEX_ABORT;
 					break;
 				case FEX_SIGNAL:
+
 					if (mode != FEX_ABORT)
 						mode = FEX_SIGNAL;
+
 					handler = simd_handler[i];
 					break;
 				case FEX_NOHANDLER:
+
 					if (mode != FEX_ABORT && mode !=
 					    FEX_SIGNAL)
 						mode = FEX_NOHANDLER;
+
 					break;
 				}
 			}
+
 			if (e == (enum fex_exception)-1) {
 				__fenv_setcwsw(&oldcwsw);
 				__fenv_setmxcsr(&oldmxcsr);
 				goto not_ieee;
 			}
-			accrued |= uap->uc_mcontext.fpregs.fp_reg_set.
-			    fpchip_state.status;
+
+			accrued |=
+			    uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+			    status;
 			ap = __fex_accrued();
 			accrued |= *ap;
 			accrued &= 0x3d;
@@ -488,6 +524,7 @@
 			}
 
 			*ap = 0;
+
 			for (i = 0; i < 4; i++) {
 				if ((int)simd_e[i] < 0)
 					continue;
@@ -501,6 +538,7 @@
 			}
 
 			__fex_st_simd_result(uap, &inst, simd_e, simd_info);
+
 			for (i = 0; i < 4; i++) {
 				if ((int)simd_e[i] < 0)
 					continue;
@@ -511,19 +549,20 @@
 			if ((int)inst.op & INTREG) {
 				/* set MMX mode */
 #if defined(__amd64)
-				uap->uc_mcontext.fpregs.fp_reg_set.
-				    fpchip_state.sw &= ~0x3800;
-				uap->uc_mcontext.fpregs.fp_reg_set.
-				    fpchip_state.fctw = 0;
+				uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+				    sw &= ~0x3800;
+				uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+				    fctw = 0;
 #else
-				uap->uc_mcontext.fpregs.fp_reg_set.
-				    fpchip_state.state[1] &= ~0x3800;
-				uap->uc_mcontext.fpregs.fp_reg_set.
-				    fpchip_state.state[2] = 0;
+				uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+				    state[1] &= ~0x3800;
+				uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+				    state[2] = 0;
 #endif
 			}
 		} else {
 			e = __fex_get_sse_op(uap, &inst, &info);
+
 			if ((int)e < 0) {
 				__fenv_setcwsw(&oldcwsw);
 				__fenv_setmxcsr(&oldmxcsr);
@@ -533,6 +572,7 @@
 			mode = FEX_NOHANDLER;
 			handler = oact.sa_handler;
 			thr_handlers = __fex_get_thr_handlers();
+
 			if (thr_handlers && thr_handlers[(int)e].__mode !=
 			    FEX_NOHANDLER) {
 				mode = thr_handlers[(int)e].__mode;
@@ -540,10 +580,12 @@
 			}
 
 			addr = (unsigned long)uap->uc_mcontext.gregs[REG_PC];
-			accrued = uap->uc_mcontext.fpregs.fp_reg_set.
-			    fpchip_state.mxcsr & ~te_bit[(int)e];
-			accrued |= uap->uc_mcontext.fpregs.fp_reg_set.
-			    fpchip_state.status;
+			accrued =
+			    uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+			    mxcsr & ~te_bit[(int)e];
+			accrued |=
+			    uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
+			    status;
 			ap = __fex_accrued();
 			accrued |= *ap;
 			accrued &= 0x3d;
@@ -563,12 +605,14 @@
 				return;
 			} else if (mode == FEX_CUSTOM) {
 				*ap = 0;
+
 				if (addr >= (unsigned long)feraiseexcept &&
 				    addr < (unsigned long)fetestexcept) {
 					info.op = fex_other;
 					info.op1.type = info.op2.type =
 					    info.res.type = fex_nodata;
 				}
+
 				handler(1 << (int)e, &info);
 				__fenv_setcwsw(&cwsw);
 				__fenv_setmxcsr(&mxcsr);
@@ -598,6 +642,7 @@
 
 	/* determine which exception occurred */
 	__fex_get_x86_exc(sip, uap);
+
 	switch (sip->si_code) {
 	case FPE_FLTDIV:
 		e = fex_division;
@@ -612,8 +657,10 @@
 		e = fex_inexact;
 		break;
 	case FPE_FLTINV:
+
 		if ((int)(e = __fex_get_invalid_type(sip, uap)) < 0)
 			goto not_ieee;
+
 		break;
 	default:
 		/* not an IEEE exception */
@@ -624,6 +671,7 @@
 	mode = FEX_NOHANDLER;
 	handler = oact.sa_handler; /* for log; just looking, no need to lock */
 	thr_handlers = __fex_get_thr_handlers();
+
 	if (thr_handlers && thr_handlers[(int)e].__mode != FEX_NOHANDLER) {
 		mode = thr_handlers[(int)e].__mode;
 		handler = thr_handlers[(int)e].__handler;
@@ -631,28 +679,30 @@
 
 	/* make an entry in the log of retro. diag. if need be */
 #if defined(__amd64)
-	addr = (unsigned long)uap->uc_mcontext.fpregs.fp_reg_set.
-	    fpchip_state.rip;
+	addr = (unsigned
+	    long)uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.rip;
 #else
-	addr = (unsigned long)uap->uc_mcontext.fpregs.fp_reg_set.
-	    fpchip_state.state[3];
+	addr = (unsigned
+	    long)uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[3];
 #endif
-	accrued = uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.status & 
+	accrued = uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.status &
 	    ~te_bit[(int)e];
+
 	if (test_sse_hw)
-		accrued |= uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.
-		    mxcsr;
+		accrued |=
+		    uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr;
+
 	ap = __fex_accrued();
 	accrued |= *ap;
 	accrued &= 0x3d;
 	__fex_mklog(uap, (char *)addr, accrued, e, mode, (void *)handler);
 
 	/* handle the exception based on the mode */
-	if (mode == FEX_NOHANDLER)
+	if (mode == FEX_NOHANDLER) {
 		goto not_ieee;
-	else if (mode == FEX_ABORT)
+	} else if (mode == FEX_ABORT) {
 		abort();
-	else if (mode == FEX_SIGNAL) {
+	} else if (mode == FEX_SIGNAL) {
 		handler(sig, &osip, uap);
 		return;
 	}
@@ -661,11 +711,13 @@
 	__fenv_getcwsw(&cwsw);
 	cwsw = (cwsw & ~0x3f) | 0x003f0000;
 	__fenv_setcwsw(&cwsw);
+
 	if (test_sse_hw) {
 		__fenv_getmxcsr(&mxcsr);
 		mxcsr = (mxcsr & ~0x3f) | 0x1f80;
 		__fenv_setmxcsr(&mxcsr);
 	}
+
 	*ap = 0;
 
 	/* decode the operation */
@@ -674,8 +726,8 @@
 	/* if a custom mode handler is installed, invoke it */
 	if (mode == FEX_CUSTOM) {
 		/* if we got here from feraiseexcept, pass dummy info */
-		if (addr >= (unsigned long)feraiseexcept &&
-		    addr < (unsigned long)fetestexcept) {
+		if (addr >= (unsigned long)feraiseexcept && addr < (unsigned
+		    long)fetestexcept) {
 			info.op = fex_other;
 			info.op1.type = info.op2.type = info.res.type =
 			    fex_nodata;
@@ -685,6 +737,7 @@
 
 		/* restore modes in case the user's handler changed them */
 		__fenv_setcwsw(&cwsw);
+
 		if (test_sse_hw)
 			__fenv_setmxcsr(&mxcsr);
 	}
@@ -704,18 +757,20 @@
 	uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.cw &= ~i;
 #else
 	uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[1] &= ~0x3d;
-	uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[1] |=
-	    (accrued & ~i);
+	uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[1] |= (accrued &
+	    ~i);
 	uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[0] |= 0x3d;
 	uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[0] &= ~i;
 #endif
+
 	if (test_sse_hw) {
 		uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr &= ~0x3d;
 		uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr |=
 		    0x1e80 | (accrued & ~i);
-		uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr &=
-		    ~(i << 7);
+		uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr &= ~(i <<
+		    7);
 	}
+
 	return;
 
 not_ieee:
@@ -723,6 +778,7 @@
 	mutex_lock(&hdlr_lock);
 	act = oact;
 	mutex_unlock(&hdlr_lock);
+
 	switch ((unsigned long)act.sa_handler) {
 	case (unsigned long)SIG_DFL:
 		/* simulate trap with no handler installed */
@@ -737,75 +793,86 @@
 		act.sa_handler(sig, &osip, uap);
 	}
 }
-
 #else
 #error Unknown architecture
 #endif
 
 /*
-*  Return a pointer to the thread-specific handler data, and
-*  initialize it if necessary
-*/
+ *  Return a pointer to the thread-specific handler data, and
+ *  initialize it if necessary
+ */
 struct fex_handler_data *
 __fex_get_thr_handlers()
 {
-	struct fex_handler_data	*ptr;
-	unsigned long			fsr;
-	int						i, te;
+	struct fex_handler_data *ptr;
+	unsigned long fsr;
+	int i, te;
 
 	if (thr_main()) {
 		if (!handlers_initialized) {
-			/* initialize to FEX_NOHANDLER if trap is enabled,
-			   FEX_NONSTOP if trap is disabled */
+			/*
+			 * initialize to FEX_NOHANDLER if trap is enabled,
+			 * FEX_NONSTOP if trap is disabled
+			 */
 			__fenv_getfsr(&fsr);
 			te = (int)__fenv_get_te(fsr);
+
 			for (i = 0; i < FEX_NUM_EXC; i++)
-				main_handlers[i].__mode =
-					((te & te_bit[i])? FEX_NOHANDLER : FEX_NONSTOP);
+				main_handlers[i].__mode = ((te & te_bit[i]) ?
+				    FEX_NOHANDLER : FEX_NONSTOP);
+
 			handlers_initialized = 1;
 		}
-		return main_handlers;
-	}
-	else {
+
+		return (main_handlers);
+	} else {
 		ptr = NULL;
 		mutex_lock(&handlers_key_lock);
+
 		if (thr_getspecific(handlers_key, (void **)&ptr) != 0 &&
-			thr_keycreate(&handlers_key, free) != 0) {
+		    thr_keycreate(&handlers_key, free) != 0) {
 			mutex_unlock(&handlers_key_lock);
-			return NULL;
+			return (NULL);
 		}
+
 		mutex_unlock(&handlers_key_lock);
+
 		if (!ptr) {
-			if ((ptr = (struct fex_handler_data *)
-				malloc(sizeof(fex_handler_t))) == NULL) {
-				return NULL;
-			}
+			if ((ptr = malloc(sizeof (fex_handler_t))) == NULL)
+				return (NULL);
+
 			if (thr_setspecific(handlers_key, (void *)ptr) != 0) {
-				(void)free(ptr);
-				return NULL;
+				(void) free(ptr);
+				return (NULL);
 			}
-			/* initialize to FEX_NOHANDLER if trap is enabled,
-			   FEX_NONSTOP if trap is disabled */
+
+			/*
+			 * initialize to FEX_NOHANDLER if trap is enabled,
+			 * FEX_NONSTOP if trap is disabled
+			 */
 			__fenv_getfsr(&fsr);
 			te = (int)__fenv_get_te(fsr);
+
 			for (i = 0; i < FEX_NUM_EXC; i++)
-				ptr[i].__mode = ((te & te_bit[i])? FEX_NOHANDLER : FEX_NONSTOP);
+				ptr[i].__mode = ((te & te_bit[i]) ?
+				    FEX_NOHANDLER : FEX_NONSTOP);
 		}
-		return ptr;
+
+		return (ptr);
 	}
 }
 
 /*
-*  Update the trap enable bits according to the selected modes
-*/
+ *  Update the trap enable bits according to the selected modes
+ */
 void
 __fex_update_te()
 {
-	struct fex_handler_data	*thr_handlers;
-	struct sigaction		act, tmpact;
-	sigset_t				blocked;
-	unsigned long			fsr;
-	int						te;
+	struct fex_handler_data *thr_handlers;
+	struct sigaction act, tmpact;
+	sigset_t blocked;
+	unsigned long fsr;
+	int te;
 
 	/* determine which traps are needed */
 	thr_handlers = __fex_get_thr_handlers();
@@ -818,18 +885,19 @@
 		sigemptyset(&act.sa_mask);
 		act.sa_flags = SA_SIGINFO;
 		sigaction(SIGFPE, &act, &tmpact);
-		if (tmpact.sa_handler != __fex_hdlr)
-		{
+
+		if (tmpact.sa_handler != __fex_hdlr) {
 			mutex_lock(&hdlr_lock);
 			oact = tmpact;
 			mutex_unlock(&hdlr_lock);
 		}
+
 		hdlr_installed = 1;
 	}
 
 	/* set the new trap enable bits (only if SIGFPE is not blocked) */
-	if (sigprocmask(0, NULL, &blocked) == 0 &&
-		!sigismember(&blocked, SIGFPE)) {
+	if (sigprocmask(0, NULL, &blocked) == 0 && !sigismember(&blocked,
+	    SIGFPE)) {
 		__fenv_set_te(fsr, te);
 		__fenv_setfsr(&fsr);
 	}
