The Go run-time assumes that all SSE floating-point exceptions
are masked so that Go programs are not broken by such invalid
operations. By default, the 64-bit version of the Plan 9 kernel
masks only some SSE floating-point exceptions. Here, we mask
them all on a per-thread basis.
R=rsc, rminnich, minux.ma
CC=golang-dev
https://golang.org/cl/
6592056
int32 runtime·notify(void (*fn)(void*, byte*));
int32 runtime·noted(int32);
void runtime·gonote(void*, byte*);
+void runtime·setfpmasks(void);
/* open */
enum
CALL SI // fn()
CALL runtime·exit(SB)
RET
+
+// Only used by the 64-bit runtime.
+TEXT runtime·setfpmasks(SB),7,$0
+ RET
// This is needed by asm_amd64.s
TEXT runtime·settls(SB),7,$0
RET
+
+TEXT runtime·setfpmasks(SB),7,$8
+ STMXCSR 0(SP)
+ MOVL 0(SP), AX
+ ANDL $~0x3F, AX
+ ORL $(0x3F<<7), AX
+ MOVL AX, 0(SP)
+ LDMXCSR 0(SP)
+ RET
void
runtime·minit(void)
{
+ // Mask all SSE floating-point exceptions
+ // when running on the 64-bit kernel.
+ runtime·setfpmasks();
}
static int32