[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v3 04/10] address_space_write_continue: Distill common
From: |
Andrey Smirnov |
Subject: |
[Qemu-ppc] [PATCH v3 04/10] address_space_write_continue: Distill common code |
Date: |
Tue, 19 Jul 2016 22:02:54 -0700 |
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 <address@hidden>
Signed-off-by: Andrey Smirnov <address@hidden>
---
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
- [Qemu-ppc] [PATCH v3 00/10] Support non-direct memory writes in cpu_memory_rw_debug, Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 04/10] address_space_write_continue: Distill common code,
Andrey Smirnov <=
- [Qemu-ppc] [PATCH v3 02/10] Change signature of address_space_read() to avoid casting, Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 03/10] Change signature of address_space_write() to avoid casting, Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 01/10] Avoid needless calls to address_space_rw(), Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 08/10] Convert address_space_rw to use MemoryAccessType, Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 09/10] gdbstub: Convert target_memory_rw_debug to use MemoryAccessType, Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 10/10] exec: Use address_space_rw to handle reads and wirtes, Andrey Smirnov, 2016/07/20
- [Qemu-ppc] [PATCH v3 07/10] Convert cpu_memory_rw_debug to use MemoryAccessType, Andrey Smirnov, 2016/07/20