mirror of
https://github.com/golang/go
synced 2024-11-26 14:56: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:
parent
4077819f55
commit
23599ca2f6
@ -18,6 +18,7 @@ int32 runtime·plan9_semrelease(uint32 *addr, int32 count);
|
|||||||
int32 runtime·notify(void (*fn)(void*, byte*));
|
int32 runtime·notify(void (*fn)(void*, byte*));
|
||||||
int32 runtime·noted(int32);
|
int32 runtime·noted(int32);
|
||||||
void runtime·gonote(void*, byte*);
|
void runtime·gonote(void*, byte*);
|
||||||
|
void runtime·setfpmasks(void);
|
||||||
|
|
||||||
/* open */
|
/* open */
|
||||||
enum
|
enum
|
||||||
|
@ -110,3 +110,7 @@ TEXT runtime·rfork(SB),7,$0
|
|||||||
CALL SI // fn()
|
CALL SI // fn()
|
||||||
CALL runtime·exit(SB)
|
CALL runtime·exit(SB)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
// Only used by the 64-bit runtime.
|
||||||
|
TEXT runtime·setfpmasks(SB),7,$0
|
||||||
|
RET
|
||||||
|
@ -121,3 +121,12 @@ TEXT runtime·rfork(SB),7,$0
|
|||||||
// This is needed by asm_amd64.s
|
// This is needed by asm_amd64.s
|
||||||
TEXT runtime·settls(SB),7,$0
|
TEXT runtime·settls(SB),7,$0
|
||||||
RET
|
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
|
||||||
|
@ -14,6 +14,9 @@ int32 runtime·postnote(int32, int8*);
|
|||||||
void
|
void
|
||||||
runtime·minit(void)
|
runtime·minit(void)
|
||||||
{
|
{
|
||||||
|
// Mask all SSE floating-point exceptions
|
||||||
|
// when running on the 64-bit kernel.
|
||||||
|
runtime·setfpmasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
|
Loading…
Reference in New Issue
Block a user