Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2007 21:43:14 GMT
From:      Poul-Henning Kamp <phk@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 125157 for review
Message-ID:  <200708142143.l7ELhEvo003384@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125157

Change 125157 by phk@phk_critter on 2007/08/14 21:42:21

	
	install handler for sigaction6 (seems to work)
	start implementing _umtx_op

Affected files ...

.. //depot/projects/valgrind/coregrind/m_syswrap/priv_syswrap-freebsd.h#4 edit
.. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd-variants.c#2 edit
.. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#5 edit
.. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-x86-freebsd.c#5 edit
.. //depot/projects/valgrind/include/vki-freebsd.h#3 edit

Differences ...

==== //depot/projects/valgrind/coregrind/m_syswrap/priv_syswrap-freebsd.h#4 (text+ko) ====

@@ -220,6 +220,7 @@
 DECL_TEMPLATE(freebsd, sys_ftruncate7);
 DECL_TEMPLATE(freebsd, sys_pread7);
 DECL_TEMPLATE(freebsd, sys_pwrite7);
+DECL_TEMPLATE(freebsd, sys__umtx_op);
 #endif   // __PRIV_SYSWRAP_FREEBSD_H
 
 /*--------------------------------------------------------------------*/

==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd-variants.c#2 (text+ko) ====


==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#5 (text+ko) ====

@@ -1745,6 +1745,62 @@
    PRE_MEM_RASCIIZ( "sys_thr_set_name(threadname)", ARG2);
 }
 
+/* ---------------------------------------------------------------------
+   umtx* wrappers
+   ------------------------------------------------------------------ */
+
+PRE(sys__umtx_op)
+{
+   switch(ARG2) {
+   case VKI_UMTX_OP_LOCK:
+      PRINT( "sys__umtx_op ( %p, LOCK, %d, %p, %p)", ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_UNLOCK:
+      PRINT( "sys__umtx_op ( %p, UNLOCK, %d, %p, %p)", ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_WAIT:
+      PRINT( "sys__umtx_op ( %p, WAIT, %d, %p, %p)", ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_WAKE:
+      PRINT( "sys__umtx_op ( %p, WAKE, %d, %p, %p)", ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_MUTEX_TRYLOCK:
+      PRINT( "sys__umtx_op ( %p, MUTEX_TRYLOCK, %d, %p, %p)",
+	 ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_MUTEX_LOCK:
+      PRINT( "sys__umtx_op ( %p, MUTEX_LOCK, %d, %p, %p)",
+	 ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_MUTEX_UNLOCK:
+      PRINT( "sys__umtx_op ( %p, MUTEX_UNLOCK, %d, %p, %p)",
+	 ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_SET_CEILING:
+      PRINT( "sys__umtx_op ( %p, SET_CEILING, %d, %p, %p)",
+	 ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_CV_WAIT:
+      PRINT( "sys__umtx_op ( %p, CV_WAIT, %d, %p, %p)", ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_CV_SIGNAL:
+      PRINT( "sys__umtx_op ( %p, CV_SIGNAL, %d, %p, %p)",
+	 ARG1, ARG3, ARG4, ARG5);
+      break;
+   case VKI_UMTX_OP_CV_BROADCAST:
+      PRINT( "sys__umtx_op ( %p, CV_BROADCAST, %d, %p, %p)",
+	 ARG1, ARG3, ARG4, ARG5);
+      break;
+   default:
+	/* XXX: PHK ?? */
+	break;
+   }
+}
+
+POST(sys__umtx_op)
+{
+}
+
 PRE(sys_rtprio_thread)
 {
    PRINT( "sys_rtprio_thread ( %d, %d, %p )", ARG1, ARG2, ARG3 );
@@ -2650,6 +2706,11 @@
    // __mac_execve							   415
 
    //!sigaction								   416
+/*
+ * XXX: not sure what peter indicates with the '!'
+ * but this call below seems to work /phk
+ */
+   BSDXY(__NR_sigaction6,		sys_sigaction6),		// 416
    //!sigreturn								   417
    // __xstat								   418
    // __xfstat								   419
@@ -2696,7 +2757,7 @@
 
    // setaudit_addr							   452
    // auditctl								   453
-   // _umtx_op								   454
+   BSDXY(__NR__umtx_op,			sys__umtx_op),			// 454
    // thr_new								   455
 
    // sigqueue								   456

==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-x86-freebsd.c#5 (text+ko) ====

@@ -523,7 +523,7 @@
 
       /* On FreeBSD, the syscall loads the %gs selector for us, so do it now. */
       tst = VG_(get_ThreadState)(tid);
-      p = ARG2;
+      p = (void**)ARG2;
       tst->arch.vex.guest_GS = (2 << 3) | 3;	/* GSEL(GUGS_SEL, SEL_UPL) */
       /* "do" the syscall ourselves; the kernel never sees it */
       SET_STATUS_from_SysRes( sys_set_thread_area( tid, 2, *p ) );

==== //depot/projects/valgrind/include/vki-freebsd.h#3 (text+ko) ====

@@ -1670,6 +1670,28 @@
 #define VKI_RTP_LOOKUP	0
 #define VKI_RTP_SET	1
 
+//----------------------------------------------------------------------
+// From sys/umtx.h
+//----------------------------------------------------------------------
+
+struct vki_umtx {
+	unsigned long	u_owner;
+};
+
+#define	VKI_UMTX_OP_LOCK		0
+#define	VKI_UMTX_OP_UNLOCK		1
+#define	VKI_UMTX_OP_WAIT		2
+#define	VKI_UMTX_OP_WAKE		3
+#define	VKI_UMTX_OP_MUTEX_TRYLOCK	4
+#define	VKI_UMTX_OP_MUTEX_LOCK		5
+#define	VKI_UMTX_OP_MUTEX_UNLOCK	6
+#define	VKI_UMTX_OP_SET_CEILING		7
+#define	VKI_UMTX_OP_CV_WAIT		8
+#define	VKI_UMTX_OP_CV_SIGNAL		9
+#define	VKI_UMTX_OP_CV_BROADCAST	10
+#define	VKI_UMTX_OP_MAX			11
+
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708142143.l7ELhEvo003384>