]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fill out missing functionality on amd64 OS X to back up guest state to restart a...
authorRhys Kidd <rhyskidd@gmail.com>
Thu, 15 Oct 2015 05:40:17 +0000 (05:40 +0000)
committerRhys Kidd <rhyskidd@gmail.com>
Thu, 15 Oct 2015 05:40:17 +0000 (05:40 +0000)
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

coregrind/m_syswrap/syswrap-main.c

index 4f37c32d091cc88a14eeb64d49001fa65473aaf3..f4d1fdd47f468d884b1d260a6ab2037674899170 100644 (file)
@@ -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)