diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/util/os.h b/projects/rocr-runtime/runtime/hsa-runtime/core/util/os.h
index 087dcfe12c..339cd0a18a 100644
--- a/projects/rocr-runtime/runtime/hsa-runtime/core/util/os.h
+++ b/projects/rocr-runtime/runtime/hsa-runtime/core/util/os.h
@@ -50,6 +50,18 @@
 #include <vector>
 #include "utils.h"
 
+#ifdef __FreeBSD__
+#include <sys/mman.h>
+#ifndef MAP_NORESERVE
+#define MAP_NORESERVE 0
+
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE 0
+#endif
+
+#endif
+#endif
+
 namespace rocr {
 namespace os {
 typedef void* LibHandle;
@@ -70,9 +82,10 @@ static __forceinline std::underlying_type<os_t>::type os_index(os_t val) {
   return std::underlying_type<os_t>::type(val);
 }
 
+// who the fuck uses this
 #ifdef _WIN32
 static const os_t current_os = os_t::OS_WIN;
-#elif __linux__
+#elif defined(__linux__) || defined(__FreeBSD__)
 static const os_t current_os = os_t::OS_LINUX;
 #else
 static_assert(false, "Operating System not detected!");
