exec: Declare abi_ptr type in its own 'abi_ptr.h' header
[qemu/armbru.git] / page-target.c
blob82211c85937a07923623755fc6709218dec06109
1 /*
2 * QEMU page values getters (target independent)
4 * Copyright (c) 2003 Fabrice Bellard
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 */
9 #include "qemu/osdep.h"
10 #include "exec/target_page.h"
11 #include "exec/cpu-defs.h"
12 #include "cpu.h"
13 #include "exec/cpu-all.h"
15 size_t qemu_target_page_size(void)
17 return TARGET_PAGE_SIZE;
20 int qemu_target_page_mask(void)
22 return TARGET_PAGE_MASK;
25 int qemu_target_page_bits(void)
27 return TARGET_PAGE_BITS;
30 int qemu_target_page_bits_min(void)
32 return TARGET_PAGE_BITS_MIN;
35 /* Convert target pages to MiB (2**20). */
36 size_t qemu_target_pages_to_MiB(size_t pages)
38 int page_bits = TARGET_PAGE_BITS;
40 /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
41 g_assert(page_bits < 20);
43 return pages >> (20 - page_bits);