mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00

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>
26 lines
551 B
C
26 lines
551 B
C
/*
|
|
* QEMU page values getters (target independent)
|
|
*
|
|
* Copyright (c) 2003 Fabrice Bellard
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "exec/target_page.h"
|
|
|
|
int qemu_target_page_bits_min(void)
|
|
{
|
|
return TARGET_PAGE_BITS_MIN;
|
|
}
|
|
|
|
/* Convert target pages to MiB (2**20). */
|
|
size_t qemu_target_pages_to_MiB(size_t pages)
|
|
{
|
|
int page_bits = TARGET_PAGE_BITS;
|
|
|
|
/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
|
|
g_assert(page_bits < 20);
|
|
|
|
return pages >> (20 - page_bits);
|
|
}
|