PERFORCE change 138559 for review

John Birrell jb at FreeBSD.org
Tue Mar 25 22:03:50 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=138559

Change 138559 by jb at jb_freebsd1 on 2008/03/25 22:03:09

	This file is amd64-specfic, so remove #ifdefs and non-amd64 code
	to clean it up.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/amd64/dtrace_isa.c#6 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/amd64/dtrace_isa.c#6 (text+ko) ====

@@ -33,6 +33,7 @@
 
 #include <machine/frame.h>
 #include <machine/md_var.h>
+#include <machine/reg.h>
 #include <machine/stack.h>
 
 #include <vm/vm.h>
@@ -302,39 +303,28 @@
 	while (pcstack_limit-- > 0)
 		*pcstack++ = NULL;
 }
+#endif
 
 /*ARGSUSED*/
 uint64_t
 dtrace_getarg(int arg, int aframes)
 {
 	uintptr_t val;
-	struct xframe *fp = (struct xframe *)dtrace_getfp();
+	struct amd64_frame *fp = (struct amd64_frame *)dtrace_getfp();
 	uintptr_t *stack;
 	int i;
-#if defined(__amd64)
+
 	/*
 	 * A total of 6 arguments are passed via registers; any argument with
 	 * index of 5 or lower is therefore in a register.
 	 */
 	int inreg = 5;
-#endif
 
 	for (i = 1; i <= aframes; i++) {
-		fp = (struct xframe *)(fp->fr_savfp);
+		fp = fp->f_frame;
 
-		if (fp->fr_savpc == (pc_t)dtrace_invop_callsite) {
-#if !defined(__amd64)
+		if (fp->f_retaddr == (long)dtrace_invop_callsite) {
 			/*
-			 * If we pass through the invalid op handler, we will
-			 * use the pointer that it passed to the stack as the
-			 * second argument to dtrace_invop() as the pointer to
-			 * the stack.  When using this stack, we must step
-			 * beyond the EIP/RIP that was pushed when the trap was
-			 * taken -- hence the "+ 1" below.
-			 */
-			stack = ((uintptr_t **)&fp[1])[1] + 1;
-#else
-			/*
 			 * In the case of amd64, we will use the pointer to the
 			 * regs structure that was pushed when we took the
 			 * trap.  To get this structure, we must increment
@@ -347,7 +337,7 @@
 			 * we're seeking is passed in regsiters, we can just
 			 * load it directly.
 			 */
-			struct regs *rp = (struct regs *)((uintptr_t)&fp[1] +
+			struct reg *rp = (struct reg *)((uintptr_t)&fp[1] +
 			    sizeof (uintptr_t));
 
 			if (arg <= inreg) {
@@ -356,7 +346,6 @@
 				stack = (uintptr_t *)(rp->r_rsp);
 				arg -= inreg;
 			}
-#endif
 			goto load;
 		}
 
@@ -372,7 +361,6 @@
 	 */
 	arg++;
 
-#if defined(__amd64)
 	if (arg <= inreg) {
 		/*
 		 * This shouldn't happen.  If the argument is passed in a
@@ -384,7 +372,6 @@
 	}
 
 	arg -= (inreg + 1);
-#endif
 	stack = (uintptr_t *)&fp[1];
 
 load:
@@ -395,9 +382,7 @@
 	return (val);
 	return (0);
 }
-#endif
 
-/*ARGSUSED*/
 int
 dtrace_getstackdepth(int aframes)
 {


More information about the p4-projects mailing list