|
From: | Richard Henderson |
Subject: | Re: [PATCH v2 05/74] semihosting: Add target_strlen for softmmu-uaccess.h |
Date: | Mon, 16 May 2022 18:33:24 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |