From owner-p4-projects@FreeBSD.ORG Mon Nov 3 23:00:37 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7684D106567A; Mon, 3 Nov 2008 23:00:37 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 236D71065674 for ; Mon, 3 Nov 2008 23:00:37 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 1077E8FC12 for ; Mon, 3 Nov 2008 23:00:37 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mA3N0aaZ063997 for ; Mon, 3 Nov 2008 23:00:36 GMT (envelope-from peter-gmail@wemm.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mA3N0awO063995 for perforce@freebsd.org; Mon, 3 Nov 2008 23:00:36 GMT (envelope-from peter-gmail@wemm.org) Date: Mon, 3 Nov 2008 23:00:36 GMT Message-Id: <200811032300.mA3N0awO063995@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter-gmail@wemm.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 152437 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2008 23:00:38 -0000 http://perforce.freebsd.org/chv.cgi?CH=152437 Change 152437 by peter@peter_overcee on 2008/11/03 23:00:10 Begin fleshing out umtx op wrappers and side effects Affected files ... .. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#21 edit Differences ... ==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#21 (text+ko) ==== @@ -1774,96 +1774,155 @@ PRE(sys__umtx_op) { + /* 5 args are always passed through. The last two can vary, but + they're always pointers. They may not be used though. */ switch(ARG2) { case VKI_UMTX_OP_LOCK: PRINT( "sys__umtx_op ( %#lx, LOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); + PRE_REG_READ5(long, "_umtx_op_lock", + struct umtx *, obj, int, op, unsigned long, id, + void *, zero, struct vki_timespec *, timeout); + PRE_MEM_READ( "_umtx_op_lock(mtx)", ARG1, sizeof(struct vki_umtx) ); + if (ARG5) + PRE_MEM_READ( "_umtx_op_lock(timespec)", ARG5, sizeof(struct vki_timespec) ); + PRE_MEM_WRITE( "_umtx_op_lock(mtx)", ARG1, sizeof(struct vki_umtx) ); break; case VKI_UMTX_OP_UNLOCK: - PRINT( "sys__umtx_op ( %#lx, UNLOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, UNLOCK, %ld)", ARG1, ARG3); + PRE_REG_READ3(long, "_umtx_op_unlock", + struct umtx *, obj, int, op, unsigned long, id); + PRE_MEM_READ( "_umtx_op_lock(mtx)", ARG1, sizeof(struct vki_umtx) ); + PRE_MEM_WRITE( "_umtx_op_lock(mtx)", ARG1, sizeof(struct vki_umtx) ); break; case VKI_UMTX_OP_WAIT: PRINT( "sys__umtx_op ( %#lx, WAIT, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); + PRE_REG_READ5(long, "_umtx_op_wait", + struct umtx *, obj, int, op, unsigned long, id, + void *, zero, struct vki_timespec *, timeout); + PRE_MEM_READ( "_umtx_op_wait(mtx)", ARG1, sizeof(struct vki_umtx) ); + if (ARG5) + PRE_MEM_READ( "_umtx_op_wait(timespec)", ARG5, sizeof(struct vki_timespec) ); break; case VKI_UMTX_OP_WAKE: - PRINT( "sys__umtx_op ( %#lx, WAKE, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, WAKE, %ld)", ARG1, ARG3); + PRE_REG_READ3(long, "_umtx_op_wake", + struct umtx *, obj, int, op, unsigned long, id); + PRE_MEM_READ( "_umtx_op_wake(mtx)", ARG1, sizeof(struct vki_umtx) ); break; case VKI_UMTX_OP_MUTEX_TRYLOCK: - PRINT( "sys__umtx_op ( %#lx, MUTEX_TRYLOCK, %ld, %#lx, %#lx)", - ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, MUTEX_TRYLOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_MUTEX_LOCK: - PRINT( "sys__umtx_op ( %#lx, MUTEX_LOCK, %ld, %#lx, %#lx)", - ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, MUTEX_LOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_MUTEX_UNLOCK: - PRINT( "sys__umtx_op ( %#lx, MUTEX_UNLOCK, %ld, %#lx, %#lx)", - ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, MUTEX_UNLOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_SET_CEILING: - PRINT( "sys__umtx_op ( %#lx, SET_CEILING, %ld, %#lx, %#lx)", - ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, SET_CEILING, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_CV_WAIT: PRINT( "sys__umtx_op ( %#lx, CV_WAIT, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_CV_SIGNAL: - PRINT( "sys__umtx_op ( %#lx, CV_SIGNAL, %ld, %#lx, %#lx)", - ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, CV_SIGNAL, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_CV_BROADCAST: - PRINT( "sys__umtx_op ( %#lx, CV_BROADCAST, %ld, %#lx, %#lx)", - ARG1, ARG3, ARG4, ARG5); + PRINT( "sys__umtx_op ( %#lx, CV_BROADCAST, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_WAIT_UINT: - PRINT( "sys__umtx_op ( %#lx, CV_WAIT_UINT)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_WAIT_UINT, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); + PRE_REG_READ5(long, "_umtx_op_wait_uint", + int *, obj, int, op, unsigned long, id, + void *, zero, struct vki_timespec *, timeout); + PRE_MEM_READ( "_umtx_op_wait(uint)", ARG1, sizeof(int) ); + if (ARG5) + PRE_MEM_READ( "_umtx_op_wait(timespec)", ARG5, sizeof(struct vki_timespec) ); break; case VKI_UMTX_OP_RW_RDLOCK: - PRINT( "sys__umtx_op ( %#lx, CV_RW_RDLOCK)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_RW_RDLOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_RW_WRLOCK: - PRINT( "sys__umtx_op ( %#lx, CV_RW_WRLOCK)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_RW_WRLOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_RW_UNLOCK: - PRINT( "sys__umtx_op ( %#lx, CV_RW_UNLOCK)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_RW_UNLOCK, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_WAIT_UINT_PRIVATE: - PRINT( "sys__umtx_op ( %#lx, CV_WAIT_UINT_PRIVATE)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_WAIT_UINT_PRIVATE, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); + PRE_REG_READ5(long, "_umtx_op_wait_uint_private", + int *, obj, int, op, unsigned long, id, + void *, zero, struct vki_timespec *, timeout); + PRE_MEM_READ( "_umtx_op_wait_private(uint)", ARG1, sizeof(int) ); + if (ARG5) + PRE_MEM_READ( "_umtx_op_wait_private(timespec)", ARG5, sizeof(struct vki_timespec) ); break; case VKI_UMTX_OP_WAKE_PRIVATE: - PRINT( "sys__umtx_op ( %#lx, CV_WAKE_PRIVATE)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_WAKE_PRIVATE, %ld)", ARG1, ARG3); + PRE_REG_READ3(long, "_umtx_op_wake_private", + struct umtx *, obj, int, op, unsigned long, id); + PRE_MEM_READ( "_umtx_op_wake_private(mtx)", ARG1, sizeof(struct vki_umtx) ); break; case VKI_UMTX_OP_MUTEX_WAIT: - PRINT( "sys__umtx_op ( %#lx, CV_MUTEX_WAIT)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_MUTEX_WAIT, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; case VKI_UMTX_OP_MUTEX_WAKE: - PRINT( "sys__umtx_op ( %#lx, CV_MUTEX_WAKE)", ARG1); + PRINT( "sys__umtx_op ( %#lx, CV_MUTEX_WAKE, %ld, %#lx, %#lx)", ARG1, ARG3, ARG4, ARG5); break; default: - /* XXX: PHK ?? */ - break; + PRINT( "sys__umtx_op ( %#lx, %ld(UNKNOWN), %ld, %#lx, %#lx )", ARG1, ARG2, ARG3, ARG4, ARG5); + break; } } POST(sys__umtx_op) { + switch(ARG2) { + case VKI_UMTX_OP_LOCK: + if (SUCCESS) + POST_MEM_WRITE( ARG1, sizeof(struct vki_umtx) ); + break; + case VKI_UMTX_OP_UNLOCK: + if (SUCCESS) + POST_MEM_WRITE( ARG1, sizeof(struct vki_umtx) ); + break; + case VKI_UMTX_OP_WAIT: + case VKI_UMTX_OP_WAKE: + case VKI_UMTX_OP_WAIT_UINT: + case VKI_UMTX_OP_WAIT_UINT_PRIVATE: + case VKI_UMTX_OP_WAKE_PRIVATE: + break; + default: + break; + } } PRE(sys__umtx_lock) { PRINT( "sys__umtx_lock ( %#lx )", ARG1); + PRE_REG_READ1(long, "_umtx_lock", struct vki_umtx *, umtx); + PRE_MEM_READ( "_umtx_lock(mtx)", ARG1, sizeof(struct vki_umtx) ); + PRE_MEM_WRITE( "_umtx_lock(mtx)", ARG1, sizeof(struct vki_umtx) ); } POST(sys__umtx_lock) { + if (SUCCESS) + POST_MEM_WRITE(ARG1, sizeof(struct vki_umtx)); } PRE(sys__umtx_unlock) { PRINT( "sys__umtx_unlock ( %#lx )", ARG1); + PRE_REG_READ1(long, "_umtx_unlock", struct vki_umtx *, umtx); + PRE_MEM_READ( "_umtx_unlock(mtx)", ARG1, sizeof(struct vki_umtx) ); + PRE_MEM_WRITE( "_umtx_unlock(mtx)", ARG1, sizeof(struct vki_umtx) ); } POST(sys__umtx_unlock) { + if (SUCCESS) + POST_MEM_WRITE(ARG1, sizeof(struct vki_umtx)); } PRE(sys_rtprio_thread)