[Ffmpeg-devel] [RFC] Addition of JIT accelerated scaler for ARM into libswscale

Siarhei Siamashka siarhei.siamashka
Wed Jan 24 22:10:59 CET 2007

On Wednesday 24 January 2007 01:31, Michael Niedermayer wrote:

> > It would be reasonable to assume that when we do mmap to request an
> > executable block of memory, instructions cache would be already flushed
> > for this area. But unfortunately there seem to be some issues because of
> > probably some bugs:
> > http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2006-January/033
> >367.html
> >
> > So all there mprotect calls in my code are done in order to ensure that
> > cache flushing works correctly. So we do:
> > * mmap some memory block with permission to execute code from it
> > * generate a simple code for function that should return 0
> > * call this code and check that it really returned 0
> > * do mprotect to disable and reenable code execution (and hope that it
> > does cache flush)
> > * generate a simple code  for function that should return 1
> > * call this code and check that it really returned 1 (without mprotect
> > calls it would still return 0)
> i do not like this redundant mess, especially because a simple task switch
> at the right moment will make it look as if everything is ok

Yes, I don't like it either. I did not have much time to investigate this
issue more thoroughfully yet. I'll try to have something more feature
complete and clean done on the next weekend.

Maybe it would be enough to mmap memory with just write access first 
and do mprotect after code generation is done to remove write and set execute
permission as Reimar suggested. And hope that the implementation of 
these functions is bug free on target system (at least it seems to be ok on
Nokia 770). Anyway, some people do use JIT on ARM, looking for more 
information may result in finding the best solution.

Thanks a lot for feedback and useful information. I will try to come up with a
clean and usable patch for ffmpeg/libswscale soon.

More information about the ffmpeg-devel mailing list