commit e353c388b738920a4b17c7630c3ddc597e2c09d5
parent 4135fa2ab106a92a7c46b4ea0b11659c93b644dc
Author: Russ Cox <rsc@swtch.com>
Date: Sun, 29 Jun 2008 21:32:36 -0400
libvx32: use si_addr, not cr2, in case of segmentation fault
Diffstat:
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/libvx32/darwin.c b/src/libvx32/darwin.c
@@ -97,7 +97,6 @@ int vx32_sighandler(int signo, siginfo_t *si, void *v)
vxemu *emu;
ucontext_t *uc;
mcontext_t ctx;
- uint32_t cr2;
// In Darwin, 'mcontext_t' is actually a pointer...
uc = v;
@@ -256,7 +255,7 @@ int vx32_sighandler(int signo, siginfo_t *si, void *v)
if (emu->trapenv == NULL)
return 0;
emu->cpu.traperr = ctx->es.err;
- emu->cpu.trapva = ctx->es.faultvaddr;
+ emu->cpu.trapva = (uint32_t)si->si_addr;
ctx->ss = *emu->trapenv;
return 1;
}
diff --git a/src/libvx32/freebsd.c b/src/libvx32/freebsd.c
@@ -324,10 +324,6 @@ int vx32_sighandler(int signo, siginfo_t *si, void *v)
return 0;
emu->cpu.traperr = mc->mc_err;
emu->cpu.trapva = cr2;
-
- emu->cpu.traperr = mc->mc_err;
- emu->cpu.trapva = cr2;
-
memmove(&mc->mc_gs, &emu->trapenv->mc_gs, 19*4);
return 1;
}