Author: ssp Date: Sat Feb 16 15:54:40 2008 New Revision: 396 URL: http://svn.gnome.org/viewvc/sysprof?rev=396&view=rev
Log: 2008-02-16 Soren Sandmann <[EMAIL PROTECTED]> * module/sysprof-module.c (nt_memcpy): Add a memcpy() that uses nontemporal writes. (copy_kernel_stack): Add commented-out use of it here. Modified: trunk/ChangeLog trunk/module/sysprof-module.c Modified: trunk/module/sysprof-module.c ============================================================================== --- trunk/module/sysprof-module.c (original) +++ trunk/module/sysprof-module.c Sat Feb 16 15:54:40 2008 @@ -112,6 +112,38 @@ return a > b ? b : a; } +static void +nt_memcpy (void *dst, void *src, int n_bytes) +{ +#if defined(CONFIG_X86_64) || defined(CONFIG_X86) + if (((unsigned long)dst & 3) || + ((unsigned long)src & 3)) { + memcpy (dst, src, n_bytes); + } + else { + int i; + if ((unsigned long)src & 7) { + *(uint32_t *)dst = *(uint32_t *)src; + src += 4; + dst += 4; + } + + for (i = 0; i < n_bytes; i += 8) { + __asm__ __volatile__ ( + " movq (%0, %2), %%mm0\n" + " movntq %%mm0, (%1, %2)\n" + : + : "r" (src), "r" (dst), "r" (i) + : "memory"); + } + __asm__ __volatile__ ( + "emms\n"); + } +#else + memcpy (dst, src, n_bytes); +#endif +} + static struct pt_regs * copy_kernel_stack (struct pt_regs *regs, SysprofStackTrace *trace) @@ -137,6 +169,9 @@ sizeof (trace->kernel_stack)); if (n_bytes > 0) { +#if 0 + nt_memcpy (&(trace->kernel_stack[1]), esp, n_bytes); +#endif memcpy (&(trace->kernel_stack[1]), esp, n_bytes); trace->n_kernel_words += (n_bytes) / sizeof (void *); @@ -203,7 +238,7 @@ if (vma && vma->vm_flags & VM_EXEC) if (vma->vm_start <= x && x <= vma->vm_end) - trace->addresses[j++] = x; + trace->addresses[j++] = (void *)x; } #if 0 _______________________________________________ SVN-commits-list mailing list (read only) http://mail.gnome.org/mailman/listinfo/svn-commits-list Want to limit the commits to a few modules? Go to above URL, log in to edit your options and select the modules ('topics') you want. Module maintainer? It is possible to set the reply-to to your development mailing list. Email [EMAIL PROTECTED] if interested.