summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pkg/runtime/darwin/386/signal.c4
-rw-r--r--src/pkg/runtime/darwin/amd64/signal.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/pkg/runtime/darwin/386/signal.c b/src/pkg/runtime/darwin/386/signal.c
index 7c0c381d3..b4af42bb4 100644
--- a/src/pkg/runtime/darwin/386/signal.c
+++ b/src/pkg/runtime/darwin/386/signal.c
@@ -54,7 +54,9 @@ sighandler(int32 sig, Siginfo *info, void *context)
// Not necessary in Snow Leopard (si_code will be != 0).
if(sig == SIGFPE && info->si_code == 0) {
pc = (byte*)r->eip;
- if(pc[0] == 0xF7)
+ if(pc[0] == 0x66) // 16-bit instruction prefix
+ pc++;
+ if(pc[0] == 0xF6 || pc[0] == 0xF7)
info->si_code = FPE_INTDIV;
}
diff --git a/src/pkg/runtime/darwin/amd64/signal.c b/src/pkg/runtime/darwin/amd64/signal.c
index 8145e8d8f..b3fa8404f 100644
--- a/src/pkg/runtime/darwin/amd64/signal.c
+++ b/src/pkg/runtime/darwin/amd64/signal.c
@@ -63,7 +63,9 @@ sighandler(int32 sig, Siginfo *info, void *context)
pc = (byte*)r->rip;
if((pc[0]&0xF0) == 0x40) // 64-bit REX prefix
pc++;
- if(pc[0] == 0xF7)
+ else if(pc[0] == 0x66) // 16-bit instruction prefix
+ pc++;
+ if(pc[0] == 0xF6 || pc[0] == 0xF7)
info->si_code = FPE_INTDIV;
}