aboutsummaryrefslogtreecommitdiff
path: root/include/exec/target_page.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/exec/target_page.h')
-rw-r--r--include/exec/target_page.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/exec/target_page.h b/include/exec/target_page.h
index ca0ebbc..813591c 100644
--- a/include/exec/target_page.h
+++ b/include/exec/target_page.h
@@ -62,6 +62,15 @@ static inline int qemu_target_page_bits(void)
return TARGET_PAGE_BITS;
}
-size_t qemu_target_pages_to_MiB(size_t pages);
+/* Convert target pages to MiB (2**20). */
+static inline 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);
+}
#endif