Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Feb 2008 20:52:52 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135404 for review
Message-ID:  <200802142052.m1EKqq60032671@repoman.freebsd.org>

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

Change 135404 by jb@jb_freebsd1 on 2008/02/14 20:52:23

	WIP to implement the printt() action.

Affected files ...

.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/dtrace/dtrace.c#39 edit

Differences ...

==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/dtrace/dtrace.c#39 (text) ====

@@ -4513,7 +4513,7 @@
 		uintptr_t *typeref = (uintptr_t *) P2ROUNDUP(mstate->dtms_scratch_ptr, sizeof(uintptr_t));
 		size_t scratch_size = ((uintptr_t) typeref - mstate->dtms_scratch_ptr) + size;
 
-		/* type, length and address */
+		/* address, length, type */
 		typeref[0] = tupregs[0].dttk_value;
 		typeref[1] = tupregs[1].dttk_value;
 		typeref[2] = tupregs[2].dttk_value;
@@ -6064,6 +6064,43 @@
 				break;
 			}
 
+			case DTRACEACT_PRINTT: {
+				/* The DIF returns a 'typeref'. */
+				uintptr_t *typeref = (uintptr_t *)(uintptr_t) val;
+
+				/* Get the size from the typeref. */
+				size = typeref[1];
+
+				/*
+				 * Check if the size exceeds the allocated
+				 * buffer size.
+				 */
+				if (size + sizeof(uintptr_t) > dp->dtdo_rtype.dtdt_size) {
+					/* Flag a drop! */
+					*flags |= CPU_DTRACE_DROP;
+					continue;
+				}
+
+				/* Store the size in the buffer first. */
+				DTRACE_STORE(uintptr_t, tomax,
+				    valoffs, size);
+
+				/*
+				 * Offset the buffer address to the start
+				 * of the data.
+				 */
+				valoffs += sizeof(uintptr_t);
+
+				/*
+				 * Reset to the memory address rather than
+				 * the typeref array, then let the BYREF
+				 * code below do the work to store the 
+				 * memory data in the buffer.
+				 */
+				val = typeref[0];
+				break;
+			}
+
 			case DTRACEACT_CHILL:
 				if (dtrace_priv_kernel_destructive(state))
 					dtrace_action_chill(&mstate, val);
@@ -9860,6 +9897,10 @@
 		    	size = dp->dtdo_rtype.dtdt_size;
 			break;
 
+		case DTRACEACT_PRINTT:
+		    	size = dp->dtdo_rtype.dtdt_size;
+			break;
+
 		case DTRACEACT_COMMIT: {
 			dtrace_action_t *act = ecb->dte_action;
 



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