From 118f3054ea5241cce95710d1b7c4272e0855e8e7 Mon Sep 17 00:00:00 2001
From: tevador <37503146+tevador@users.noreply.github.com>
Date: Sat, 22 Jun 2019 15:55:31 +0200
Subject: [PATCH] Large page support for FreeBSD (#74)

---
 src/virtual_memory.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp
index b37a75c..c27a536 100644
--- a/src/virtual_memory.cpp
+++ b/src/virtual_memory.cpp
@@ -115,6 +115,8 @@ void* allocLargePagesMemory(std::size_t bytes) {
 #else
 #ifdef __APPLE__
 	mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0);
+#elif defined(__FreeBSD__)
+	mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0);
 #else
 	mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, -1, 0);
 #endif