From 195a86283ffedd42add28b59794b2ea45cc5f492 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 15 Feb 2018 13:29:08 -0500 Subject: [PATCH] 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. Backports commit 8fd19e6cfd5b6cdf028c6ac2ff4157ed831ea3a6 from qemu --- qemu/include/exec/exec-all.h | 6 ++++++ qemu/include/qemu-common.h | 3 +++ qemu/translate-all.c | 5 ----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/qemu/include/exec/exec-all.h b/qemu/include/exec/exec-all.h index bc0d84de..8762a818 100644 --- a/qemu/include/exec/exec-all.h +++ b/qemu/include/exec/exec-all.h @@ -371,11 +371,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/qemu/include/qemu-common.h b/qemu/include/qemu-common.h index bef8ef5c..4a50b728 100644 --- a/qemu/include/qemu-common.h +++ b/qemu/include/qemu-common.h @@ -162,6 +162,9 @@ int qemu_strnlen(const char *s, int max_len); * Returns: the pointer originally in @input. */ char *qemu_strsep(char **input, const char *delim); +int qemu_strtol(const char *nptr, const char **endptr, int base, + long *result); + /* * strtosz() suffixes used to specify the default treatment of an diff --git a/qemu/translate-all.c b/qemu/translate-all.c index 1e0a6e86..2bf73769 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -456,11 +456,6 @@ static inline PageDesc *page_find(struct uc_struct *uc, tb_page_addr_t index) return page_find_alloc(uc, 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. */