[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 32/42] exec: Map device_endian onto MemOp
From: |
tony.nguyen |
Subject: |
[Qemu-devel] [PATCH v7 32/42] exec: Map device_endian onto MemOp |
Date: |
Fri, 16 Aug 2019 07:36:48 +0000 |
Preparation to replace device_endian with MemOp.
Mapping device_endian onto MemOp limits behaviour changes to this
relatively smaller patch.
The next patch will replace all device_endian usages with the
equivalent MemOp. That patch will be large but have no behaviour
changes.
A subsequent patch will then delete unused device_endian.
Signed-off-by: Tony Nguyen <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
hw/char/serial.c | 18 ++++++------------
include/exec/cpu-common.h | 10 +++++++---
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 7c42a2a..521c76b 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -1012,22 +1012,15 @@ static void serial_mm_write(void *opaque, hwaddr addr,
serial_ioport_write(s, addr >> s->it_shift, value, 1);
}
-static const MemoryRegionOps serial_mm_ops[3] = {
- [DEVICE_NATIVE_ENDIAN] = {
- .read = serial_mm_read,
- .write = serial_mm_write,
- .endianness = DEVICE_NATIVE_ENDIAN,
- .valid.max_access_size = 8,
- .impl.max_access_size = 8,
- },
- [DEVICE_LITTLE_ENDIAN] = {
+static const MemoryRegionOps serial_mm_ops[2] = {
+ [0] = {
.read = serial_mm_read,
.write = serial_mm_write,
.endianness = DEVICE_LITTLE_ENDIAN,
.valid.max_access_size = 8,
.impl.max_access_size = 8,
},
- [DEVICE_BIG_ENDIAN] = {
+ [1] = {
.read = serial_mm_read,
.write = serial_mm_write,
.endianness = DEVICE_BIG_ENDIAN,
@@ -1053,8 +1046,9 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
serial_realize_core(s, &error_fatal);
vmstate_register(NULL, base, &vmstate_serial, s);
- memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], s,
- "serial", 8 << it_shift);
+ memory_region_init_io(&s->io, NULL,
+ &serial_mm_ops[end == DEVICE_BIG_ENDIAN],
+ s, "serial", 8 << it_shift);
memory_region_add_subregion(address_space, base, &s->io);
return s;
}
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index f7dbe75..c388453 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -16,10 +16,14 @@ void tcg_flush_softmmu_tlb(CPUState *cs);
#if !defined(CONFIG_USER_ONLY)
+#include "exec/memop.h"
+
enum device_endian {
- DEVICE_NATIVE_ENDIAN,
- DEVICE_BIG_ENDIAN,
- DEVICE_LITTLE_ENDIAN,
+#ifdef NEED_CPU_H
+ DEVICE_NATIVE_ENDIAN = MO_TE,
+#endif
+ DEVICE_BIG_ENDIAN = MO_BE,
+ DEVICE_LITTLE_ENDIAN = MO_LE,
};
#if defined(HOST_WORDS_BIGENDIAN)
--
1.8.3.1
?
- [Qemu-devel] [PATCH v7 24/42] hw/isa: Declare device little or big endian, (continued)
- [Qemu-devel] [PATCH v7 24/42] hw/isa: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 23/42] hw/intc: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 25/42] hw/misc: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 26/42] hw/net: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 27/42] hw/pci-host: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 28/42] hw/sd: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 29/42] hw/ssi: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 32/42] exec: Map device_endian onto MemOp,
tony.nguyen <=
- [Qemu-devel] [PATCH v7 30/42] hw/timer: Declare device little or big endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 34/42] exec: Delete device_endian, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 31/42] build: Correct non-common common-obj-* to obj-*, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 35/42] exec: Delete DEVICE_HOST_ENDIAN, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 36/42] memory: Access MemoryRegion with endianness, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 39/42] cpu: TLB_FLAGS_MASK bit to force memory slow path, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 38/42] memory: Single byte swap along the I/O path, tony.nguyen, 2019/08/16
- [Qemu-devel] [PATCH v7 40/42] cputlb: Byte swap memory transaction attribute, tony.nguyen, 2019/08/16