Dan Kegel <[email protected]> writes:

> @@ -41,6 +42,80 @@ double CDECL omp_get_wtime(void)
>      return GetTickCount() / 1000.0;
>  }
>  
> +/* Call helper with the ncount args after ncount */
> +extern void WINAPIV _vcomp_fork(DWORD parallel, int ncount, void *helper, 
> ...);
> +#ifdef __i386__
> +__ASM_GLOBAL_FUNC( _vcomp_fork,
> +                   "push %ebp\n\t"
> +                   "movl %esp,%ebp\n\t"
> +
> +                   /* Push varargs */
> +                   "movl 12(%ebp),%ecx\n\t" /* if (nargs > 0) */
> +                   "test %ecx,%ecx\n\t"
> +                   "jz copyend\n\t"
> +                   "leal 20(%ebp),%edx\n\t"      /* dx -> first vararg */
> +                   "leal (%edx,%ecx,4),%edx\n\t" /* dx += nargs * sizeof arg 
> */
> +                   "copyloop:\n\t"               /* while (nargs-- > 0) */
> +                   "sub $4,%edx\n\t"
> +                   "pushl (%edx)\n\t"                /* push next vararg */
> +                   "dec %ecx\n\t"
> +                   "jnz copyloop\n\t"
> +                   "copyend:\n\t"
> +
> +                   /* Call helper and return */
> +                   "call *16(%ebp)\n\t"
> +                   "movl %ebp,%esp\n\t"
> +                   "pop %ebp\n\t"
> +                   "ret\n\t"
> +                 )
> +#endif

There are several places that already implement that sort of thing the
right way, you should copy one of them instead of reinventing the wheel.

-- 
Alexandre Julliard
[email protected]


Reply via email to