qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xiong Nandi <xndchn@gmail.com>
To: qemu-devel@nongnu.org
Subject: [PATCH] system/physmem: Fix cpu_memory_rw_debug for armv7m MPU
Date: Wed, 20 Nov 2024 23:15:14 +0800	[thread overview]
Message-ID: <20241120151515.56884-1-xndchn@gmail.com> (raw)


The actual page size (region size for MPU) of armv7m may
smaller than TARGET_PAGE_SIZE (2^5 vs 2^10). So we should
use the actual virtual address to get the phys page address.

Since address_space_rw do not check the region protection, so
if we have some region like [0x0020 ~ 0x003F rw], [0x0040 ~ 0x007F --],
we will be able to read out the whole [0x0020 ~ 0x007F] region.
As a debug function, this seems acceptable.

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



             reply	other threads:[~2024-11-20 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 15:15 Xiong Nandi [this message]
2024-11-20 15:15 ` [PATCH] system/physmem: Fix cpu_memory_rw_debug for armv7m MPU Xiong Nandi
2024-11-22 20:32   ` Richard Henderson
2024-11-24  4:30     ` xndcn
2024-11-24 21:23       ` Richard Henderson
2024-11-25  2:50         ` xndcn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241120151515.56884-1-xndchn@gmail.com \
    --to=xndchn@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).