]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Support sys_proc_info on 32-bit darwin as well as 64-bit. This
authorJulian Seward <jseward@acm.org>
Tue, 27 Jul 2010 09:09:55 +0000 (09:09 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 27 Jul 2010 09:09:55 +0000 (09:09 +0000)
gets rid of complaints about "unsupported syscall unix:336".

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11231

coregrind/m_syswrap/priv_syswrap-darwin.h
coregrind/m_syswrap/syswrap-darwin.c

index aeda3b3d7892796a3890261740b2fa9a66825b69..17ffcc6897161d62fdabbebde5d8e307e7a3410d 100644 (file)
@@ -393,7 +393,7 @@ DECL_TEMPLATE(darwin, __pthread_markcancel);    // 332
 DECL_TEMPLATE(darwin, __pthread_canceled);      // 333
 DECL_TEMPLATE(darwin, __semwait_signal);        // 334
 // old utrace
-#if DARWIN_VERS >= DARWIN_10_6 && defined(VGP_amd64_darwin)
+#if DARWIN_VERS >= DARWIN_10_6
 DECL_TEMPLATE(darwin, proc_info);               // 336
 #endif
 DECL_TEMPLATE(darwin, sendfile);                // 337
index c3396acd21cc2a1b16b38be9737ff4216cb316b7..d2c46d83c81201da8d5bef57cbe55446d92bc8fc 100644 (file)
@@ -3621,23 +3621,34 @@ PRE(sigsuspend)
    PRE_REG_READ1(int, "sigsuspend", int, sigmask);
 }
 
-/* NB: 64-bit version only!  If this needs to be supported
-   on 32-bit Darwin too, be careful about the 4th arg, since
-   that is a uint64_t. 
+
+/* Be careful about the 4th arg, since that is a uint64_t.  Hence 64-
+   and 32-bit wrappers are different.
 
    ARG5 and ARG6 (buffer, buffersize) specify a buffer start and
    length in the usual way.  I have seen values NULL, 0 passed in some
    cases.  I left the calls to PRE_MEM_WRITE/READ unconditional on the
    basis that they don't do anything if the length is zero, so it's OK
    for the buffer pointer to be NULL in that case (meaning they don't
-   complain). */
-#if DARWIN_VERS >= DARWIN_10_6 && defined(VGP_amd64_darwin)
+   complain).
+
+   int proc_info(int32_t callnum, int32_t pid,
+                 uint32_t flavor, uint64_t arg,
+                 user_addr_t buffer, int32_t buffersize)
+*/
+#if DARWIN_VERS >= DARWIN_10_6
 PRE(proc_info)
 {
-   /* int proc_info(int32_t callnum, int32_t pid,
-                    uint32_t flavor, uint64_t arg,
-                    user_addr_t buffer, int32_t buffersize)
-   */
+#if VG_WORDSIZE == 4
+   PRINT("proc_info(%d, %d, %u, %llu, %#lx, %d)",
+         (Int)ARG1, (Int)ARG2, (UInt)ARG3, LOHI64(ARG4,ARG5), ARG6, (Int)ARG7);
+   PRE_REG_READ7(int, "proc_info",
+                 int, callnum, int, pid, unsigned int, flavor,
+                 vki_uint32_t, arg_low32,
+                 vki_uint32_t, arg_high32,
+                 void*, buffer, int, buffersize);
+   PRE_MEM_WRITE("proc_info(buffer)", ARG6, ARG7);
+#else
    PRINT("proc_info(%d, %d, %u, %llu, %#lx, %d)",
          (Int)ARG1, (Int)ARG2, (UInt)ARG3, (ULong)ARG4, ARG5, (Int)ARG6);
    PRE_REG_READ6(int, "proc_info",
@@ -3645,13 +3656,21 @@ PRE(proc_info)
                  unsigned long long int, arg,
                  void*, buffer, int, buffersize);
    PRE_MEM_WRITE("proc_info(buffer)", ARG5, ARG6);
+#endif
 }
+
 POST(proc_info)
 {
+#if VG_WORDSIZE == 4
+   vg_assert(SUCCESS);
+   POST_MEM_WRITE(ARG6, ARG7);
+#else
    vg_assert(SUCCESS);
    POST_MEM_WRITE(ARG5, ARG6);
-}
 #endif
+}
+
+#endif /* DARWIN_VERS >= DARWIN_10_6 */
 
 /* ---------------------------------------------------------------------
    aio_*
@@ -7889,7 +7908,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    MACX_(__NR___pthread_canceled,      __pthread_canceled),
    MACX_(__NR___semwait_signal,        __semwait_signal), 
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(335)),   // old utrace
-#if DARWIN_VERS >= DARWIN_10_6 && defined(VGP_amd64_darwin)
+#if DARWIN_VERS >= DARWIN_10_6
    MACXY(__NR_proc_info,               proc_info),  // 336
 #endif
    MACXY(__NR_sendfile,    sendfile),