system/physmem: gdb memory rw no access on armv7m MPU
The actual page size (region size for MPU) of armv7m may smaller than TARGET_PAGE_SIZE (2^5 vs 2^10). Currently implementation of cpu_memory_rw_debug will always check the access flags of page addr (addr & TARGET_PAGE_SIZE), which is not correct on armv7m MPU.
I have make a minimal reproducible demo here: https://gist.github.com/xndcn/3c534818b6486ecd2414d1cc7925c372
after building main.elf, run:
qemu-system-arm -machine stm32vldiscovery -kernel main.elf -s &
gdb-multiarch main.elf
(gdb) target remote :1234
(gdb) disas main
Dump of assembler code for function main:
0x08000040 <+0>: Cannot access memory at address 0x8000040
I have also proposed a PATCH: https://mail.gnu.org/archive/html/qemu-devel/2024-11/msg04001.html It seems like there is still a lot of work surrounding the MPU regions