Date: Fri, 24 Oct 2014 03:33:01 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273570 - head/sys/cddl/dev/fbt/powerpc Message-ID: <201410240333.s9O3X1GA046067@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Fri Oct 24 03:33:01 2014 New Revision: 273570 URL: https://svnweb.freebsd.org/changeset/base/273570 Log: Three updates to PowerPC FBT: * Use a constant to define the number of stack frames in a probe exception. * Only allow function symbols in powerpc64 ('.' prefixed) * Set the fbtp_roffset for return probes, so the correct dtrace_probe call is made. MFC after: 1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Thu Oct 23 23:20:04 2014 (r273569) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) @@ -48,6 +48,7 @@ #define FBT_ENTRY "entry" #define FBT_RETURN "return" +#define FBT_AFRAMES 7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) @@ -116,9 +117,17 @@ fbt_provide_module_function(linker_file_ int j; uint32_t *instr, *limit; - /* PowerPC64 uses '.' prefixes on symbol names, ignore it. */ +#ifdef __powerpc64__ + /* + * PowerPC64 uses '.' prefixes on symbol names, ignore it, but only + * allow symbols with the '.' prefix, so that we don't get the function + * descriptor instead. + */ if (name[0] == '.') name++; + else + return (0); +#endif if (strncmp(name, "dtrace_", 7) == 0 && strncmp(name, "dtrace_safe_", 12) != 0) { @@ -147,7 +156,7 @@ fbt_provide_module_function(linker_file_ fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 7, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; @@ -210,7 +219,7 @@ again: if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 7, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_next = fbt; fbt->fbtp_id = retfbt->fbtp_id; @@ -229,6 +238,9 @@ again: else fbt->fbtp_rval = DTRACE_INVOP_JUMP; + fbt->fbtp_roffset = + (uintptr_t)((uint8_t *)instr - (uint8_t *)symval->value); + fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410240333.s9O3X1GA046067>