|
|
4e0073 |
From f17bc0302100c885c84ebd06cd003aad9774cbb4 Mon Sep 17 00:00:00 2001
|
|
|
4e0073 |
From: Mark Salter <msalter@redhat.com>
|
|
|
4e0073 |
Date: Thu, 13 Mar 2014 13:16:27 -0400
|
|
|
4e0073 |
Subject: [PATCH] Fix aarch64 support for 64K pagesize
|
|
|
4e0073 |
|
|
|
4e0073 |
A given AArch64 kernel may be using 4K or 64K pagesizes. When running
|
|
|
4e0073 |
on a kernel with 64K pagesize, this check causes an intentionally
|
|
|
4e0073 |
generated segfault:
|
|
|
4e0073 |
|
|
|
4e0073 |
js/src/gc/Memory.cpp:
|
|
|
4e0073 |
|
|
|
4e0073 |
void
|
|
|
4e0073 |
InitMemorySubsystem()
|
|
|
4e0073 |
{
|
|
|
4e0073 |
if (size_t(sysconf(_SC_PAGESIZE)) != PageSize)
|
|
|
4e0073 |
MOZ_CRASH();
|
|
|
4e0073 |
}
|
|
|
4e0073 |
|
|
|
4e0073 |
This happens because PageSize is fixed to 4K at build time. This mess
|
|
|
4e0073 |
has been cleaned up in mozjs-24 by eliminating the build-time PageSize
|
|
|
4e0073 |
definition. That is too intrusive for mosjs17, so just set PageSize
|
|
|
4e0073 |
to 64K at build time and eliminate the check. This will work with both
|
|
|
4e0073 |
4K and 64K aarch64 kernels.
|
|
|
4e0073 |
|
|
|
4e0073 |
Signed-off-by: Mark Salter <msalter@redhat.com>
|
|
|
4e0073 |
---
|
|
|
4e0073 |
js/src/gc/Heap.h | 2 +-
|
|
|
4e0073 |
js/src/gc/Memory.cpp | 3 +++
|
|
|
4e0073 |
3 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
4e0073 |
|
|
|
4e0073 |
diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h
|
|
|
4e0073 |
index 1cfd269..f4dbcda 100644
|
|
|
4e0073 |
--- a/js/src/gc/Heap.h
|
|
|
4e0073 |
+++ b/js/src/gc/Heap.h
|
|
|
4e0073 |
@@ -113,7 +113,7 @@ struct Cell
|
|
|
4e0073 |
#if defined(SOLARIS) && (defined(__sparc) || defined(__sparcv9))
|
|
|
4e0073 |
const size_t PageShift = 13;
|
|
|
4e0073 |
const size_t ArenaShift = PageShift;
|
|
|
4e0073 |
-#elif defined(__powerpc__)
|
|
|
4e0073 |
+#elif defined(__powerpc__) || defined(__aarch64__)
|
|
|
4e0073 |
const size_t PageShift = 16;
|
|
|
4e0073 |
const size_t ArenaShift = 12;
|
|
|
4e0073 |
#else
|
|
|
4e0073 |
diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp
|
|
|
4e0073 |
index 5b386a2..e5ad018 100644
|
|
|
4e0073 |
--- a/js/src/gc/Memory.cpp
|
|
|
4e0073 |
+++ b/js/src/gc/Memory.cpp
|
|
|
4e0073 |
@@ -302,8 +302,11 @@ GetPageFaultCount()
|
|
|
4e0073 |
void
|
|
|
4e0073 |
InitMemorySubsystem()
|
|
|
4e0073 |
{
|
|
|
4e0073 |
+ /* aarch64 may have 64KB or 4KB pages */
|
|
|
4e0073 |
+#ifndef __aarch64__
|
|
|
4e0073 |
if (size_t(sysconf(_SC_PAGESIZE)) != PageSize)
|
|
|
4e0073 |
MOZ_CRASH();
|
|
|
4e0073 |
+#endif
|
|
|
4e0073 |
}
|
|
|
4e0073 |
|
|
|
4e0073 |
void *
|
|
|
4e0073 |
--
|
|
|
4e0073 |
1.8.5.3
|
|
|
4e0073 |
|