mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
include/exec: Move TARGET_PAGE_{SIZE,MASK,BITS} to target_page.h
Re-use the TARGET_PAGE_BITS_VARY mechanism to define TARGET_PAGE_SIZE and friends when not compiling per-target. Inline qemu_target_page_{size,mask,bits} as they are now trivial. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
3504f104ea
commit
58d00538ce
5 changed files with 53 additions and 50 deletions
|
@ -105,26 +105,7 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val
|
||||||
|
|
||||||
/* page related stuff */
|
/* page related stuff */
|
||||||
#include "exec/cpu-defs.h"
|
#include "exec/cpu-defs.h"
|
||||||
#ifdef TARGET_PAGE_BITS_VARY
|
#include "exec/target_page.h"
|
||||||
# include "exec/page-vary.h"
|
|
||||||
extern const TargetPageBits target_page;
|
|
||||||
# ifdef CONFIG_DEBUG_TCG
|
|
||||||
# define TARGET_PAGE_BITS ({ assert(target_page.decided); \
|
|
||||||
target_page.bits; })
|
|
||||||
# define TARGET_PAGE_MASK ({ assert(target_page.decided); \
|
|
||||||
(target_long)target_page.mask; })
|
|
||||||
# else
|
|
||||||
# define TARGET_PAGE_BITS target_page.bits
|
|
||||||
# define TARGET_PAGE_MASK ((target_long)target_page.mask)
|
|
||||||
# endif
|
|
||||||
# define TARGET_PAGE_SIZE (-(int)TARGET_PAGE_MASK)
|
|
||||||
#else
|
|
||||||
# define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
|
|
||||||
# define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
|
|
||||||
# define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
|
|
||||||
|
|
||||||
CPUArchState *cpu_copy(CPUArchState *env);
|
CPUArchState *cpu_copy(CPUArchState *env);
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,6 @@
|
||||||
#pragma GCC poison TARGET_FMT_ld
|
#pragma GCC poison TARGET_FMT_ld
|
||||||
#pragma GCC poison TARGET_FMT_lu
|
#pragma GCC poison TARGET_FMT_lu
|
||||||
|
|
||||||
#pragma GCC poison TARGET_PAGE_SIZE
|
|
||||||
#pragma GCC poison TARGET_PAGE_MASK
|
|
||||||
#pragma GCC poison TARGET_PAGE_BITS
|
|
||||||
#pragma GCC poison TARGET_PAGE_ALIGN
|
|
||||||
#pragma GCC poison TARGET_PHYS_ADDR_SPACE_BITS
|
#pragma GCC poison TARGET_PHYS_ADDR_SPACE_BITS
|
||||||
|
|
||||||
#pragma GCC poison CPU_INTERRUPT_HARD
|
#pragma GCC poison CPU_INTERRUPT_HARD
|
||||||
|
|
|
@ -14,10 +14,56 @@
|
||||||
#ifndef EXEC_TARGET_PAGE_H
|
#ifndef EXEC_TARGET_PAGE_H
|
||||||
#define EXEC_TARGET_PAGE_H
|
#define EXEC_TARGET_PAGE_H
|
||||||
|
|
||||||
size_t qemu_target_page_size(void);
|
/*
|
||||||
int qemu_target_page_mask(void);
|
* If compiling per-target, get the real values.
|
||||||
int qemu_target_page_bits(void);
|
* For generic code, reuse the mechanism for variable page size.
|
||||||
int qemu_target_page_bits_min(void);
|
*/
|
||||||
|
#ifdef COMPILING_PER_TARGET
|
||||||
size_t qemu_target_pages_to_MiB(size_t pages);
|
#include "cpu-param.h"
|
||||||
|
#include "exec/target_long.h"
|
||||||
|
#define TARGET_PAGE_TYPE target_long
|
||||||
|
#else
|
||||||
|
#define TARGET_PAGE_BITS_VARY
|
||||||
|
#define TARGET_PAGE_TYPE int
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TARGET_PAGE_BITS_VARY
|
||||||
|
# include "exec/page-vary.h"
|
||||||
|
extern const TargetPageBits target_page;
|
||||||
|
# ifdef CONFIG_DEBUG_TCG
|
||||||
|
# define TARGET_PAGE_BITS ({ assert(target_page.decided); \
|
||||||
|
target_page.bits; })
|
||||||
|
# define TARGET_PAGE_MASK ({ assert(target_page.decided); \
|
||||||
|
(TARGET_PAGE_TYPE)target_page.mask; })
|
||||||
|
# else
|
||||||
|
# define TARGET_PAGE_BITS target_page.bits
|
||||||
|
# define TARGET_PAGE_MASK ((TARGET_PAGE_TYPE)target_page.mask)
|
||||||
|
# endif
|
||||||
|
# define TARGET_PAGE_SIZE (-(int)TARGET_PAGE_MASK)
|
||||||
|
#else
|
||||||
|
# define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
|
||||||
|
# define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
|
||||||
|
# define TARGET_PAGE_MASK ((TARGET_PAGE_TYPE)-1 << TARGET_PAGE_BITS)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
|
||||||
|
|
||||||
|
static inline size_t qemu_target_page_size(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int qemu_target_page_mask(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int qemu_target_page_bits(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_BITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qemu_target_page_bits_min(void);
|
||||||
|
size_t qemu_target_pages_to_MiB(size_t pages);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,24 +8,6 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "exec/target_page.h"
|
#include "exec/target_page.h"
|
||||||
#include "exec/cpu-defs.h"
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "exec/cpu-all.h"
|
|
||||||
|
|
||||||
size_t qemu_target_page_size(void)
|
|
||||||
{
|
|
||||||
return TARGET_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qemu_target_page_mask(void)
|
|
||||||
{
|
|
||||||
return TARGET_PAGE_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qemu_target_page_bits(void)
|
|
||||||
{
|
|
||||||
return TARGET_PAGE_BITS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qemu_target_page_bits_min(void)
|
int qemu_target_page_bits_min(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,5 @@ bool set_preferred_target_page_bits(int bits)
|
||||||
|
|
||||||
void finalize_target_page_bits(void)
|
void finalize_target_page_bits(void)
|
||||||
{
|
{
|
||||||
#ifdef TARGET_PAGE_BITS_VARY
|
|
||||||
finalize_target_page_bits_common(TARGET_PAGE_BITS_MIN);
|
finalize_target_page_bits_common(TARGET_PAGE_BITS_MIN);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue