accel/tcg: Move TARGET_PAGE_DATA_SIZE impl to user-exec.c
Since "target data" is always user-only, move it out of translate-all.c to user-exec.c. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
e786509f29
commit
0fe6108432
|
@ -1399,56 +1399,6 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void page_reset_target_data(target_ulong start, target_ulong end)
|
|
||||||
{
|
|
||||||
#ifdef TARGET_PAGE_DATA_SIZE
|
|
||||||
target_ulong addr, len;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function should never be called with addresses outside the
|
|
||||||
* guest address space. If this assert fires, it probably indicates
|
|
||||||
* a missing call to h2g_valid.
|
|
||||||
*/
|
|
||||||
assert(end - 1 <= GUEST_ADDR_MAX);
|
|
||||||
assert(start < end);
|
|
||||||
assert_memory_lock();
|
|
||||||
|
|
||||||
start = start & TARGET_PAGE_MASK;
|
|
||||||
end = TARGET_PAGE_ALIGN(end);
|
|
||||||
|
|
||||||
for (addr = start, len = end - start;
|
|
||||||
len != 0;
|
|
||||||
len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
|
|
||||||
PageDesc *p = page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
|
|
||||||
|
|
||||||
g_free(p->target_data);
|
|
||||||
p->target_data = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TARGET_PAGE_DATA_SIZE
|
|
||||||
void *page_get_target_data(target_ulong address)
|
|
||||||
{
|
|
||||||
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
|
|
||||||
return p ? p->target_data : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *page_alloc_target_data(target_ulong address)
|
|
||||||
{
|
|
||||||
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
|
|
||||||
void *ret = NULL;
|
|
||||||
|
|
||||||
if (p->flags & PAGE_VALID) {
|
|
||||||
ret = p->target_data;
|
|
||||||
if (!ret) {
|
|
||||||
p->target_data = ret = g_malloc0(TARGET_PAGE_DATA_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif /* TARGET_PAGE_DATA_SIZE */
|
|
||||||
|
|
||||||
int page_check_range(target_ulong start, target_ulong len, int flags)
|
int page_check_range(target_ulong start, target_ulong len, int flags)
|
||||||
{
|
{
|
||||||
PageDesc *p;
|
PageDesc *p;
|
||||||
|
|
|
@ -210,6 +210,56 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, target_ulong addr,
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void page_reset_target_data(target_ulong start, target_ulong end)
|
||||||
|
{
|
||||||
|
#ifdef TARGET_PAGE_DATA_SIZE
|
||||||
|
target_ulong addr, len;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function should never be called with addresses outside the
|
||||||
|
* guest address space. If this assert fires, it probably indicates
|
||||||
|
* a missing call to h2g_valid.
|
||||||
|
*/
|
||||||
|
assert(end - 1 <= GUEST_ADDR_MAX);
|
||||||
|
assert(start < end);
|
||||||
|
assert_memory_lock();
|
||||||
|
|
||||||
|
start = start & TARGET_PAGE_MASK;
|
||||||
|
end = TARGET_PAGE_ALIGN(end);
|
||||||
|
|
||||||
|
for (addr = start, len = end - start;
|
||||||
|
len != 0;
|
||||||
|
len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
|
||||||
|
PageDesc *p = page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
|
||||||
|
|
||||||
|
g_free(p->target_data);
|
||||||
|
p->target_data = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef TARGET_PAGE_DATA_SIZE
|
||||||
|
void *page_get_target_data(target_ulong address)
|
||||||
|
{
|
||||||
|
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
|
||||||
|
return p ? p->target_data : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *page_alloc_target_data(target_ulong address)
|
||||||
|
{
|
||||||
|
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
|
||||||
|
void *ret = NULL;
|
||||||
|
|
||||||
|
if (p->flags & PAGE_VALID) {
|
||||||
|
ret = p->target_data;
|
||||||
|
if (!ret) {
|
||||||
|
p->target_data = ret = g_malloc0(TARGET_PAGE_DATA_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The softmmu versions of these helpers are in cputlb.c. */
|
/* The softmmu versions of these helpers are in cputlb.c. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue