diff --git a/app/build.gradle b/app/build.gradle index 671b3cf7..31b782c2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion '29.0.2' defaultConfig { applicationId "skyline.emu" - minSdkVersion 24 + minSdkVersion 26 targetSdkVersion 29 versionCode 3 versionName "0.3" diff --git a/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp b/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp index 5991799c..15b08b8f 100644 --- a/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp +++ b/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp @@ -1,22 +1,17 @@ #include "KSharedMemory.h" #include -#include +#include #include -constexpr const char *ASHMEM_NAME_DEF = "dev/ashmem"; -constexpr int ASHMEM_SET_SIZE = 0x40087703; - namespace skyline::kernel::type { u64 MapSharedFunc(u64 address, size_t size, u64 perms, u64 fd) { return reinterpret_cast(mmap(reinterpret_cast(address), size, static_cast(perms), MAP_SHARED | ((address) ? MAP_FIXED : 0), static_cast(fd), 0)); // NOLINT(hicpp-signed-bitwise) } KSharedMemory::KSharedMemory(const DeviceState &state, pid_t pid, u64 kaddress, size_t ksize, const memory::Permission localPermission, const memory::Permission remotePermission, memory::Type type) : kaddress(kaddress), ksize(ksize), localPermission(localPermission), remotePermission(remotePermission), type(type), owner(pid), KObject(state, KType::KSharedMemory) { - fd = open(ASHMEM_NAME_DEF, O_RDWR | O_CLOEXEC); // NOLINT(hicpp-signed-bitwise) + fd = ASharedMemory_create("", ksize); if (fd < 0) - throw exception("An error occurred while opening {}: {}", ASHMEM_NAME_DEF, fd); - if (ioctl(fd, ASHMEM_SET_SIZE, ksize) < 0) // NOLINT(hicpp-signed-bitwise) - throw exception("An error occurred while setting shared memory size: {}", ksize); + throw exception("An error occurred while creating shared memory: {}", fd); kaddress = MapSharedFunc(kaddress, ksize, static_cast(pid ? remotePermission.Get() : localPermission.Get()), static_cast(fd)); if (kaddress == reinterpret_cast(MAP_FAILED)) // NOLINT(hicpp-signed-bitwise) throw exception("An occurred while mapping shared region: {}", strerror(errno));