Avoid allocating TCG resources in non-TCG mode

Do not allocate TCG-only resources like the translation buffer when
running over KVM or XEN. Saves a "few" bytes in the qemu address space
and is also conceptually cleaner.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Jan Kiszka 2011-08-02 16:10:21 +02:00 committed by Anthony Liguori
parent 8417cebfda
commit d5ab9713d2
9 changed files with 37 additions and 21 deletions

19
exec.c
View file

@ -570,16 +570,12 @@ static void code_gen_alloc(unsigned long tb_size)
/* Must be called before using the QEMU cpus. 'tb_size' is the size
(in bytes) allocated to the translation buffer. Zero means default
size. */
void cpu_exec_init_all(unsigned long tb_size)
void tcg_exec_init(unsigned long tb_size)
{
cpu_gen_init();
code_gen_alloc(tb_size);
code_gen_ptr = code_gen_buffer;
page_init();
#if !defined(CONFIG_USER_ONLY)
memory_map_init();
io_mem_init();
#endif
#if !defined(CONFIG_USER_ONLY) || !defined(CONFIG_USE_GUEST_BASE)
/* There's no guest base to take into account, so go ahead and
initialize the prologue now. */
@ -587,6 +583,19 @@ void cpu_exec_init_all(unsigned long tb_size)
#endif
}
bool tcg_enabled(void)
{
return code_gen_buffer != NULL;
}
void cpu_exec_init_all(void)
{
#if !defined(CONFIG_USER_ONLY)
memory_map_init();
io_mem_init();
#endif
}
#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
static int cpu_common_post_load(void *opaque, int version_id)