aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@bsdimp.com>2024-06-06 22:06:45 -0600
committerWarner Losh <imp@bsdimp.com>2024-06-09 10:30:25 -0600
commitba379542bf026313d3c6aa1b46da3f2520927a4f (patch)
tree61f4dff25ec4bbd19167383e21408e0dfd859784
parent1b6f1b2e820302f08f262a09551767f14c0f98a6 (diff)
bsd-user: port linux-user:ff8a8bbc2ad1 for variable page sizes
Bring in Richard Henderson's ff8a8bbc2ad1 to finalize the page size to allow TARGET_PAGE_BITS_VARY. bsd-user's "blitz" fork has aarch64 support, which is now variable page size. Add support for it here, even though it's effectively a nop in upstream qemu. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--bsd-user/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 29a629d877..d685734d08 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -46,6 +46,7 @@
#include "crypto/init.h"
#include "qemu/guest-random.h"
#include "gdbstub/user.h"
+#include "exec/page-vary.h"
#include "host-os.h"
#include "target_arch_cpu.h"
@@ -291,6 +292,7 @@ int main(int argc, char **argv)
char **target_environ, **wrk;
envlist_t *envlist = NULL;
char *argv0 = NULL;
+ int host_page_size;
adjust_ssize();
@@ -476,6 +478,16 @@ int main(int argc, char **argv)
opt_one_insn_per_tb, &error_abort);
ac->init_machine(NULL);
}
+
+ /*
+ * Finalize page size before creating CPUs.
+ * This will do nothing if !TARGET_PAGE_BITS_VARY.
+ * The most efficient setting is to match the host.
+ */
+ host_page_size = qemu_real_host_page_size();
+ set_preferred_target_page_bits(ctz32(host_page_size));
+ finalize_target_page_bits();
+
cpu = cpu_create(cpu_type);
env = cpu_env(cpu);
cpu_reset(cpu);