diff mbox series

[v3,01/11] Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>

Message ID 20230421164200.2913-2-kariem.taha2.7@gmail.com
State New
Headers show
Series Contribution task implementations, for the 'FreeBSD user emulation improvements' project. | expand

Commit Message

Karim Taha April 21, 2023, 4:41 p.m. UTC
From: Warner Losh <imp@bsdimp.com>

Intialize guest_base in bsd-user/main.c.

Allow guest_base to be initialized on 64-bit hosts, the initial value is used by g2h_untagged function defined in include/exec/cpu_ldst.h

Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
---
 bsd-user/main.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Warner Losh April 21, 2023, 10:43 p.m. UTC | #1
On Fri, Apr 21, 2023 at 10:42 AM Karim Taha <kariem.taha2.7@gmail.com>
wrote:

> From: Warner Losh <imp@bsdimp.com>
>
> Intialize guest_base in bsd-user/main.c.
>
> Allow guest_base to be initialized on 64-bit hosts, the initial value is
> used by g2h_untagged function defined in include/exec/cpu_ldst.h
>
> Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
>

This is missing the 'Signed-off-by' line of the author (me in this case).
All the others suffer from this as well.

I'll see about downloading these patches and testing them locally. The
changes themselves look good
to me as far as breaking them up, at least initially. I'll take a closer
look when I queue them for upstreaming
to see what else I can recommend.

Warner

---
>  bsd-user/main.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index babc3b009b..afdc1b5f3c 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -50,8 +50,22 @@
>  #include "target_arch_cpu.h"
>
>  int singlestep;
> -uintptr_t guest_base;
> +
> +/*
> + * Going hand in hand with the va space needed (see below), we need
> + * to find a host address to map the guest to. Assume that qemu
> + * itself doesn't need memory above 32GB (or that we don't collide
> + * with anything interesting). This is selected rather arbitrarily,
> + * but seems to produce good results in tests to date.
> + */
> +# if HOST_LONG_BITS >= 64
> +uintptr_t guest_base = 0x800000000ul;    /* at 32GB */
> +bool have_guest_base = true;
> +#else
> +uintptr_t guest_base;    /* TODO: use sysctl to find big enough hole */
>  bool have_guest_base;
> +#endif
> +
>  /*
>   * When running 32-on-64 we should make sure we can fit all of the
> possible
>   * guest address space into a contiguous chunk of virtual host memory.
> --
> 2.40.0
>
>
diff mbox series

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index babc3b009b..afdc1b5f3c 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -50,8 +50,22 @@ 
 #include "target_arch_cpu.h"
 
 int singlestep;
-uintptr_t guest_base;
+
+/*
+ * Going hand in hand with the va space needed (see below), we need
+ * to find a host address to map the guest to. Assume that qemu
+ * itself doesn't need memory above 32GB (or that we don't collide
+ * with anything interesting). This is selected rather arbitrarily,
+ * but seems to produce good results in tests to date.
+ */
+# if HOST_LONG_BITS >= 64
+uintptr_t guest_base = 0x800000000ul;    /* at 32GB */
+bool have_guest_base = true;
+#else
+uintptr_t guest_base;    /* TODO: use sysctl to find big enough hole */
 bool have_guest_base;
+#endif
+
 /*
  * When running 32-on-64 we should make sure we can fit all of the possible
  * guest address space into a contiguous chunk of virtual host memory.