]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: make the fpu handle all exceptions on Plan 9
authorAnthony Martin <ality@pbrane.org>
Thu, 13 Mar 2014 02:41:36 +0000 (19:41 -0700)
committerAnthony Martin <ality@pbrane.org>
Thu, 13 Mar 2014 02:41:36 +0000 (19:41 -0700)
The compilers expect to not be interrupted by floating
point exceptions. On Plan 9, every process starts with
interrupts enabled for invalid operation, stack overflow,
and divide by zero exceptions.

LGTM=rsc
R=rsc, 0intro
CC=golang-codereviews
https://golang.org/cl/72750043

src/cmd/gc/lex.c

index aeeac68a155ea25b7c3e35b968ea9d3fec6e0f04..bc44145c7bedc381fed517de44933e9a1f779f53 100644 (file)
@@ -172,10 +172,6 @@ catcher(void *v, char *s)
 {
        USED(v);
 
-       if(strncmp(s, "sys: fp: invalid operation", 26) == 0) {
-               noted(NCONT);
-               return;
-       }
        if(strncmp(s, "sys: trap: fault read", 21) == 0) {
                if(nsavederrors + nerrors > 0)
                        errorexit();
@@ -211,6 +207,8 @@ main(int argc, char *argv[])
 
 #ifdef PLAN9
        notify(catcher);
+       // Tell the FPU to handle all exceptions.
+       setfcr(FPPDBL|FPRNR);
 #endif
        // Allow GOARCH=thestring or GOARCH=thestringsuffix,
        // but not other values.