[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/43] Move RAMBlock and ram_list to ram_addr.h
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 17/43] Move RAMBlock and ram_list to ram_addr.h |
Date: |
Wed, 9 Sep 2015 15:49:47 +0200 |
From: "Dr. David Alan Gilbert" <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/exec/cpu-all.h | 41 -----------------------------------------
include/exec/ram_addr.h | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 89db792..f9998b9 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -266,44 +266,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
#if !defined(CONFIG_USER_ONLY)
-/* memory API */
-
-typedef struct RAMBlock RAMBlock;
-
-struct RAMBlock {
- struct rcu_head rcu;
- struct MemoryRegion *mr;
- uint8_t *host;
- ram_addr_t offset;
- ram_addr_t used_length;
- ram_addr_t max_length;
- void (*resized)(const char*, uint64_t length, void *host);
- uint32_t flags;
- /* Protected by iothread lock. */
- char idstr[256];
- /* RCU-enabled, writes protected by the ramlist lock */
- QLIST_ENTRY(RAMBlock) next;
- int fd;
-};
-
-static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
-{
- assert(offset < block->used_length);
- assert(block->host);
- return (char *)block->host + offset;
-}
-
-typedef struct RAMList {
- QemuMutex mutex;
- /* Protected by the iothread lock. */
- unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
- RAMBlock *mru_block;
- /* RCU-enabled, writes protected by the ramlist lock. */
- QLIST_HEAD(, RAMBlock) blocks;
- uint32_t version;
-} RAMList;
-extern RAMList ram_list;
-
/* Flags stored in the low bits of the TLB virtual address. These are
defined so that fast path ram access is all zeros. */
/* Zero if TLB entry is valid. */
@@ -316,9 +278,6 @@ extern RAMList ram_list;
void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
-ram_addr_t last_ram_offset(void);
-void qemu_mutex_lock_ramlist(void);
-void qemu_mutex_unlock_ramlist(void);
#endif /* !CONFIG_USER_ONLY */
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index c113f21..c400a75 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -22,6 +22,46 @@
#ifndef CONFIG_USER_ONLY
#include "hw/xen/xen.h"
+typedef struct RAMBlock RAMBlock;
+
+struct RAMBlock {
+ struct rcu_head rcu;
+ struct MemoryRegion *mr;
+ uint8_t *host;
+ ram_addr_t offset;
+ ram_addr_t used_length;
+ ram_addr_t max_length;
+ void (*resized)(const char*, uint64_t length, void *host);
+ uint32_t flags;
+ /* Protected by iothread lock. */
+ char idstr[256];
+ /* RCU-enabled, writes protected by the ramlist lock */
+ QLIST_ENTRY(RAMBlock) next;
+ int fd;
+};
+
+static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
+{
+ assert(offset < block->used_length);
+ assert(block->host);
+ return (char *)block->host + offset;
+}
+
+typedef struct RAMList {
+ QemuMutex mutex;
+ /* Protected by the iothread lock. */
+ unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
+ RAMBlock *mru_block;
+ /* RCU-enabled, writes protected by the ramlist lock. */
+ QLIST_HEAD(, RAMBlock) blocks;
+ uint32_t version;
+} RAMList;
+extern RAMList ram_list;
+
+ram_addr_t last_ram_offset(void);
+void qemu_mutex_lock_ramlist(void);
+void qemu_mutex_unlock_ramlist(void);
+
ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
bool share, const char *mem_path,
Error **errp);
--
2.4.3
- [Qemu-devel] [PULL 10/43] tcg: introduce tcg_current_cpu, (continued)
- [Qemu-devel] [PULL 10/43] tcg: introduce tcg_current_cpu, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 07/43] Added generic panic handler qemu_system_guest_panicked(), Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 09/43] i8257: remove cpu_request_exit irq, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 14/43] tcg: synchronize exit_request and tcg_current_cpu accesses, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 15/43] use qemu_cpu_kick instead of cpu_exit or qemu_cpu_kick_thread, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 11/43] remove qemu/tls.h, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 13/43] tcg: synchronize cpu->exit_request and cpu->tcg_exit_req accesses, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 16/43] tcg: signal-free qemu_cpu_kick, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 12/43] tcg: assign cpu->current_tb in a simpler place, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 18/43] Makefile.target: include top level build dir in vpath, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 17/43] Move RAMBlock and ram_list to ram_addr.h,
Paolo Bonzini <=
- [Qemu-devel] [PULL 22/43] translate-all: remove obsolete comment about l1_map, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 20/43] rcu: fix comment with s/rcu_gp_lock/rcu_registry_lock/, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 21/43] linux-user: call rcu_(un)register_thread on pthread_(exit|create), Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 19/43] rcu: init rcu_registry_lock after fork, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 23/43] cutils: Add qemu_strtol() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 28/43] CODING_STYLE: update mixed declaration rules, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 26/43] cutils: Add qemu_strtoull() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 24/43] cutils: Add qemu_strtoul() wrapper, Paolo Bonzini, 2015/09/09