aboutsummaryrefslogtreecommitdiff
path: root/include/exec/cpu-common.h
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2022-01-20 01:08:36 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-01-27 12:08:56 +0100
commitb269a70810aabe1dd5b2e475a25976fb7d6a0f3b (patch)
tree780fd8def3e741cbaa802f0f713ca5e2f5b1e904 /include/exec/cpu-common.h
parentde47b0ff40cae050a1ab674d7f4f097c12c527c6 (diff)
downloadqemu-b269a70810aabe1dd5b2e475a25976fb7d6a0f3b.zip
qemu-b269a70810aabe1dd5b2e475a25976fb7d6a0f3b.tar.gz
qemu-b269a70810aabe1dd5b2e475a25976fb7d6a0f3b.tar.bz2
exec/cpu: Make host pages variables / macros 'target agnostic'
"host" pages are related to the *host* not the *target*, thus the qemu_host_page_size / qemu_host_page_mask variables and the HOST_PAGE_ALIGN() / REAL_HOST_PAGE_ALIGN() macros can be moved to "exec/cpu-common.h" which is target agnostic. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: David Hildenbrand <david@redhat.com> Message-Id: <20220120000836.229419-1-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/exec/cpu-common.h')
-rw-r--r--include/exec/cpu-common.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 039d422..de5f444 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -7,6 +7,15 @@
#include "exec/hwaddr.h"
#endif
+/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
+ * when intptr_t is 32-bit and we are aligning a long long.
+ */
+extern uintptr_t qemu_host_page_size;
+extern intptr_t qemu_host_page_mask;
+
+#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
+#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
+
/* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
void qemu_init_cpu_list(void);
void cpu_list_lock(void);