PERFORCE change 152638 for review

Peter Wemm peter at FreeBSD.org
Fri Nov 7 15:21:36 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=152638

Change 152638 by peter at peter_hammer on 2008/11/07 23:20:41

	res2 (%edx) handling across syscalls is "special" on i386. syscalls may
	or may not specify it.  It is otherwise preserved across a syscall, and
	some asm stubs in libc depend on this (eg: brk()).  This is not the case
	for amd64 where the syscall interface uses the C calling convention and
	trashes the scratch registers.  %rdx is a scratch register.  I always
	trash it in valgrind on amd64.

Affected files ...

.. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-main.c#14 edit

Differences ...

==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-main.c#14 (text+ko) ====

@@ -313,7 +313,8 @@
 //VG_(printf)( "eq_SyscallStatus: what %d %d res %ld %ld res2 %ld %ld err %ld %ld isError %d %d\n", s1->what, s2->what, s1->sres.res, s2->sres.res, s1->sres.res2, s2->sres.res2, s1->sres.err, s2->sres.err, s1->sres.isError, s2->sres.isError);
    return s1->what == s2->what 
           && s1->sres.res == s2->sres.res
-#if defined(VGO_freebsd)
+#if defined(VGP_amd64_freebsd)
+          /* x86 should check this too, but syscall wrappers that call do_syscallN() don't preserve res2 */
           && s1->sres.res2 == s2->sres.res2
 #endif
 #if !defined(VGO_freebsd)	/* getSyscallStatusFromMumble is out of sync */


More information about the p4-projects mailing list