Skip to contentSkip to conversation

bsd-user: Specify host page alignment if none specified

PATCH In review Warner Losh 2 participants 2 messages Jul 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bsd-user: Specify host page alignment if none specified

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.

---
 bsd-user/mmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
bsd-user/mmap.c +2 -1
index 74ed00b9fe3..b62a69bd075 100644
@@ -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;
Signature · 1 line
2.40.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Warner Losh

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.

---
  bsd-user/mmap.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

and queued.

r~

Quoted 15 lines
bsd-user/mmap.c +2 -1
index 74ed00b9fe3..b62a69bd075 100644
@@ -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;