From owner-p4-projects@FreeBSD.ORG Fri Jun 2 06:42:35 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BC4B616ABF9; Fri, 2 Jun 2006 06:42:35 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8176F16A936 for ; Fri, 2 Jun 2006 06:42:35 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 45B5D43D45 for ; Fri, 2 Jun 2006 06:42:35 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k526f5bq045053 for ; Fri, 2 Jun 2006 06:41:05 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k526f5nB045050 for perforce@freebsd.org; Fri, 2 Jun 2006 06:41:05 GMT (envelope-from jb@freebsd.org) Date: Fri, 2 Jun 2006 06:41:05 GMT Message-Id: <200606020641.k526f5nB045050@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 98315 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: Fri, 02 Jun 2006 06:42:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=98315 Change 98315 by jb@jb_freebsd2 on 2006/06/02 06:40:23 Reference kernbase as it is initialised on FreeBSD. Use 'curcpu' directly to get the CPU number rather than some obscure compatibility hack. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_isa.c#2 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_isa.c#2 (text+ko) ==== @@ -47,16 +47,24 @@ extern uintptr_t kernelbase; #else +extern uintptr_t kernbase; +uintptr_t kernelbase = (uintptr_t) &kernbase; struct frame { greg_t fr_savfp; /* saved frame pointer */ greg_t fr_savpc; /* saved program counter */ }; #endif +uint8_t dtrace_fuword8_nocheck(void *); +uint16_t dtrace_fuword16_nocheck(void *); +uint32_t dtrace_fuword32_nocheck(void *); +uint64_t dtrace_fuword64_nocheck(void *); + void dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, uint32_t *intrpc) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD struct frame *fp = (struct frame *)dtrace_getfp(); struct frame *nextfp, *minfp, *stacktop; @@ -130,12 +138,13 @@ dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, uintptr_t sp) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD klwp_t *lwp = ttolwp(curthread); proc_t *p = curproc; uintptr_t oldcontext = lwp->lwp_oldcontext; volatile uint16_t *flags = - (volatile uint16_t *)&cpu_core[CPU->cpu_id].cpuc_dtrace_flags; + (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; size_t s1, s2; int ret = 0; @@ -210,13 +219,14 @@ void dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD klwp_t *lwp = ttolwp(curthread); proc_t *p = curproc; struct regs *rp; uintptr_t pc, sp; volatile uint16_t *flags = - (volatile uint16_t *)&cpu_core[CPU->cpu_id].cpuc_dtrace_flags; + (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; int n; if (*flags & CPU_DTRACE_FAULT) @@ -268,6 +278,7 @@ int dtrace_getustackdepth(void) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD klwp_t *lwp = ttolwp(curthread); proc_t *p = curproc; @@ -304,13 +315,14 @@ void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD klwp_t *lwp = ttolwp(curthread); proc_t *p = curproc; struct regs *rp; uintptr_t pc, sp, oldcontext; volatile uint16_t *flags = - (volatile uint16_t *)&cpu_core[CPU->cpu_id].cpuc_dtrace_flags; + (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; size_t s1, s2; if (*flags & CPU_DTRACE_FAULT) @@ -416,7 +428,6 @@ uint64_t dtrace_getarg(int arg, int aframes) { -#ifdef DOODAD uintptr_t val; struct frame *fp = (struct frame *)dtrace_getfp(); uintptr_t *stack; @@ -503,15 +514,13 @@ DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); return (val); -#else -return 0; -#endif } /*ARGSUSED*/ int dtrace_getstackdepth(int aframes) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD struct frame *fp = (struct frame *)dtrace_getfp(); struct frame *nextfp, *minfp, *stacktop; @@ -560,6 +569,7 @@ ulong_t dtrace_getreg(struct regs *rp, uint_t reg) { +printf("%s:\n",__FUNCTION__); #ifdef DOODAD #if defined(__amd64) int regmap[] = { @@ -669,16 +679,14 @@ static int dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) { -#ifdef DOODAD ASSERT(kaddr >= kernelbase && kaddr + size >= kaddr); if (uaddr + size >= kernelbase || uaddr + size < uaddr) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[CPU->cpu_id].cpuc_dtrace_illval = uaddr; + cpu_core[curcpu].cpuc_dtrace_illval = uaddr; return (0); } -#endif return (1); } @@ -713,59 +721,43 @@ uint8_t dtrace_fuword8(void *uaddr) { -#ifdef DOODAD - extern uint8_t dtrace_fuword8_nocheck(void *); - if ((uintptr_t)uaddr >= _userlimit) { + if ((uintptr_t)uaddr >= kernelbase) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr; + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); } return (dtrace_fuword8_nocheck(uaddr)); -#endif - return 0; } uint16_t dtrace_fuword16(void *uaddr) { -#ifdef DOODAD - extern uint16_t dtrace_fuword16_nocheck(void *); - if ((uintptr_t)uaddr >= _userlimit) { + if ((uintptr_t)uaddr >= kernelbase) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr; + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); } return (dtrace_fuword16_nocheck(uaddr)); -#endif - return 0; } uint32_t dtrace_fuword32(void *uaddr) { -#ifdef DOODAD - extern uint32_t dtrace_fuword32_nocheck(void *); - if ((uintptr_t)uaddr >= _userlimit) { + if ((uintptr_t)uaddr >= kernelbase) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr; + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); } return (dtrace_fuword32_nocheck(uaddr)); -#endif - return 0; } uint64_t dtrace_fuword64(void *uaddr) { -#ifdef DOODAD - extern uint64_t dtrace_fuword64_nocheck(void *); - if ((uintptr_t)uaddr >= _userlimit) { + if ((uintptr_t)uaddr >= kernelbase) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr; + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); } return (dtrace_fuword64_nocheck(uaddr)); -#endif - return 0; }