Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Mar 2008 22:04:50 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 138560 for review
Message-ID:  <200803252204.m2PM4ola013711@repoman.freebsd.org>

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

Change 138560 by jb@jb_freebsd1 on 2008/03/25 22:03:59

	This file is i386-specific so remove #ifdefs and non-i386 code.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_isa.c#9 edit

Differences ...

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

@@ -44,11 +44,6 @@
 #define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK && \
 	 ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS)
 
-struct frame {
-	greg_t	fr_savfp;		/* saved frame pointer */
-	greg_t	fr_savpc;		/* saved program counter */
-};
-
 uint8_t dtrace_fuword8_nocheck(void *);
 uint16_t dtrace_fuword16_nocheck(void *);
 uint32_t dtrace_fuword32_nocheck(void *);
@@ -350,27 +345,20 @@
 	while (pcstack_limit-- > 0)
 		*pcstack++ = NULL;
 }
+#endif
 
 uint64_t
 dtrace_getarg(int arg, int aframes)
 {
 	uintptr_t val;
-	struct frame *fp = (struct frame *)dtrace_getfp();
+	struct i386_frame *fp = (struct i386_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 frame *)(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
@@ -380,30 +368,6 @@
 			 * 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
-			 * beyond the frame structure, and then again beyond
-			 * the calling RIP stored in dtrace_invop().  If the
-			 * argument that we're seeking is passed on the stack,
-			 * we'll pull the true stack pointer out of the saved
-			 * registers and decrement our argument by the number
-			 * of arguments passed in registers; if the argument
-			 * we're seeking is passed in regsiters, we can just
-			 * load it directly.
-			 */
-			struct regs *rp = (struct regs *)((uintptr_t)&fp[1] +
-			    sizeof (uintptr_t));
-
-			if (arg <= inreg) {
-				stack = (uintptr_t *)&rp->r_rdi;
-			} else {
-				stack = (uintptr_t *)(rp->r_rsp);
-				arg -= inreg;
-			}
-#endif
 			goto load;
 		}
 
@@ -419,19 +383,6 @@
 	 */
 	arg++;
 
-#if defined(__amd64)
-	if (arg <= inreg) {
-		/*
-		 * This shouldn't happen.  If the argument is passed in a
-		 * register then it should have been, well, passed in a
-		 * register...
-		 */
-		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
-		return (0);
-	}
-
-	arg -= (inreg + 1);
-#endif
 	stack = (uintptr_t *)&fp[1];
 
 load:
@@ -441,14 +392,13 @@
 
 	return (val);
 }
-#endif
 
 int
 dtrace_getstackdepth(int aframes)
 {
 	int depth = 0;
 	struct i386_frame *frame;
-	vm_offset_t rbp;
+	vm_offset_t ebp;
 
 	aframes++;
 	ebp = dtrace_getfp();



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