|
From: <sv...@va...> - 2006-02-21 17:11:20
|
Author: sewardj
Date: 2006-02-21 17:11:11 +0000 (Tue, 21 Feb 2006)
New Revision: 5662
Log:
Fix CPU feature identification for ppc32/64 - add more paranoia, and=20
configure the sigill handler so that it can be used more than once.
Modified:
trunk/coregrind/m_machine.c
Modified: trunk/coregrind/m_machine.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_machine.c 2006-02-20 20:57:33 UTC (rev 5661)
+++ trunk/coregrind/m_machine.c 2006-02-21 17:11:11 UTC (rev 5662)
@@ -342,22 +342,30 @@
struct vki_sigaction saved_act, tmp_act;
=20
volatile Bool have_F, have_V, have_FX, have_GX;
+ Int r;
=20
VG_(sigemptyset)(&tmp_set);
VG_(sigaddset)(&tmp_set, VKI_SIGILL);
=20
- VG_(sigprocmask)(VKI_SIG_UNBLOCK, &tmp_set, &saved_set);
+ r =3D VG_(sigprocmask)(VKI_SIG_UNBLOCK, &tmp_set, &saved_set);
+ vg_assert(r =3D=3D 0);
=20
- VG_(sigaction)(VKI_SIGILL, NULL, &saved_act);
+ r =3D VG_(sigaction)(VKI_SIGILL, NULL, &saved_act);
+ vg_assert(r =3D=3D 0);
tmp_act =3D saved_act;
=20
+ /* NODEFER: signal handler does not return (from the kernel's point=
of
+ view), hence if it is to successfully catch a signal more than o=
nce,
+ we need the NODEFER flag. */
tmp_act.sa_flags &=3D ~VKI_SA_RESETHAND;
tmp_act.sa_flags &=3D ~VKI_SA_SIGINFO;
+ tmp_act.sa_flags |=3D VKI_SA_NODEFER;
=20
/* standard FP insns */
have_F =3D True;
tmp_act.ksa_handler =3D handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r =3D VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r =3D=3D 0);
if (__builtin_setjmp(env_sigill)) {
have_F =3D False;
} else {
@@ -367,7 +375,8 @@
/* Altivec insns */
have_V =3D True;
tmp_act.ksa_handler =3D handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r =3D VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r =3D=3D 0);
if (__builtin_setjmp(env_sigill)) {
have_V =3D False;
} else {
@@ -377,7 +386,8 @@
/* General-Purpose optional (fsqrt, fsqrts) */
have_FX =3D True;
tmp_act.ksa_handler =3D handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r =3D VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r =3D=3D 0);
if (__builtin_setjmp(env_sigill)) {
have_FX =3D False;
} else {
@@ -387,15 +397,18 @@
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
have_GX =3D True;
tmp_act.ksa_handler =3D handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r =3D VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r =3D=3D 0);
if (__builtin_setjmp(env_sigill)) {
have_GX =3D False;
} else {
__asm__ __volatile__("frsqrte 0,0");
}
=20
- VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
- VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
+ r =3D VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
+ vg_assert(r =3D=3D 0);
+ r =3D VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
+ vg_assert(r =3D=3D 0);
/*
VG_(printf)("F %d V %d FX %d GX %d\n",=20
(Int)have_F, (Int)have_V, (Int)have_FX, (Int)have_GX=
);
@@ -439,8 +452,12 @@
VG_(sigaction)(VKI_SIGILL, NULL, &saved_act);
tmp_act =3D saved_act;
=20
+ /* NODEFER: signal handler does not return (from the kernel's point=
of
+ view), hence if it is to successfully catch a signal more than o=
nce,
+ we need the NODEFER flag. */
tmp_act.sa_flags &=3D ~VKI_SA_RESETHAND;
tmp_act.sa_flags &=3D ~VKI_SA_SIGINFO;
+ tmp_act.sa_flags |=3D VKI_SA_NODEFER;
=20
/* standard FP insns */
have_F =3D True;
|