1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:46:47 -07:00

runtime: mask SSE exceptions on plan9/amd64

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
This commit is contained in:
Akshat Kumar 2012-10-05 16:23:30 -04:00 committed by Russ Cox
parent 4077819f55
commit 23599ca2f6
4 changed files with 17 additions and 0 deletions

View File

@ -18,6 +18,7 @@ int32 runtime·plan9_semrelease(uint32 *addr, int32 count);
int32 runtime·notify(void (*fn)(void*, byte*));
int32 runtime·noted(int32);
void runtime·gonote(void*, byte*);
void runtime·setfpmasks(void);
/* open */
enum

View File

@ -110,3 +110,7 @@ TEXT runtime·rfork(SB),7,$0
CALL SI // fn()
CALL runtime·exit(SB)
RET
// Only used by the 64-bit runtime.
TEXT runtime·setfpmasks(SB),7,$0
RET

View File

@ -121,3 +121,12 @@ TEXT runtime·rfork(SB),7,$0
// 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

View File

@ -14,6 +14,9 @@ int32 runtime·postnote(int32, int8*);
void
runtime·minit(void)
{
// Mask all SSE floating-point exceptions
// when running on the 64-bit kernel.
runtime·setfpmasks();
}
static int32