diff options
author | rhyskidd <rhyskidd@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2015-10-15 05:40:17 +0000 |
---|---|---|
committer | rhyskidd <rhyskidd@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2015-10-15 05:40:17 +0000 |
commit | 782366606c7a75c217364646872f09a8a400c3f5 (patch) | |
tree | 8e9710f570d2e37fd50a0132ae26d609a4ab17b5 /coregrind/m_syswrap | |
parent | b425ed268d35708b77f527789edeb6dce1da2786 (diff) | |
download | valgrind-782366606c7a75c217364646872f09a8a400c3f5.tar.gz |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'coregrind/m_syswrap')
-rw-r--r-- | coregrind/m_syswrap/syswrap-main.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index 4f37c32d0..f4d1fdd47 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) |