From: Rhys Kidd Date: Thu, 15 Oct 2015 05:40:17 +0000 (+0000) Subject: Fill out missing functionality on amd64 OS X to back up guest state to restart a... X-Git-Tag: svn/VALGRIND_3_12_0~318 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06d960e68d12834778ab541f200c03f348384acb;p=thirdparty%2Fvalgrind.git Fill out missing functionality on amd64 OS X to back up guest state to restart a system call. No regressions on OS X 10.10 Before: == 596 tests, 219 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures == After: == 596 tests, 219 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures == git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15705 --- diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index 4f37c32d09..f4d1fdd47f 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -2405,10 +2405,10 @@ void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch ) /* Make sure our caller is actually sane, and we're really backing back over a syscall. - int $0x80 == CD 80 - int $0x81 == CD 81 - int $0x82 == CD 82 - sysenter == 0F 34 + int $0x80 == CD 80 // Used to communicate with BSD syscalls + int $0x81 == CD 81 // Used to communicate with Mach traps + int $0x82 == CD 82 // Used to communicate with "thread" ? + sysenter == 0F 34 // Used to communicate with Unix syscalls */ { UChar *p = (UChar *)arch->vex.guest_EIP; @@ -2424,8 +2424,23 @@ void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch ) } #elif defined(VGP_amd64_darwin) - // DDD: #warning GrP fixme amd64 restart unimplemented - vg_assert(0); + arch->vex.guest_RIP = arch->vex.guest_IP_AT_SYSCALL; + + /* Make sure our caller is actually sane, and we're really backing + back over a syscall. + + syscall == 0F 05 + */ + { + UChar *p = (UChar *)arch->vex.guest_RIP; + + Bool ok = (p[0] == 0x0F && p[1] == 0x05); + if (!ok) + VG_(message)(Vg_DebugMsg, + "?! restarting over syscall at %#llx %02x %02x\n", + arch->vex.guest_RIP, p[0], p[1]); + vg_assert(ok); + } #elif defined(VGP_s390x_linux) arch->vex.guest_IA -= 2; // sizeof(syscall)