[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/22] memory: move unassigned_mem_ops to memory.c
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 08/22] memory: move unassigned_mem_ops to memory.c |
Date: |
Thu, 30 May 2013 23:03:42 +0200 |
reservation_ops is already doing the same thing.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 12 ----------
include/exec/memory-internal.h | 2 +
memory.c | 44 ++++++++++++---------------------------
3 files changed, 16 insertions(+), 42 deletions(-)
diff --git a/exec.c b/exec.c
index 3ebc46a..03003b2 100644
--- a/exec.c
+++ b/exec.c
@@ -50,7 +50,6 @@
#include "exec/memory-internal.h"
-//#define DEBUG_UNASSIGNED
//#define DEBUG_SUBPAGE
#if !defined(CONFIG_USER_ONLY)
@@ -1402,17 +1401,6 @@ ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
return ram_addr;
}
-static bool unassigned_mem_accepts(void *opaque, hwaddr addr,
- unsigned size, bool is_write)
-{
- return false;
-}
-
-const MemoryRegionOps unassigned_mem_ops = {
- .valid.accepts = unassigned_mem_accepts,
- .endianness = DEVICE_NATIVE_ENDIAN,
-};
-
static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
uint64_t val, unsigned size)
{
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
index 8d15f90..c18b36c 100644
--- a/include/exec/memory-internal.h
+++ b/include/exec/memory-internal.h
@@ -43,6 +43,8 @@ struct AddressSpaceDispatch {
void address_space_init_dispatch(AddressSpace *as);
void address_space_destroy_dispatch(AddressSpace *as);
+extern const MemoryRegionOps unassigned_mem_ops;
+
ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
MemoryRegion *mr);
ram_addr_t qemu_ram_alloc(ram_addr_t size, MemoryRegion *mr);
diff --git a/memory.c b/memory.c
index 15da877..2e4f547 100644
--- a/memory.c
+++ b/memory.c
@@ -22,6 +22,8 @@
#include "exec/memory-internal.h"
+//#define DEBUG_UNASSIGNED
+
static unsigned memory_region_transaction_depth;
static bool memory_region_update_pending;
static bool global_dirty_log = false;
@@ -837,6 +839,17 @@ static void unassigned_mem_write(void *opaque, hwaddr addr,
#endif
}
+static bool unassigned_mem_accepts(void *opaque, hwaddr addr,
+ unsigned size, bool is_write)
+{
+ return false;
+}
+
+const MemoryRegionOps unassigned_mem_ops = {
+ .valid.accepts = unassigned_mem_accepts,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
static bool memory_region_access_valid(MemoryRegion *mr,
hwaddr addr,
unsigned size,
@@ -1001,40 +1014,11 @@ void memory_region_init_rom_device(MemoryRegion *mr,
mr->ram_addr = qemu_ram_alloc(size, mr);
}
-static uint64_t invalid_read(void *opaque, hwaddr addr,
- unsigned size)
-{
- MemoryRegion *mr = opaque;
-
- if (!mr->warning_printed) {
- fprintf(stderr, "Invalid read from memory region %s\n", mr->name);
- mr->warning_printed = true;
- }
- return -1U;
-}
-
-static void invalid_write(void *opaque, hwaddr addr, uint64_t data,
- unsigned size)
-{
- MemoryRegion *mr = opaque;
-
- if (!mr->warning_printed) {
- fprintf(stderr, "Invalid write to memory region %s\n", mr->name);
- mr->warning_printed = true;
- }
-}
-
-static const MemoryRegionOps reservation_ops = {
- .read = invalid_read,
- .write = invalid_write,
- .endianness = DEVICE_NATIVE_ENDIAN,
-};
-
void memory_region_init_reservation(MemoryRegion *mr,
const char *name,
uint64_t size)
{
- memory_region_init_io(mr, &reservation_ops, mr, name, size);
+ memory_region_init_io(mr, &unassigned_mem_ops, mr, name, size);
}
void memory_region_destroy(MemoryRegion *mr)
--
1.7.4.1
- [Qemu-devel] [PULL 00/22] Memory/IOMMU patches, part 2: unassigned access detection, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 01/22] exec: eliminate io_mem_ram, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 02/22] exec: drop useless #if, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 03/22] cputlb: simplify tlb_set_page, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 04/22] exec: make io_mem_unassigned private, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 05/22] exec: do not use error_mem_read, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 06/22] memory: dispatch unassigned accesses based on .valid.accepts, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 08/22] memory: move unassigned_mem_ops to memory.c,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 09/22] memory: assign MemoryRegionOps to all regions, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 07/22] memory: add address_space_translate, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 10/22] exec: expect mr->ops to be initialized for ROM, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 11/22] exec: introduce memory_access_is_direct, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 12/22] exec: introduce memory_access_size, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 13/22] memory: export memory_region_access_valid to exec.c, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 14/22] exec: implement .valid.accepts for subpages, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 15/22] memory: add address_space_access_valid, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 16/22] memory: accept mismatching sizes in memory_region_access_valid, Paolo Bonzini, 2013/05/30
- [Qemu-devel] [PATCH 17/22] memory: add big endian support to access_with_adjusted_size, Paolo Bonzini, 2013/05/30