Date: Fri, 2 Jun 2006 06:41:05 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 98315 for review Message-ID: <200606020641.k526f5nB045050@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606020641.k526f5nB045050>