From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: qemu-devel@nongnu.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
David Gibson <david@gibson.dropbear.id.au>,
qemu-ppc@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org
Subject: [PATCH v3 04/10] address_space_write_continue: Distill common code
Date: Tue, 19 Jul 2016 22:02:54 -0700 [thread overview]
Message-ID: <1468990980-4598-5-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1468990980-4598-1-git-send-email-andrew.smirnov@gmail.com>
Move call to memory_region_dispatch_write() outside of swtich statement
since the only thing that is different about all of those call is
"length" argument and that matches value in "l".
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
exec.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/exec.c b/exec.c
index 44cd424..e2425c5 100644
--- a/exec.c
+++ b/exec.c
@@ -2567,32 +2567,23 @@ static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr,
potential bugs */
switch (l) {
case 8:
- /* 64 bit write access */
- val = ldq_p(buf);
- result |= memory_region_dispatch_write(mr, addr1, val, 8,
- attrs);
+ val = ldq_p(buf); /* 64 bit write access */
break;
case 4:
- /* 32 bit write access */
- val = ldl_p(buf);
- result |= memory_region_dispatch_write(mr, addr1, val, 4,
- attrs);
+ val = ldl_p(buf); /* 32 bit write access */
break;
case 2:
- /* 16 bit write access */
- val = lduw_p(buf);
- result |= memory_region_dispatch_write(mr, addr1, val, 2,
- attrs);
+ val = lduw_p(buf); /* 16 bit write access */
break;
case 1:
- /* 8 bit write access */
- val = ldub_p(buf);
- result |= memory_region_dispatch_write(mr, addr1, val, 1,
- attrs);
+ val = ldub_p(buf); /* 8 bit write access */
break;
default:
abort();
}
+
+ result |= memory_region_dispatch_write(mr, addr1, val, l,
+ attrs);
} else {
/* RAM case */
ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
--
2.5.5
next prev parent reply other threads:[~2016-07-20 5:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 5:02 [PATCH v3 00/10] Support non-direct memory writes in cpu_memory_rw_debug Andrey Smirnov
2016-07-20 5:02 ` [PATCH v3 01/10] Avoid needless calls to address_space_rw() Andrey Smirnov
2016-07-20 5:02 ` [PATCH v3 02/10] Change signature of address_space_read() to avoid casting Andrey Smirnov
2016-07-20 5:02 ` [PATCH v3 03/10] Change signature of address_space_write() " Andrey Smirnov
2016-07-20 5:02 ` Andrey Smirnov [this message]
2016-07-20 5:02 ` [PATCH v3 05/10] Rename MMUAccessType to MemoryAccessType Andrey Smirnov
2016-07-20 9:34 ` David Gibson
2016-07-20 5:02 ` [PATCH v3 06/10] Change signature of cpu_memory_rw_debug() to avoid casting Andrey Smirnov
2016-07-20 5:02 ` [PATCH v3 07/10] Convert cpu_memory_rw_debug to use MemoryAccessType Andrey Smirnov
2016-07-20 9:45 ` David Gibson
2016-07-20 5:02 ` [PATCH v3 08/10] Convert address_space_rw " Andrey Smirnov
2016-07-21 1:47 ` David Gibson
2016-07-20 5:02 ` [PATCH v3 09/10] gdbstub: Convert target_memory_rw_debug " Andrey Smirnov
2016-07-21 1:48 ` David Gibson
2016-07-20 5:03 ` [PATCH v3 10/10] exec: Use address_space_rw to handle reads and wirtes Andrey Smirnov
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=1468990980-4598-5-git-send-email-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=kvm@vger.kernel.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).