From a54f5ff578e58e7e2750b5653d360daf1e7eb6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Sat, 14 Sep 2019 18:11:00 +0530 Subject: [PATCH] Milestone 2 - Memory & IPC Marshalling This commit introduces a new memory model that supports true shared memory with separate permissions for remote and local processes, implements svcQueryMemory and completes svcGetInfo further, adds IPC support with the IpcRequest and IpcResponse classes. --- .gitignore | 8 +- .idea/codeStyles/Project.xml | 8 + .idea/discord.xml | 3 - app/CMakeLists.txt | 3 +- app/src/main/AndroidManifest.xml | 27 +- app/src/main/cpp/lightswitch.cpp | 1 + app/src/main/cpp/switch/common.cpp | 41 +-- app/src/main/cpp/switch/common.h | 166 +++++------- app/src/main/cpp/switch/kernel/ipc.cpp | 203 +++++++++------ app/src/main/cpp/switch/kernel/ipc.h | 244 ++++++++++++++---- app/src/main/cpp/switch/kernel/service.cpp | 1 + app/src/main/cpp/switch/kernel/service.h | 6 +- .../cpp/switch/kernel/services/BaseService.h | 14 +- app/src/main/cpp/switch/kernel/svc.cpp | 126 +++++---- app/src/main/cpp/switch/kernel/svc.h | 174 +++++++------ .../main/cpp/switch/kernel/types/KObject.h | 8 +- .../switch/kernel/types/KPrivateMemory.cpp | 76 ++++++ .../cpp/switch/kernel/types/KPrivateMemory.h | 50 ++++ .../main/cpp/switch/kernel/types/KProcess.cpp | 135 ++-------- .../main/cpp/switch/kernel/types/KProcess.h | 101 +++----- .../cpp/switch/kernel/types/KSharedMemory.cpp | 119 +++++++++ .../cpp/switch/kernel/types/KSharedMemory.h | 67 +++++ .../main/cpp/switch/kernel/types/KThread.cpp | 10 +- .../main/cpp/switch/kernel/types/KThread.h | 20 +- app/src/main/cpp/switch/loader/loader.h | 6 +- app/src/main/cpp/switch/loader/nro.cpp | 32 ++- app/src/main/cpp/switch/loader/nro.h | 30 +-- app/src/main/cpp/switch/memory.h | 110 ++++++++ app/src/main/cpp/switch/nce.cpp | 202 ++++----------- app/src/main/cpp/switch/nce.h | 98 ++----- app/src/main/cpp/switch/os.cpp | 40 +-- app/src/main/cpp/switch/os.h | 15 +- .../java/emu/lightswitch/GameAdapter.java | 1 + .../java/emu/lightswitch/HeaderAdapter.java | 6 +- .../java/emu/lightswitch/LogActivity.java | 110 +++++--- .../main/java/emu/lightswitch/LogAdapter.java | 6 +- .../java/emu/lightswitch/MainActivity.java | 2 + .../emu/lightswitch/SettingsActivity.java | 1 + .../drawable-v24/ic_launcher_foreground.xml | 46 ++-- app/src/main/res/drawable/ic_clear.xml | 13 +- .../res/drawable/ic_launcher_background.xml | 240 +++++++++++------ app/src/main/res/drawable/ic_log.xml | 13 +- app/src/main/res/drawable/ic_missing_icon.xml | 13 +- app/src/main/res/drawable/ic_refresh.xml | 12 +- app/src/main/res/drawable/ic_search.xml | 14 +- app/src/main/res/drawable/ic_settings.xml | 13 +- app/src/main/res/drawable/ic_share.xml | 14 +- app/src/main/res/layout/game_item.xml | 52 ++-- app/src/main/res/layout/log_activity.xml | 46 ++-- app/src/main/res/layout/log_item.xml | 41 +-- app/src/main/res/layout/main_activity.xml | 60 ++--- app/src/main/res/layout/section_item.xml | 26 +- app/src/main/res/layout/settings_activity.xml | 34 +-- app/src/main/res/menu/toolbar_log.xml | 12 +- app/src/main/res/menu/toolbar_main.xml | 30 +-- .../res/mipmap-anydpi-v26/ic_launcher.xml | 6 +- .../mipmap-anydpi-v26/ic_launcher_round.xml | 6 +- app/src/main/res/values/styles.xml | 1 + app/src/main/res/xml/preferences.xml | 46 ++-- 59 files changed, 1752 insertions(+), 1256 deletions(-) create mode 100644 app/src/main/cpp/switch/kernel/types/KPrivateMemory.cpp create mode 100644 app/src/main/cpp/switch/kernel/types/KPrivateMemory.h create mode 100644 app/src/main/cpp/switch/kernel/types/KSharedMemory.cpp create mode 100644 app/src/main/cpp/switch/kernel/types/KSharedMemory.h create mode 100644 app/src/main/cpp/switch/memory.h diff --git a/.gitignore b/.gitignore index 687392f0..28e373e5 100644 --- a/.gitignore +++ b/.gitignore @@ -61,7 +61,8 @@ build/ local.properties # External native build folder generated in Android Studio 2.2 and later -.externalNativeBuild +.externalNativeBuild/ +.cxx/ # IntelliJ out/ @@ -93,6 +94,5 @@ captures/ # VSCode .vscode/ -# Android Studio -.cxx/ - +# Discord plugin for IntelliJ IDEA +.idea\discord.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index a952188a..d315ac74 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -4,6 +4,8 @@