|
From: <sv...@va...> - 2009-03-22 13:28:50
|
Author: sewardj
Date: 2009-03-22 13:28:44 +0000 (Sun, 22 Mar 2009)
New Revision: 9490
Log:
Fix compilation on VGP_ppc32_linux and VGP_ppc64_linux following
changes over the past couple of weeks.
Modified:
branches/DARWIN/coregrind/m_machine.c
branches/DARWIN/coregrind/m_syswrap/priv_types_n_macros.h
branches/DARWIN/coregrind/m_syswrap/syswrap-main.c
branches/DARWIN/coregrind/m_syswrap/syswrap-ppc32-linux.c
branches/DARWIN/coregrind/m_syswrap/syswrap-ppc64-linux.c
branches/DARWIN/exp-ptrcheck/h_main.c
branches/DARWIN/include/vki/vki-ppc32-linux.h
branches/DARWIN/include/vki/vki-ppc64-linux.h
branches/DARWIN/include/vki/vki-x86-linux.h
branches/DARWIN/memcheck/mc_machine.c
Modified: branches/DARWIN/coregrind/m_machine.c
===================================================================
--- branches/DARWIN/coregrind/m_machine.c 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/coregrind/m_machine.c 2009-03-22 13:28:44 UTC (rev 9490)
@@ -402,12 +402,20 @@
{ /* ppc32 doesn't seem to have a sane way to find out what insn
sets the CPU supports. So we have to arse around with
SIGILLs. Yuck. */
- vki_sigset_t saved_set, tmp_set;
- struct vki_sigaction saved_act, tmp_act;
+ vki_sigset_t saved_set, tmp_set;
+ vki_sigaction_fromK_t saved_act;
+ vki_sigaction_toK_t tmp_act;
volatile Bool have_F, have_V, have_FX, have_GX;
Int r;
+ /* This is a kludge. Really we ought to back-convert saved_act
+ into a toK_t using VG_(convert_sigaction_fromK_to_toK), but
+ since that's a no-op on all ppc32 platforms so far supported,
+ it's not worth the typing effort. At least include most basic
+ sanity check: */
+ vg_assert(sizeof(vki_sigaction_fromK_t) == sizeof(vki_sigaction_toK_t));
+
VG_(sigemptyset)(&tmp_set);
VG_(sigaddset)(&tmp_set, VKI_SIGILL);
@@ -508,17 +516,28 @@
#elif defined(VGA_ppc64)
{ /* Same idiocy as for ppc32 - arse around with SIGILLs. */
- vki_sigset_t saved_set, tmp_set;
- struct vki_sigaction saved_act, tmp_act;
+ vki_sigset_t saved_set, tmp_set;
+ vki_sigaction_fromK_t saved_act;
+ vki_sigaction_toK_t tmp_act;
volatile Bool have_F, have_V, have_FX, have_GX;
+ Int r;
+ /* This is a kludge. Really we ought to back-convert saved_act
+ into a toK_t using VG_(convert_sigaction_fromK_to_toK), but
+ since that's a no-op on all ppc64 platforms so far supported,
+ it's not worth the typing effort. At least include most basic
+ sanity check: */
+ vg_assert(sizeof(vki_sigaction_fromK_t) == sizeof(vki_sigaction_toK_t));
+
VG_(sigemptyset)(&tmp_set);
VG_(sigaddset)(&tmp_set, VKI_SIGILL);
- VG_(sigprocmask)(VKI_SIG_UNBLOCK, &tmp_set, &saved_set);
+ r = VG_(sigprocmask)(VKI_SIG_UNBLOCK, &tmp_set, &saved_set);
+ vg_assert(r == 0);
- VG_(sigaction)(VKI_SIGILL, NULL, &saved_act);
+ r = VG_(sigaction)(VKI_SIGILL, NULL, &saved_act);
+ vg_assert(r == 0);
tmp_act = saved_act;
/* NODEFER: signal handler does not return (from the kernel's point of
@@ -531,7 +550,8 @@
/* standard FP insns */
have_F = True;
tmp_act.ksa_handler = handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r = VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r == 0);
if (__builtin_setjmp(env_sigill)) {
have_F = False;
} else {
@@ -541,7 +561,8 @@
/* Altivec insns */
have_V = True;
tmp_act.ksa_handler = handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r = VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r == 0);
if (__builtin_setjmp(env_sigill)) {
have_V = False;
} else {
@@ -551,7 +572,8 @@
/* General-Purpose optional (fsqrt, fsqrts) */
have_FX = True;
tmp_act.ksa_handler = handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r = VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r == 0);
if (__builtin_setjmp(env_sigill)) {
have_FX = False;
} else {
@@ -561,15 +583,18 @@
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
have_GX = True;
tmp_act.ksa_handler = handler_sigill;
- VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ r = VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ vg_assert(r == 0);
if (__builtin_setjmp(env_sigill)) {
have_GX = False;
} else {
__asm__ __volatile__(".long 0xFC000034"); /*frsqrte 0,0*/
}
- VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
- VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
+ r = VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
+ vg_assert(r == 0);
+ r = VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
+ vg_assert(r == 0);
/*
if (0)
VG_(printf)("F %d V %d FX %d GX %d\n",
Modified: branches/DARWIN/coregrind/m_syswrap/priv_types_n_macros.h
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/priv_types_n_macros.h 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/coregrind/m_syswrap/priv_types_n_macros.h 2009-03-22 13:28:44 UTC (rev 9490)
@@ -87,17 +87,18 @@
// the vex register state. For stack arguments (which have s_arg
// field names), the s_arg value is the offset from the stack pointer.
Int o_sysno;
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
+# if defined(VGP_x86_linux) || defined(VGP_amd64_linux) \
+ || defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
Int o_arg1;
Int o_arg2;
Int o_arg3;
Int o_arg4;
Int o_arg5;
Int o_arg6;
- Int dummy_arg7;
- Int dummy_arg8;
+ Int uu_arg7;
+ Int uu_arg8;
Int o_retval;
-#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+# elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
Int o_arg1;
Int o_arg2;
Int o_arg3;
@@ -107,7 +108,7 @@
Int o_arg7;
Int o_arg8;
Int o_retval;
-#elif defined(VGP_x86_darwin)
+# elif defined(VGP_x86_darwin)
Int s_arg1;
Int s_arg2;
Int s_arg3;
@@ -118,7 +119,7 @@
Int s_arg8;
Int o_retval_lo;
Int o_retval_hi;
-#elif defined(VGP_amd64_darwin)
+# elif defined(VGP_amd64_darwin)
Int o_arg1;
Int o_arg2;
Int o_arg3;
@@ -129,9 +130,9 @@
Int s_arg8;
Int o_retval_lo;
Int o_retval_hi;
-#else
-# error Unknown platform
-#endif
+# else
+# error "Unknown platform"
+# endif
}
SyscallArgLayout;
Modified: branches/DARWIN/coregrind/m_syswrap/syswrap-main.c
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syswrap-main.c 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/coregrind/m_syswrap/syswrap-main.c 2009-03-22 13:28:44 UTC (rev 9490)
@@ -878,14 +878,14 @@
VexGuestPPC32State* gst = (VexGuestPPC32State*)gst_vanilla;
UInt old_cr = LibVEX_GuestPPC32_get_CR(gst);
vg_assert(canonical->what == SsComplete);
- if (canonical->sres.isError) {
+ if (sr_isError(canonical->sres)) {
/* set CR0.SO */
LibVEX_GuestPPC32_put_CR( old_cr | (1<<28), gst );
- gst->guest_GPR3 = canonical->sres.err;
+ gst->guest_GPR3 = sr_Err(canonical->sres);
} else {
/* clear CR0.SO */
LibVEX_GuestPPC32_put_CR( old_cr & ~(1<<28), gst );
- gst->guest_GPR3 = canonical->sres.res;
+ gst->guest_GPR3 = sr_Res(canonical->sres);
}
VG_TRACK( post_reg_write, Vg_CoreSysCall, tid,
OFFSET_ppc32_GPR3, sizeof(UWord) );
@@ -896,14 +896,14 @@
VexGuestPPC64State* gst = (VexGuestPPC64State*)gst_vanilla;
UInt old_cr = LibVEX_GuestPPC64_get_CR(gst);
vg_assert(canonical->what == SsComplete);
- if (canonical->sres.isError) {
+ if (sr_isError(canonical->sres)) {
/* set CR0.SO */
LibVEX_GuestPPC64_put_CR( old_cr | (1<<28), gst );
- gst->guest_GPR3 = canonical->sres.err;
+ gst->guest_GPR3 = sr_Err(canonical->sres);
} else {
/* clear CR0.SO */
LibVEX_GuestPPC64_put_CR( old_cr & ~(1<<28), gst );
- gst->guest_GPR3 = canonical->sres.res;
+ gst->guest_GPR3 = sr_Res(canonical->sres);
}
VG_TRACK( post_reg_write, Vg_CoreSysCall, tid,
OFFSET_ppc64_GPR3, sizeof(UWord) );
@@ -1022,8 +1022,8 @@
layout->o_arg4 = OFFSET_x86_ESI;
layout->o_arg5 = OFFSET_x86_EDI;
layout->o_arg6 = OFFSET_x86_EBP;
- layout->dummy_arg7 = -1; /* impossible value */
- layout->dummy_arg8 = -1; /* impossible value */
+ layout->uu_arg7 = -1; /* impossible value */
+ layout->uu_arg8 = -1; /* impossible value */
layout->o_retval = OFFSET_x86_EAX;
#elif defined(VGP_amd64_linux)
@@ -1034,8 +1034,8 @@
layout->o_arg4 = OFFSET_amd64_R10;
layout->o_arg5 = OFFSET_amd64_R8;
layout->o_arg6 = OFFSET_amd64_R9;
- layout->dummy_arg7 = -1; /* impossible value */
- layout->dummy_arg8 = -1; /* impossible value */
+ layout->uu_arg7 = -1; /* impossible value */
+ layout->uu_arg8 = -1; /* impossible value */
layout->o_retval = OFFSET_amd64_RAX;
#elif defined(VGP_ppc32_linux)
@@ -1046,8 +1046,8 @@
layout->o_arg4 = OFFSET_ppc32_GPR6;
layout->o_arg5 = OFFSET_ppc32_GPR7;
layout->o_arg6 = OFFSET_ppc32_GPR8;
- layout->o_arg7 = -1; /* impossible value */
- layout->o_arg8 = -1; /* impossible value */
+ layout->uu_arg7 = -1; /* impossible value */
+ layout->uu_arg8 = -1; /* impossible value */
layout->o_retval = OFFSET_ppc32_GPR3;
#elif defined(VGP_ppc64_linux)
@@ -1058,8 +1058,8 @@
layout->o_arg4 = OFFSET_ppc64_GPR6;
layout->o_arg5 = OFFSET_ppc64_GPR7;
layout->o_arg6 = OFFSET_ppc64_GPR8;
- layout->o_arg7 = -1; /* impossible value */
- layout->o_arg8 = -1; /* impossible value */
+ layout->uu_arg7 = -1; /* impossible value */
+ layout->uu_arg8 = -1; /* impossible value */
layout->o_retval = OFFSET_ppc64_GPR3;
#elif defined(VGP_ppc32_aix5)
Modified: branches/DARWIN/coregrind/m_syswrap/syswrap-ppc32-linux.c
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syswrap-ppc32-linux.c 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/coregrind/m_syswrap/syswrap-ppc32-linux.c 2009-03-22 13:28:44 UTC (rev 9490)
@@ -349,7 +349,7 @@
VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL);
out:
- if (res.isError) {
+ if (sr_isError(res)) {
/* clone failed */
VG_(cleanup_thread)(&ctst->arch);
ctst->status = VgTs_Empty;
@@ -1379,8 +1379,8 @@
}
PRE(sys_sigaction)
{
- struct vki_sigaction new, old;
- struct vki_sigaction *newp, *oldp;
+ vki_sigaction_toK_t new, *newp;
+ vki_sigaction_fromK_t old, *oldp;
PRINT("sys_sigaction ( %ld, %#lx, %#lx )", ARG1,ARG2,ARG3);
PRE_REG_READ3(int, "sigaction",
Modified: branches/DARWIN/coregrind/m_syswrap/syswrap-ppc64-linux.c
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syswrap-ppc64-linux.c 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/coregrind/m_syswrap/syswrap-ppc64-linux.c 2009-03-22 13:28:44 UTC (rev 9490)
@@ -379,7 +379,7 @@
VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL);
out:
- if (res.isError) {
+ if (sr_isError(res)) {
/* clone failed */
VG_(cleanup_thread)(&ctst->arch);
ctst->status = VgTs_Empty;
Modified: branches/DARWIN/exp-ptrcheck/h_main.c
===================================================================
--- branches/DARWIN/exp-ptrcheck/h_main.c 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/exp-ptrcheck/h_main.c 2009-03-22 13:28:44 UTC (rev 9490)
@@ -1533,7 +1533,7 @@
if (o == GOF(LR) && is4) goto exactly1;
if (o == GOF(CTR) && is4) goto exactly1;
if (o == GOF(CIA) && is4) goto none;
- if (o == GOF(CIA_AT_SC) && is4) goto none;
+ if (o == GOF(IP_AT_SYSCALL) && is4) goto none;
if (o == GOF(RESVN) && is4) goto none;
if (o == GOF(TISTART) && is4) goto none;
if (o == GOF(TILEN) && is4) goto none;
@@ -1697,7 +1697,7 @@
if (o == GOF(LR) && is8) goto exactly1;
if (o == GOF(CTR) && is8) goto exactly1;
if (o == GOF(CIA) && is8) goto none;
- if (o == GOF(CIA_AT_SC) && is8) goto none;
+ if (o == GOF(IP_AT_SYSCALL) && is8) goto none;
if (o == GOF(RESVN) && is8) goto none;
if (o == GOF(TISTART) && is8) goto none;
if (o == GOF(TILEN) && is8) goto none;
Modified: branches/DARWIN/include/vki/vki-ppc32-linux.h
===================================================================
--- branches/DARWIN/include/vki/vki-ppc32-linux.h 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/include/vki/vki-ppc32-linux.h 2009-03-22 13:28:44 UTC (rev 9490)
@@ -154,6 +154,10 @@
#define VKI_SS_ONSTACK 1
#define VKI_SS_DISABLE 2
+/* These are 'legacy' sigactions in which the size of sa_mask is fixed
+ (cannot be expanded at any future point) because it is sandwiched
+ between two other fields.
+ (there is identical kludgery in vki-x86-linux.h) */
struct vki_old_sigaction {
// [[Nb: a 'k' prefix is added to "sa_handler" because
// bits/sigaction.h (which gets dragged in somehow via signal.h)
@@ -165,7 +169,7 @@
__vki_sigrestore_t sa_restorer;
};
-struct vki_sigaction {
+struct vki_sigaction_base {
// [[See comment about extra 'k' above]]
__vki_sighandler_t ksa_handler;
unsigned long sa_flags;
@@ -173,6 +177,12 @@
vki_sigset_t sa_mask; /* mask last for extensibility */
};
+/* On Linux we use the same type for passing sigactions to
+ and from the kernel. Hence: */
+typedef struct vki_sigaction_base vki_sigaction_toK_t;
+typedef struct vki_sigaction_base vki_sigaction_fromK_t;
+
+
typedef struct vki_sigaltstack {
void __user *ss_sp;
int ss_flags;
Modified: branches/DARWIN/include/vki/vki-ppc64-linux.h
===================================================================
--- branches/DARWIN/include/vki/vki-ppc64-linux.h 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/include/vki/vki-ppc64-linux.h 2009-03-22 13:28:44 UTC (rev 9490)
@@ -164,13 +164,19 @@
__vki_sigrestore_t sa_restorer;
};
-struct vki_sigaction {
+struct vki_sigaction_base {
__vki_sighandler_t ksa_handler;
unsigned long sa_flags;
__vki_sigrestore_t sa_restorer;
vki_sigset_t sa_mask; /* mask last for extensibility */
};
+/* On Linux we use the same type for passing sigactions to
+ and from the kernel. Hence: */
+typedef struct vki_sigaction_base vki_sigaction_toK_t;
+typedef struct vki_sigaction_base vki_sigaction_fromK_t;
+
+
typedef struct vki_sigaltstack {
void __user *ss_sp;
int ss_flags;
Modified: branches/DARWIN/include/vki/vki-x86-linux.h
===================================================================
--- branches/DARWIN/include/vki/vki-x86-linux.h 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/include/vki/vki-x86-linux.h 2009-03-22 13:28:44 UTC (rev 9490)
@@ -151,7 +151,8 @@
/* These are 'legacy' sigactions in which the size of sa_mask is fixed
(cannot be expanded at any future point) because it is sandwiched
- between two other fields. */
+ between two other fields.
+ (there is identical kludgery in vki-ppc32-linux.h) */
struct vki_old_sigaction {
// [[Nb: a 'k' prefix is added to "sa_handler" because
// bits/sigaction.h (which gets dragged in somehow via signal.h)
Modified: branches/DARWIN/memcheck/mc_machine.c
===================================================================
--- branches/DARWIN/memcheck/mc_machine.c 2009-03-22 12:36:32 UTC (rev 9489)
+++ branches/DARWIN/memcheck/mc_machine.c 2009-03-22 13:28:44 UTC (rev 9490)
@@ -181,7 +181,7 @@
if (o == GOF(CTR) && sz == 8) return o;
if (o == GOF(CIA) && sz == 8) return -1;
- if (o == GOF(CIA_AT_SC) && sz == 8) return -1;
+ if (o == GOF(IP_AT_SYSCALL) && sz == 8) return -1;
if (o == GOF(RESVN) && sz == 8) return -1;
if (o == GOF(FPROUND) && sz == 4) return -1;
if (o == GOF(EMWARN) && sz == 4) return -1;
@@ -340,7 +340,7 @@
if (o == GOF(CTR) && sz == 4) return o;
if (o == GOF(CIA) && sz == 4) return -1;
- if (o == GOF(CIA_AT_SC) && sz == 4) return -1;
+ if (o == GOF(IP_AT_SYSCALL) && sz == 4) return -1;
if (o == GOF(RESVN) && sz == 4) return -1;
if (o == GOF(FPROUND) && sz == 4) return -1;
if (o == GOF(VRSAVE) && sz == 4) return -1;
|