aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-10-21 16:42:30 +0200
committerSverker Eriksson <[email protected]>2016-10-21 16:42:30 +0200
commit79abd75445dec4f1932868fcc52238a84d94cce0 (patch)
tree7cdb0ae5727da8f8f7b6bba32e748560187cfef3 /erts
parenta7ec329873625dada8defa5d4db06d96cf421a97 (diff)
downloadotp-79abd75445dec4f1932868fcc52238a84d94cce0.tar.gz
otp-79abd75445dec4f1932868fcc52238a84d94cce0.tar.bz2
otp-79abd75445dec4f1932868fcc52238a84d94cce0.zip
erts: Use mprotect for hipe on all arch except x86_64
Only x86_64 needs to reserve low virtual memory for its amd64 small code model.
Diffstat (limited to 'erts')
-rw-r--r--erts/configure.in10
-rw-r--r--erts/emulator/sys/common/erl_mmap.h18
2 files changed, 19 insertions, 9 deletions
diff --git a/erts/configure.in b/erts/configure.in
index 5bd8afeea6..4bff2ebf3d 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -2745,22 +2745,22 @@ AC_CHECK_PROG(M4, m4, m4)
if test X${enable_hipe} != Xno; then
- if test X$ac_cv_sizeof_void_p != X4; then
- dnl HiPE cannot run on 64-bit without MAP_FIXED and MAP_NORESERVE
+ if test X$ac_cv_sizeof_void_p != X4 && test X$ARCH = Xamd64; then
+ dnl HiPE cannot run on x86_64 without MAP_FIXED and MAP_NORESERVE
AC_CHECK_DECLS([MAP_FIXED, MAP_NORESERVE], [], [], [#include <sys/mman.h>])
if test X$ac_cv_have_decl_MAP_FIXED != Xyes || test X$ac_cv_have_decl_MAP_NORESERVE != Xyes; then
if test X${enable_hipe} = Xyes; then
- AC_MSG_ERROR([HiPE on 64-bit needs MAP_FIXED and MAP_NORESERVE flags for mmap()])
+ AC_MSG_ERROR([HiPE on x86_64 needs MAP_FIXED and MAP_NORESERVE flags for mmap()])
else
enable_hipe=no
AC_MSG_WARN([Disable HiPE due to lack of MAP_FIXED and MAP_NORESERVE flags for mmap()])
fi
fi
else
- dnl HiPE cannot run on 32-bit without mprotect()
+ dnl HiPE cannot run without mprotect()
if test X$ac_cv_func_mprotect != Xyes; then
if test X${enable_hipe} = Xyes; then
- AC_MSG_ERROR([HiPE on 32-bit needs mprotect()])
+ AC_MSG_ERROR([HiPE needs mprotect() on $ARCH])
else
enable_hipe=no
AC_MSG_WARN([Disable HiPE due to lack of mprotect()])
diff --git a/erts/emulator/sys/common/erl_mmap.h b/erts/emulator/sys/common/erl_mmap.h
index 92e9eb9e41..1049f7affc 100644
--- a/erts/emulator/sys/common/erl_mmap.h
+++ b/erts/emulator/sys/common/erl_mmap.h
@@ -157,13 +157,23 @@ Eterm erts_mmap_info_options(ErtsMemMapper*,
# include "erl_alloc_types.h"
extern ErtsMemMapper erts_dflt_mmapper;
-# if defined(ARCH_64) && defined(ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION)
+
+# if defined(ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION)
+
+# if defined(ARCH_64)
extern ErtsMemMapper erts_literal_mmapper;
-# ifdef ERTS_ALC_A_EXEC
-# define ERTS_HAVE_EXEC_MMAPPER
+# endif
+
+# if defined(ERTS_ALC_A_EXEC) && defined(__x86_64__)
+ /*
+ * On x86_64, exec_alloc employs its own super carrier 'erts_exec_mmaper'
+ * to ensure low memory for HiPE AMD64 small code model.
+ */
+# define ERTS_HAVE_EXEC_MMAPPER
extern ErtsMemMapper erts_exec_mmapper;
-# endif
# endif
+
+# endif /* ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION */
#endif /* ERTS_WANT_MEM_MAPPERS */
/*#define HARD_DEBUG_MSEG*/