On 28.08.19 23:28, Richard Henderson wrote:
> On 8/26/19 1:41 AM, David Hildenbrand wrote:
>>> -    /* Make accesses to pages with watchpoints go via the
>>> -       watchpoint trap routines.  */
>>> -    QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
>>> -        if (cpu_watchpoint_address_matches(wp, vaddr, TARGET_PAGE_SIZE)) {
>>> -            /* Avoid trapping reads of pages with a write breakpoint. */
>>> -            if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
>>> -                iotlb = PHYS_SECTION_WATCH + paddr;
>>> -                *address |= TLB_MMIO;
>>> -                break;
>> In the old code, we were able to break once we found a hit ...
>>
>>> -            }
>>> -        }
>>> +    /* Avoid trapping reads of pages with a write breakpoint. */
>>> +    match = (prot & PAGE_READ ? BP_MEM_READ : 0)
>>> +          | (prot & PAGE_WRITE ? BP_MEM_WRITE : 0);
>>> +    flags = cpu_watchpoint_address_matches(cpu, vaddr, TARGET_PAGE_SIZE);
>>> +    if (flags & match) {
>> ... now you cannot break early anymore. Maybe pass in the match to
>> cpu_watchpoint_address_matches() ?
> 
> Hmm, yes, perhaps.
> 
> OTOH, summing a bitmask is a very quick operation.  Depending on the total
> number of watchpoints, of course...

And for anything that is not a hit, we have to walk all watchpoints
either way, so the speedup would most probably be neglectable.

-- 

Thanks,

David / dhildenb

Reply via email to