summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-08-11 10:57:52 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-09 15:34:56 +0200
commit8fd19e6cfd5b6cdf028c6ac2ff4157ed831ea3a6 (patch)
treee8a94c171102729696fec8984437a40f7b6dd7b6
parent756920876f60829fad0d15df4f3fa205077a8131 (diff)
downloadqemu-8fd19e6cfd5b6cdf028c6ac2ff4157ed831ea3a6.tar.gz
exec: make mmap_lock/mmap_unlock globally available
There is some iffy lock hierarchy going on in translate-all.c. To fix it, we need to take the mmap_lock in cpu-exec.c. Make the functions globally available. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--bsd-user/qemu.h2
-rw-r--r--include/exec/exec-all.h6
-rw-r--r--linux-user/qemu.h2
-rw-r--r--translate-all.c5
4 files changed, 6 insertions, 9 deletions
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 21cc6023ee..735cb4042a 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -211,8 +211,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
abi_ulong new_addr);
int target_msync(abi_ulong start, abi_ulong len, int flags);
extern unsigned long last_brk;
-void mmap_lock(void);
-void mmap_unlock(void);
void cpu_list_lock(void);
void cpu_list_unlock(void);
#if defined(CONFIG_USE_NPTL)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 59544d4d89..05a5d5c53b 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -374,11 +374,17 @@ void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx,
#endif
#if defined(CONFIG_USER_ONLY)
+void mmap_lock(void);
+void mmap_unlock(void);
+
static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
{
return addr;
}
#else
+static inline void mmap_lock(void) {}
+static inline void mmap_unlock(void) {}
+
/* cputlb.c */
tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr);
#endif
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 8012cc2f5b..e8606b290c 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -261,8 +261,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
int target_msync(abi_ulong start, abi_ulong len, int flags);
extern unsigned long last_brk;
extern abi_ulong mmap_next_start;
-void mmap_lock(void);
-void mmap_unlock(void);
abi_ulong mmap_find_vma(abi_ulong, abi_ulong);
void cpu_list_lock(void);
void cpu_list_unlock(void);
diff --git a/translate-all.c b/translate-all.c
index a12139ba01..e3c5c5e20a 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -466,11 +466,6 @@ static inline PageDesc *page_find(tb_page_addr_t index)
return page_find_alloc(index, 0);
}
-#if !defined(CONFIG_USER_ONLY)
-#define mmap_lock() do { } while (0)
-#define mmap_unlock() do { } while (0)
-#endif
-
#if defined(CONFIG_USER_ONLY)
/* Currently it is not recommended to allocate big chunks of data in
user mode. It will change when a dedicated libc will be used. */