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. Signed-off-by: Yang Zhong <yang.zhong@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e7b161d573
commit
a0be0c585f
|
@ -112,9 +112,6 @@ typedef struct PageDesc {
|
||||||
#define V_L2_BITS 10
|
#define V_L2_BITS 10
|
||||||
#define V_L2_SIZE (1 << V_L2_BITS)
|
#define V_L2_SIZE (1 << V_L2_BITS)
|
||||||
|
|
||||||
uintptr_t qemu_host_page_size;
|
|
||||||
intptr_t qemu_host_page_mask;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* L1 Mapping properties
|
* L1 Mapping properties
|
||||||
*/
|
*/
|
||||||
|
@ -363,21 +360,6 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void page_size_init(void)
|
|
||||||
{
|
|
||||||
/* NOTE: we can always suppose that qemu_host_page_size >=
|
|
||||||
TARGET_PAGE_SIZE */
|
|
||||||
qemu_real_host_page_size = getpagesize();
|
|
||||||
qemu_real_host_page_mask = -(intptr_t)qemu_real_host_page_size;
|
|
||||||
if (qemu_host_page_size == 0) {
|
|
||||||
qemu_host_page_size = qemu_real_host_page_size;
|
|
||||||
}
|
|
||||||
if (qemu_host_page_size < TARGET_PAGE_SIZE) {
|
|
||||||
qemu_host_page_size = TARGET_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
qemu_host_page_mask = -(intptr_t)qemu_host_page_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void page_init(void)
|
static void page_init(void)
|
||||||
{
|
{
|
||||||
page_size_init();
|
page_size_init();
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#include "sysemu/cpus.h"
|
#include "sysemu/cpus.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
|
|
||||||
uintptr_t qemu_real_host_page_size;
|
|
||||||
intptr_t qemu_real_host_page_mask;
|
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
/* mask must never be zero, except for A20 change call */
|
/* mask must never be zero, except for A20 change call */
|
||||||
static void tcg_handle_interrupt(CPUState *cpu, int mask)
|
static void tcg_handle_interrupt(CPUState *cpu, int mask)
|
||||||
|
|
20
exec.c
20
exec.c
|
@ -118,6 +118,11 @@ __thread CPUState *current_cpu;
|
||||||
2 = Adaptive rate instruction counting. */
|
2 = Adaptive rate instruction counting. */
|
||||||
int use_icount;
|
int use_icount;
|
||||||
|
|
||||||
|
uintptr_t qemu_host_page_size;
|
||||||
|
intptr_t qemu_host_page_mask;
|
||||||
|
uintptr_t qemu_real_host_page_size;
|
||||||
|
intptr_t qemu_real_host_page_mask;
|
||||||
|
|
||||||
bool set_preferred_target_page_bits(int bits)
|
bool set_preferred_target_page_bits(int bits)
|
||||||
{
|
{
|
||||||
/* The target page size is the lowest common denominator for all
|
/* The target page size is the lowest common denominator for all
|
||||||
|
@ -3590,3 +3595,18 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void page_size_init(void)
|
||||||
|
{
|
||||||
|
/* NOTE: we can always suppose that qemu_host_page_size >=
|
||||||
|
TARGET_PAGE_SIZE */
|
||||||
|
qemu_real_host_page_size = getpagesize();
|
||||||
|
qemu_real_host_page_mask = -(intptr_t)qemu_real_host_page_size;
|
||||||
|
if (qemu_host_page_size == 0) {
|
||||||
|
qemu_host_page_size = qemu_real_host_page_size;
|
||||||
|
}
|
||||||
|
if (qemu_host_page_size < TARGET_PAGE_SIZE) {
|
||||||
|
qemu_host_page_size = TARGET_PAGE_SIZE;
|
||||||
|
}
|
||||||
|
qemu_host_page_mask = -(intptr_t)qemu_host_page_size;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue