[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 25/28] memory: move functions around
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 25/28] memory: move functions around |
Date: |
Mon, 22 Jul 2013 15:54:35 +0200 |
Prepare for next patch, no semantic change.
Signed-off-by: Paolo Bonzini <address@hidden>
---
memory.c | 60 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/memory.c b/memory.c
index 34a088e..aaae10d 100644
--- a/memory.c
+++ b/memory.c
@@ -339,6 +339,36 @@ static void flatview_simplify(FlatView *view)
}
}
+static bool memory_region_wrong_endianness(MemoryRegion *mr)
+{
+#ifdef TARGET_WORDS_BIGENDIAN
+ return mr->ops->endianness == DEVICE_LITTLE_ENDIAN;
+#else
+ return mr->ops->endianness == DEVICE_BIG_ENDIAN;
+#endif
+}
+
+static void adjust_endianness(MemoryRegion *mr, uint64_t *data, unsigned size)
+{
+ if (memory_region_wrong_endianness(mr)) {
+ switch (size) {
+ case 1:
+ break;
+ case 2:
+ *data = bswap16(*data);
+ break;
+ case 4:
+ *data = bswap32(*data);
+ break;
+ case 8:
+ *data = bswap64(*data);
+ break;
+ default:
+ abort();
+ }
+ }
+}
+
static void memory_region_oldmmio_read_accessor(void *opaque,
hwaddr addr,
uint64_t *value,
@@ -786,15 +816,6 @@ static void
memory_region_destructor_rom_device(MemoryRegion *mr)
qemu_ram_free(mr->ram_addr & TARGET_PAGE_MASK);
}
-static bool memory_region_wrong_endianness(MemoryRegion *mr)
-{
-#ifdef TARGET_WORDS_BIGENDIAN
- return mr->ops->endianness == DEVICE_LITTLE_ENDIAN;
-#else
- return mr->ops->endianness == DEVICE_BIG_ENDIAN;
-#endif
-}
-
void memory_region_init(MemoryRegion *mr,
Object *owner,
const char *name,
@@ -921,27 +942,6 @@ static uint64_t memory_region_dispatch_read1(MemoryRegion
*mr,
return data;
}
-static void adjust_endianness(MemoryRegion *mr, uint64_t *data, unsigned size)
-{
- if (memory_region_wrong_endianness(mr)) {
- switch (size) {
- case 1:
- break;
- case 2:
- *data = bswap16(*data);
- break;
- case 4:
- *data = bswap32(*data);
- break;
- case 8:
- *data = bswap64(*data);
- break;
- default:
- abort();
- }
- }
-}
-
static bool memory_region_dispatch_read(MemoryRegion *mr,
hwaddr addr,
uint64_t *pval,
--
1.8.1.4
- [Qemu-devel] [PATCH 18/28] mips: degrade BIOS error to warning, (continued)
- [Qemu-devel] [PATCH 18/28] mips: degrade BIOS error to warning, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 20/28] sparc64: unbreak, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 19/28] sh4: unbreak r2d, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 21/28] default-configs: add test device to all machines supporting ISA, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 22/28] default-configs: add SuperIO to SH4, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 23/28] default-configs/ppc64: add all components of i82378 SuperIO chip used by prep, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 26/28] memory: pass MemoryRegion to access_with_adjusted_size, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 24/28] qtest: add test for ISA I/O space endianness, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 27/28] memory: check memory region endianness, not target's, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 25/28] memory: move functions around,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 28/28] pc-testdev: add I/O port to test memory.c auto split/combine, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 02/28] ppc_oldworld: do not use isa_mmio, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 03/28] ppc_newworld: do not use isa_mmio, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 04/28] spapr_pci: remove indirection for I/O port access, Paolo Bonzini, 2013/07/22
- [Qemu-devel] [PATCH 01/28] sh4: do not use isa_mmio, Paolo Bonzini, 2013/07/22
- Re: [Qemu-devel] [PATCH 00/28] Memory API for 1.6: fix I/O port endianness mess, Peter Maydell, 2013/07/22