|
From: <sv...@va...> - 2005-05-29 17:50:45
|
Author: njn
Date: 2005-05-29 18:50:40 +0100 (Sun, 29 May 2005)
New Revision: 3812
Modified:
trunk/coregrind/amd64-linux/core_platform.h
trunk/coregrind/arm-linux/core_platform.h
trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
trunk/coregrind/m_syscalls/syscalls-x86-linux.c
trunk/coregrind/pub_core_syscalls.h
trunk/coregrind/vg_signals.c
trunk/coregrind/x86-linux/core_platform.h
Log:
Localized use of VGP_UCONTEXT_* to vg_signals.c, which meant they could
be moved out of $PLATFORM/core_platform.h.
Modified: trunk/coregrind/amd64-linux/core_platform.h
=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/amd64-linux/core_platform.h 2005-05-29 17:27:18 UTC (=
rev 3811)
+++ trunk/coregrind/amd64-linux/core_platform.h 2005-05-29 17:50:40 UTC (=
rev 3812)
@@ -32,20 +32,7 @@
#ifndef __AMD64_LINUX_CORE_PLATFORM_H
#define __AMD64_LINUX_CORE_PLATFORM_H
=20
-//#include "core_platform_asm.h" // platform-specific asm stuff
-//#include "platform_arch.h" // platform-specific tool stuff
-
/* ---------------------------------------------------------------------
- ucontext stuff
- ------------------------------------------------------------------ */
-
-#define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.rip)
-#define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.rsp)
-#define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.rbp)
-#define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.rax)
-#define VGP_UCONTEXT_SYSCALL_RET(uc) ((uc)->uc_mcontext.rax)
-
-/* ---------------------------------------------------------------------
mmap() stuff
------------------------------------------------------------------ */
=20
Modified: trunk/coregrind/arm-linux/core_platform.h
=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/arm-linux/core_platform.h 2005-05-29 17:27:18 UTC (re=
v 3811)
+++ trunk/coregrind/arm-linux/core_platform.h 2005-05-29 17:50:40 UTC (re=
v 3812)
@@ -32,19 +32,7 @@
#ifndef __ARM_LINUX_CORE_PLATFORM_H
#define __ARM_LINUX_CORE_PLATFORM_H
=20
-//#include "core_platform_asm.h" // platform-specific asm stuff
-//#include "platform_arch.h" // platform-specific tool stuff
-
/* ---------------------------------------------------------------------
- ucontext stuff
- ------------------------------------------------------------------ */
-
-#define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.arm_pc)
-#define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.arm_sp)
-#define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.arm_fp)
-#define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.arm_r0)
-
-/* ---------------------------------------------------------------------
mmap() stuff
------------------------------------------------------------------ */
=20
Modified: trunk/coregrind/m_syscalls/syscalls-amd64-linux.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_syscalls/syscalls-amd64-linux.c 2005-05-29 17:27:18=
UTC (rev 3811)
+++ trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-05-29 17:50:40=
UTC (rev 3812)
@@ -108,18 +108,17 @@
*/
/* NB: this is identical to the x86 version */
void VGP_(interrupted_syscall)(ThreadId tid,=20
- struct vki_ucontext *uc,
+ Word ip, UWord sysnum, UWord sysret,
Bool restart)
{
static const Bool debug =3D 0;
=20
ThreadState *tst =3D VG_(get_ThreadState)(tid);
ThreadArchState *th_regs =3D &tst->arch;
- Word ip =3D VGP_UCONTEXT_INSTR_PTR(uc);
=20
if (debug)
VG_(printf)("interrupted_syscall: ip=3D%p; restart=3D%d eax=3D%d\n=
",=20
- ip, restart, VGP_UCONTEXT_SYSCALL_NUM(uc));
+ ip, restart, sysnum);
=20
if (ip < VGA_(blksys_setup) || ip >=3D VGA_(blksys_finished)) {
VG_(printf)(" not in syscall (%p - %p)\n", VGA_(blksys_setup), VG=
A_(blksys_finished));
@@ -149,8 +148,8 @@
The saved real CPU %rax has the result, which we need to move
to RAX. */
if (debug)
- VG_(printf)(" completed: ret=3D%d\n", VGP_UCONTEXT_SYSCALL_RET(uc));
- th_regs->vex.VGP_SYSCALL_RET =3D VGP_UCONTEXT_SYSCALL_RET(uc);
+ VG_(printf)(" completed: ret=3D%d\n", sysret);
+ th_regs->vex.VGP_SYSCALL_RET =3D sysret;
VG_(post_syscall)(tid);
} else if (ip >=3D VGA_(blksys_committed) && ip < VGA_(blksys_finishe=
d)) {
/* Result committed, but the signal mask has not been restored;
Modified: trunk/coregrind/m_syscalls/syscalls-x86-linux.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_syscalls/syscalls-x86-linux.c 2005-05-29 17:27:18 U=
TC (rev 3811)
+++ trunk/coregrind/m_syscalls/syscalls-x86-linux.c 2005-05-29 17:50:40 U=
TC (rev 3812)
@@ -107,18 +107,17 @@
*/
/* NB: this is identical to the amd64 version */
void VGP_(interrupted_syscall)(ThreadId tid,=20
- struct vki_ucontext *uc,
+ Word eip, UWord sysnum, UWord sysret,
Bool restart)
{
static const Bool debug =3D 0;
=20
ThreadState *tst =3D VG_(get_ThreadState)(tid);
ThreadArchState *th_regs =3D &tst->arch;
- Word eip =3D VGP_UCONTEXT_INSTR_PTR(uc);
=20
if (debug)
VG_(printf)("interrupted_syscall: eip=3D%p; restart=3D%d eax=3D%d\=
n",=20
- eip, restart, VGP_UCONTEXT_SYSCALL_NUM(uc));
+ eip, restart, sysnum);
=20
if (eip < VGA_(blksys_setup) || eip >=3D VGA_(blksys_finished)) {
VG_(printf)(" not in syscall (%p - %p)\n", VGA_(blksys_setup), VG=
A_(blksys_finished));
@@ -148,8 +147,8 @@
The saved real CPU %eax has the result, which we need to move
to EAX. */
if (debug)
- VG_(printf)(" completed: ret=3D%d\n", VGP_UCONTEXT_SYSCALL_RET(uc));
- th_regs->vex.VGP_SYSCALL_RET =3D VGP_UCONTEXT_SYSCALL_RET(uc);
+ VG_(printf)(" completed: ret=3D%d\n", sysret);
+ th_regs->vex.VGP_SYSCALL_RET =3D sysret;
VG_(post_syscall)(tid);
} else if (eip >=3D VGA_(blksys_committed) && eip < VGA_(blksys_finis=
hed)) {
/* Result committed, but the signal mask has not been restored;
Modified: trunk/coregrind/pub_core_syscalls.h
=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/pub_core_syscalls.h 2005-05-29 17:27:18 UTC (rev 3811=
)
+++ trunk/coregrind/pub_core_syscalls.h 2005-05-29 17:50:40 UTC (rev 3812=
)
@@ -48,7 +48,7 @@
// (either interrupted or finished normally), or False if it was
// restarted (or the signal didn't actually interrupt a syscall).
extern void VGP_(interrupted_syscall)(ThreadId tid,
- struct vki_ucontext *uc,
+ Word eip, UWord sysnum, UWord sysr=
et,
Bool restart);
=20
// Release resources held by this thread
Modified: trunk/coregrind/vg_signals.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/vg_signals.c 2005-05-29 17:27:18 UTC (rev 3811)
+++ trunk/coregrind/vg_signals.c 2005-05-29 17:50:40 UTC (rev 3812)
@@ -113,6 +113,28 @@
vki_siginfo_t sigs[N_QUEUED_SIGNALS];
} SigQueue;
=20
+#if defined(VGP_x86_linux)
+# define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.eip)
+# define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.esp)
+# define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.ebp)
+# define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.eax)
+# define VGP_UCONTEXT_SYSCALL_RET(uc) ((uc)->uc_mcontext.eax)
+#elif defined(VGP_amd64_linux)
+# define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.rip)
+# define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.rsp)
+# define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.rbp)
+# define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.rax)
+# define VGP_UCONTEXT_SYSCALL_RET(uc) ((uc)->uc_mcontext.rax)
+#elif defined(VGP_arm_linux)
+# define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.arm_pc)
+# define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.arm_sp)
+# define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.arm_fp)
+# define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.arm_r0)
+# error VGP_UCONTEXT_SYSCALL_RET undefined for ARM/Linux
+#else
+# error Unknown platform
+#endif
+
/* ---------------------------------------------------------------------
HIGH LEVEL STUFF TO DO WITH SIGNALS: POLICY (MOSTLY)
------------------------------------------------------------------ */
@@ -1584,7 +1606,10 @@
sigNo, tid, info->si_code);
=20
/* Update thread state properly */
- VGP_(interrupted_syscall)(tid, uc,=20
+ VGP_(interrupted_syscall)(tid,=20
+ VGP_UCONTEXT_INSTR_PTR(uc),=20
+ VGP_UCONTEXT_SYSCALL_NUM(uc),=20
+ VGP_UCONTEXT_SYSCALL_RET(uc),=20
!!(scss.scss_per_sig[sigNo].scss_flags & VKI_SA_RESTART));
=20
/* Set up the thread's state to deliver a signal */
Modified: trunk/coregrind/x86-linux/core_platform.h
=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/x86-linux/core_platform.h 2005-05-29 17:27:18 UTC (re=
v 3811)
+++ trunk/coregrind/x86-linux/core_platform.h 2005-05-29 17:50:40 UTC (re=
v 3812)
@@ -32,20 +32,7 @@
#ifndef __X86_LINUX_CORE_PLATFORM_H
#define __X86_LINUX_CORE_PLATFORM_H
=20
-//#include "core_platform_asm.h" // platform-specific asm stuff
-//#include "platform_arch.h" // platform-specific tool stuff
-
/* ---------------------------------------------------------------------
- ucontext stuff
- ------------------------------------------------------------------ */
-
-#define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.eip)
-#define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.esp)
-#define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.ebp)
-#define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.eax)
-#define VGP_UCONTEXT_SYSCALL_RET(uc) ((uc)->uc_mcontext.eax)
-
-/* ---------------------------------------------------------------------
mmap() stuff
------------------------------------------------------------------ */
=20
|