分享

Bug 638477 – Strange sound on mp3 flash websi...

 Liucw2012 2012-04-20
Linus Torvalds 2010-11-08 10:52:30 EST
So in the kernel we have a pretty strict "no regressions" rule, and that if
people depend on interfaces we exported having side effects that weren't
intentional, we try to fix things so that they still work unless there is a
major reason not to.

So I'm disappointed glibc just closes this as NOTABUG. There's no real reason
to do the copy backwards that I can see, so doing it that way is just stupid.

But whatever. You can do a LD_PRELOAD trick to get a sane memcpy(), and it does
indeed fix the sound for me. Just do something like this:

    prompt$ cat > mymemcpy.c
    #include <sys/types.h>

    void *memcpy(void *dst, const void *src, size_t size)
    {
 void *orig = dst;
 asm volatile("rep ; movsq"
  :"=D" (dst), "=S" (src)
  :"0" (dst), "1" (src), "c" (size >> 3)
  :"memory");
 asm volatile("rep ; movsb"
  :"=D" (dst), "=S" (src)
  :"0" (dst), "1" (src), "c" (size & 7)
  :"memory");
 return orig;
    }
    ^D
    prompt$ gcc -O2 -c mymemcpy.c
    prompt$ ld -G mymemcpy.o -o mymemcpy.so
    prompt$ LD_PRELOAD mymemcpy.so /opt/google/chrome/google-chrome &

and it does seem to work. Not a lot of testing, but at least TED-talks work for
me again (and I tested the Daughtry thing too, although I am not convinced it
sounds all that much better without the sound corruption).

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多