On 11.09.19 23:52, Richard Henderson wrote:
> On 9/6/19 3:57 AM, David Hildenbrand wrote:
>> +    /*
>> +     * Our access should not exceed single pages, as we must not report 
>> access
>> +     * exceptions exceeding the actually copied range (which we don't know 
>> at
>> +     * this point). We might over-indicate watchpoints within the pages
>> +     * (if we ever care, we have to limit processing to a single byte).
>> +     */
>> +    srca = access_prepare(env, s, len, MMU_DATA_LOAD, ra);
>> +    desta = access_prepare(env, d, len, MMU_DATA_STORE, ra);
>> +    for (i = 0; i < len; i++) {
>> +        const uint8_t v = access_get_byte(env, &srca, i, ra);
>> +
>> +        access_set_byte(env, &desta, i, v, ra);
>>          if (v == c) {
>> -            set_address_zero(env, r1, d + len);
>> +            set_address_zero(env, r1, d + i);
>>              return 1;
>>          }
> 
> Worth using memchr + memmove w/ nondestructive overlap?

In theory yes, however, the issue is that we would have multiple
accesses, which is not documented for this instruction. In case the
memory is modified between memchr + memmove by another CPU, we could
have an inconsistent instruction result. Unlikely but possible :)

> 
> That said,
> Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
> 
> r~
> 


-- 

Thanks,

David / dhildenb

Reply via email to