Browse Source

fix aarch64 gcc

liz-dynarmic-macos-fbsd-port
lizzie 1 month ago
committed by Caio Oliveira
parent
commit
eb99474266
No known key found for this signature in database GPG Key ID: 362DA3DC1901E080
  1. 15
      src/common/host_memory.cpp

15
src/common/host_memory.cpp

@ -619,10 +619,10 @@ public:
prot_flags |= PROT_READ; prot_flags |= PROT_READ;
if (True(perms & MemoryPermission::Write)) if (True(perms & MemoryPermission::Write))
prot_flags |= PROT_WRITE; prot_flags |= PROT_WRITE;
// W^X only supported with NCE
#if defined(ARCHITECTURE_arm64) && defined(HAS_NCE)
// W^X only supported (and needed) with NCE
#ifdef HAS_NCE
if (True(perms & MemoryPermission::Execute)) if (True(perms & MemoryPermission::Execute))
flags |= PROT_EXEC;
prot_flags |= PROT_EXEC;
#endif #endif
int flags = (fd > 0 ? MAP_SHARED : MAP_PRIVATE) | MAP_FIXED; int flags = (fd > 0 ? MAP_SHARED : MAP_PRIVATE) | MAP_FIXED;
void* ret = mmap(virtual_base + virtual_offset, length, prot_flags, flags, fd, host_offset); void* ret = mmap(virtual_base + virtual_offset, length, prot_flags, flags, fd, host_offset);
@ -650,16 +650,13 @@ public:
AdjustMap(&virtual_offset, &length); AdjustMap(&virtual_offset, &length);
int flags = PROT_NONE; int flags = PROT_NONE;
if (read) {
if (read)
flags |= PROT_READ; flags |= PROT_READ;
}
if (write) {
if (write)
flags |= PROT_WRITE; flags |= PROT_WRITE;
}
#ifdef HAS_NCE #ifdef HAS_NCE
if (execute) {
if (execute)
flags |= PROT_EXEC; flags |= PROT_EXEC;
}
#endif #endif
int ret = mprotect(virtual_base + virtual_offset, length, flags); int ret = mprotect(virtual_base + virtual_offset, length, flags);
ASSERT_MSG(ret == 0, "mprotect failed: {}", strerror(errno)); ASSERT_MSG(ret == 0, "mprotect failed: {}", strerror(errno));

Loading…
Cancel
Save