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
This commit is contained in:
Paolo Bonzini 2018-02-15 13:29:08 -05:00 committed by Lioncash
parent 62045513bb
commit 195a86283f
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 9 additions and 5 deletions

View file

@ -371,11 +371,17 @@ void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx,
#endif #endif
#if defined(CONFIG_USER_ONLY) #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) static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
{ {
return addr; return addr;
} }
#else #else
static inline void mmap_lock(void) {}
static inline void mmap_unlock(void) {}
/* cputlb.c */ /* cputlb.c */
tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr); tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr);
#endif #endif

View file

@ -162,6 +162,9 @@ int qemu_strnlen(const char *s, int max_len);
* Returns: the pointer originally in @input. * Returns: the pointer originally in @input.
*/ */
char *qemu_strsep(char **input, const char *delim); 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 * strtosz() suffixes used to specify the default treatment of an

View file

@ -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); 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) #if defined(CONFIG_USER_ONLY)
/* Currently it is not recommended to allocate big chunks of data in /* Currently it is not recommended to allocate big chunks of data in
user mode. It will change when a dedicated libc will be used. */ user mode. It will change when a dedicated libc will be used. */