On 5/16/22 08:11, Peter Maydell wrote:
+ chunk = -(addr | TARGET_PAGE_MASK);
'chunk' is unsigned but we're assigning it a negative number here...
I assume this is doing some clever bit-twiddling trick but it isn't
very obvious.
Number of bytes left in page -- I'll rename the variable.
In any case, rounding to a page boundary isn't sufficient to
avoid problems, because we don't mandate that RAM-to-device
MemoryRegion boundaries happen on page boundaries. I think you
either need to do this at a low enough level that you can
look at what MemoryRegion types you're reading from, or you need
to do it byte at a time.
Easy enough to use probe_access_flags.
r~