On Fri, Oct 15, 2010 at 12:40 AM, Christian Ebert <blacktr...@gmx.net>wrote:
> * Trent Piepho on Thursday, October 14, 2010 at 17:38:39 -0700
> > On Thu, Oct 14, 2010 at 2:43 PM, Christian Ebert <blacktr...@gmx.net>
> wrote:
> >>>>
> >>>> Easy fix would just be the change the sse detection asm to save and
> >>>> restore ebx.
> >>>>
> >>>> __asm__ volatile("pushl %%ebx ; cpuid ; popl %%ebx" : "=d"(d) : "a"(1)
> :
> >>>> "ecx");
> >>>>
> >>>> or better
> >>>>
> >>>> uint32_t tmp;
> >>>> __asm__ volatile("movl %%ebx, %1; cpuid; movl %1, %%ebx" : "=d"(d),
> >>>> "=&g"(tmp) : "a"(1) : "ecx");
> >>>>
> >>>> The latter is safer in general, as you can't use push or pop around
> any
> >>>> asm code that has a parameter with a constraint that allows memory
> >>>> references. The memory reference might be relative to esp, in which
> >>>> case the push/pop would move it. Or it might not be relative to esp,
> in
> >>>> which case the push/pop doesn't move it. So there's no way to adjust
> >>>> for it.
> >>> I tested your better version. And it compiles here on my linux and
> Intel
> >>> osx box. I did also a quick test with the new version on the linux box.
> >>> And it works well.
> >>>
> >>> So I would appreciate a feedback if it works on a mac.
> >>
> >> Thanks for looking into this, but I get:
> >>
> >> gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../utils -O3 -funroll-all-loops
> >> -ffast-math -march=nocona -mtune=nocona -g -O2 -I/sw/include
> -no-cpp-precomp
> >> -D_THREAD_SAFE -Wall -Wunused -MT main.o -MD -MP -MF .deps/main.Tpo -c
> -o
> >> main.o main.c
> >> main.c: In function ‘main’:
> >> main.c:1339: error: PIC register ‘ebx’ clobbered in ‘asm’
> >> make: *** [main.o] Error 1
> >
> > Looks like you didn't actually change the needed lines.
>
> No, I didn't but Bernhard did:
> +
> #if defined(__SSE2__)
> int d = 0;
> - __asm__ volatile("cpuid" : "=d"(d) : "a"(1) : "ebx", "ecx");
> +/* __asm__ volatile("cpuid" : "=d"(d) : "a"(1) : "ebx", "ecx"); */
> + __asm__ volatile("movl %%ebx, %1; cpuid; movl %1, %%ebx" : "=d"(d),
> "=&g"(tmp) : "a"(1) : "ecx");
> if ((d & (1 << 26))) {
> mjpeg_info("SETTING SSE2 for standard
> Temporal-Noise-Filter");
> temporal_filter_planes = temporal_filter_planes_sse2;
>
The second cpuid call below this one needs to be fixed as well.
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users