[PATCH 2/4] include: Implement __stosb compiler intrinsic.

Zebediah Figura zfigura at codeweavers.com
Mon Sep 13 11:42:49 CDT 2021


On 9/13/21 10:25 AM, Rémi Bernon wrote:
> On 9/13/21 4:51 PM, Piotr Caban wrote:
>> Hi Rémi,
>>
>> On 9/13/21 2:23 PM, Rémi Bernon wrote:
>>> +static inline void __stosb(unsigned char* dst, unsigned char c,
>>> size_t n)
>>> +{
>>> +    __asm__ __volatile__ ("cld; rep; stosb" : "=D"(dst) : "a"(c),
>>> "D"(dst), "c"(n) : "memory", "cc");
>>> +}
>> I don't know if it's important here but Microsoft's i386 cdecl abi
>> specifies direction flag value on function call. Maybe if __cdecl is
>> added cld call may be removed.
>>
> 
> All the ABIs are apparently requiring it to be cleared before a function
> call, or am I missing something? So it looks like it's not needed
> anywhere and I was just over cautious.
> 

Well, ABIs do, but you're not defining that as an asm function; you're 
using inline assembly. So you can't guarantee anything.



More information about the wine-devel mailing list