namespace llvm {
namespace exegesis {
+#ifdef __arm__
+static constexpr const intptr_t VAddressSpaceCeiling = 0xC0000000;
+#else
static constexpr const intptr_t VAddressSpaceCeiling = 0x0000800000000000;
+#endif
// If a positive value is specified, we are going to use the LBR in
// latency-mode.
#define MAP_FIXED_NOREPLACE MAP_FIXED
#endif
+// 32 bit ARM doesn't have mmap and uses mmap2 instead. The only difference
+// between the two syscalls is that mmap2's offset parameter is in terms 4096
+// byte offsets rather than individual bytes, so for our purposes they are
+// effectively the same as all ofsets here are set to 0.
+#ifdef __arm__
+#define SYS_mmap SYS_mmap2
+#endif
+
std::vector<MCInst>
ExegesisX86Target::generateMmap(intptr_t Address, size_t Length,
intptr_t FileDescriptorAddress) const {
#define MAP_FIXED_NOREPLACE MAP_FIXED
#endif
+// 32 bit ARM doesn't have mmap and uses mmap2 instead. The only difference
+// between the two syscalls is that mmap2's offset parameter is in terms 4096
+// byte offsets rather than individual bytes, so for our purposes they are
+// effectively the same as all ofsets here are set to 0.
+#ifdef __arm__
+#define SYS_mmap SYS_mmap2
+#endif
+
TEST_F(X86Core2TargetTest, GenerateMmapTest) {
EXPECT_THAT(State.getExegesisTarget().generateMmap(0x1000, 4096, 0x2000),
ElementsAre(IsMovImmediate(X86::MOV64ri, X86::RDI, 0x1000),