From owner-p4-projects@FreeBSD.ORG Tue Mar 25 22:04:51 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5FD21106567C; Tue, 25 Mar 2008 22:04:51 +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 04D411065675 for ; Tue, 25 Mar 2008 22:04:51 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D56E88FC1B for ; Tue, 25 Mar 2008 22:04:50 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m2PM4oSZ013713 for ; Tue, 25 Mar 2008 22:04:50 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m2PM4ola013711 for perforce@freebsd.org; Tue, 25 Mar 2008 22:04:50 GMT (envelope-from jb@freebsd.org) Date: Tue, 25 Mar 2008 22:04:50 GMT Message-Id: <200803252204.m2PM4ola013711@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 138560 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: Tue, 25 Mar 2008 22:04:52 -0000 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();