>-----Original Message-----
>From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
>On Behalf Of
>Reimar D?ffinger
>Sent: Sunday, July 28, 2019 6:37 AM
>To: FFmpeg development discussions and patches
>Subject: Re: [FFmpeg-devel] [PATCH v3] avutil/mips: Avoid instruction 
>exception caused by gssqc1/gslqc1.
>
>On 26.07.2019, at 07:18, Shiyou Yin <yinshiyou...@loongson.cn> wrote:
>
>> Ensure the address accesed by gssqc1/gslqc1 are 16-bits memory-aligned.
>
>Looks good to me if standard DECLARE_ALIGNED should work for stack on MIPS.
>(on x86 it used to be possible for the stack pointer to only be 8-byte 
>aligned, in which case
>DECLARE_ALIGNED could not actually provide 16-byte aligned stack variables, so 
>there were special
>macros - I have not checked how it works nowadays or if MIPS has that issue).
>Well, I guess regardless of that, this is better than before, so should be 
>fine to apply either way.
>
DECLARE_ALIGNED is defined in ' libavutil/mem.h ' and related to compiler. No 
matter mips or x86,
it's definition is ' #define DECLARE_ALIGNED(n,t,v)      t __attribute__ 
((aligned (n))) v' when build 
with gcc or clang (Specific implementation within the compiler is not 
considered here.).
In libavcodec/x86, DECLARE_ALIGNED is used to define 8/16/32-byte aligned 
variable too.

Here is a test on mips.
1) Defined variable with 'double temp[8];', and compiled with 'gcc 
-fstack-protector-all'.
In this case, address of temp is not 16-byte aligned and gssqc1/gslqc1 caused 
instruction exception. 
2) Replacing ' double temp[8];' with ' double __attribute__((aligned(16))) 
__back_temp[8];'.
Address of temp is 16-byte aligned and gssqc1/gslqc1 works properly.

There is a typo in the commit message and have revised in v4. Please help to 
apply.


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to