diff mbox series

[v2] bsd-user: Specify host page alignment if none specified

Message ID 20230728162927.5009-1-imp@bsdimp.com
State New
Headers show
Series [v2] bsd-user: Specify host page alignment if none specified | expand

Commit Message

Warner Losh July 28, 2023, 4:29 p.m. UTC
We're hitting an assert when we pass in alignment == 0 since that's not
a power of two. so pass in the ideal page size.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/mmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Henderson July 28, 2023, 4:46 p.m. UTC | #1
On 7/28/23 09:29, Warner Losh wrote:
> We're hitting an assert when we pass in alignment == 0 since that's not
> a power of two. so pass in the ideal page size.
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>   bsd-user/mmap.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

and queued.


r~
> 
> diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
> index 74ed00b9fe3..b62a69bd075 100644
> --- a/bsd-user/mmap.c
> +++ b/bsd-user/mmap.c
> @@ -260,7 +260,8 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size,
>   
>       if (reserved_va) {
>           return mmap_find_vma_reserved(start, size,
> -            (alignment != 0 ? 1 << alignment : 0));
> +            (alignment != 0 ? 1 << alignment :
> +             MAX(qemu_host_page_size, TARGET_PAGE_SIZE)));
>       }
>   
>       addr = start;
diff mbox series

Patch

diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 74ed00b9fe3..b62a69bd075 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -260,7 +260,8 @@  static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size,
 
     if (reserved_va) {
         return mmap_find_vma_reserved(start, size,
-            (alignment != 0 ? 1 << alignment : 0));
+            (alignment != 0 ? 1 << alignment :
+             MAX(qemu_host_page_size, TARGET_PAGE_SIZE)));
     }
 
     addr = start;