mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-02 02:11:09 +00:00
tcg: move page_size_init() function
translate-all.c will be disabled if tcg is disabled in the build, so page_size_init() function and related variables will be moved to exec.c file. Backports commit a0be0c585f5dcc4d50a37f6a20d3d625c5ef3a2c from qemu
This commit is contained in:
parent
cf5d583ef0
commit
d70c141675
15
qemu/exec.c
15
qemu/exec.c
|
@ -2642,3 +2642,18 @@ int qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *op
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void page_size_init(struct uc_struct *uc)
|
||||||
|
{
|
||||||
|
/* NOTE: we can always suppose that qemu_host_page_size >=
|
||||||
|
TARGET_PAGE_SIZE */
|
||||||
|
uc->qemu_real_host_page_size = getpagesize();
|
||||||
|
uc->qemu_real_host_page_mask = -(intptr_t)uc->qemu_real_host_page_size;
|
||||||
|
if (uc->qemu_host_page_size == 0) {
|
||||||
|
uc->qemu_host_page_size = uc->qemu_real_host_page_size;
|
||||||
|
}
|
||||||
|
if (uc->qemu_host_page_size < TARGET_PAGE_SIZE) {
|
||||||
|
uc->qemu_host_page_size = TARGET_PAGE_SIZE;
|
||||||
|
}
|
||||||
|
uc->qemu_host_page_mask = -(intptr_t)uc->qemu_host_page_size;
|
||||||
|
}
|
||||||
|
|
|
@ -443,4 +443,7 @@ static inline bool cpu_can_do_io(CPUState *cpu)
|
||||||
// Unicorn: Used for freeing
|
// Unicorn: Used for freeing
|
||||||
void phys_mem_clean(AddressSpace *as);
|
void phys_mem_clean(AddressSpace *as);
|
||||||
|
|
||||||
|
// Unicorn: Prototype place here
|
||||||
|
void page_size_init(struct uc_struct *uc);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -345,21 +345,6 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void page_size_init(struct uc_struct *uc)
|
|
||||||
{
|
|
||||||
/* NOTE: we can always suppose that qemu_host_page_size >=
|
|
||||||
TARGET_PAGE_SIZE */
|
|
||||||
uc->qemu_real_host_page_size = getpagesize();
|
|
||||||
uc->qemu_real_host_page_mask = -(intptr_t)uc->qemu_real_host_page_size;
|
|
||||||
if (uc->qemu_host_page_size == 0) {
|
|
||||||
uc->qemu_host_page_size = uc->qemu_real_host_page_size;
|
|
||||||
}
|
|
||||||
if (uc->qemu_host_page_size < TARGET_PAGE_SIZE) {
|
|
||||||
uc->qemu_host_page_size = TARGET_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
uc->qemu_host_page_mask = -(intptr_t)uc->qemu_host_page_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void page_init(struct uc_struct *uc)
|
static void page_init(struct uc_struct *uc)
|
||||||
{
|
{
|
||||||
page_size_init(uc);
|
page_size_init(uc);
|
||||||
|
@ -949,7 +934,6 @@ void tb_flush(CPUState *cpu)
|
||||||
{
|
{
|
||||||
struct uc_struct* uc = cpu->uc;
|
struct uc_struct* uc = cpu->uc;
|
||||||
TCGContext *tcg_ctx = uc->tcg_ctx;
|
TCGContext *tcg_ctx = uc->tcg_ctx;
|
||||||
int i;
|
|
||||||
|
|
||||||
#if defined(DEBUG_TB_FLUSH)
|
#if defined(DEBUG_TB_FLUSH)
|
||||||
printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n",
|
printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n",
|
||||||
|
@ -1870,8 +1854,6 @@ static void tb_jmp_cache_clear_page(CPUState *cpu, target_ulong page_addr)
|
||||||
|
|
||||||
void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr)
|
void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
/* Discard jump cache entries for any tb which might potentially
|
/* Discard jump cache entries for any tb which might potentially
|
||||||
overlap the flushed page. */
|
overlap the flushed page. */
|
||||||
tb_jmp_cache_clear_page(cpu, addr - TARGET_PAGE_SIZE);
|
tb_jmp_cache_clear_page(cpu, addr - TARGET_PAGE_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue