[FFmpeg-devel] lurking bugs in the mmx-related assembler code (?)

u-h8zb at aetey.se u-h8zb at aetey.se
Sun Oct 2 09:17:42 EEST 2016


Hello Henrik,

On Sun, Oct 02, 2016 at 01:18:29AM +0200, Henrik Gramner wrote:
> Ensuring that emms is issued before every single libc function call is
> likely problematic.
> 
> What if we simply document the requirement that C standard library
> functions are assumed to not modify the x87 FPU state unless
> specifically designated to handle floating-point numbers?

Is it remarkably expensive to reset the FPU state? (I am unsure
also how much of the assembler code depends on clobbering it?)
If yes, then such documentation would be a reasonable approach.

This may be a practical problem (say, for distros using musl or
another libc which makes use of floats) or may be not, but as long as
it is documented it is not a bug.

OTOH calling the C library involves already a cost of many cycles in the very
best case. Calling malloc() entails presumably a way higher cost than emms,
so why do you think the impact would be noticeable?

Regards,
Rune



More information about the ffmpeg-devel mailing list