From 00cdc1fd6f26028f7af8e7dcd1ed7e02693d8df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Tue, 21 Jan 2020 12:46:57 +0530 Subject: [PATCH] Refactor the memory implementation and add Regions This commit does a major refactor of the memory implementation, it forms a memory map which is far cleaner than trying to access it through a handle table lookup. In addition, it creates a common interface for all memory kernel objects: KMemory from which all other kernel memory objects inherit. This allows doing resizing, permission change, etc without casting to the base memory type. --- .idea/codeStyles/Project.xml | 9 +- app/CMakeLists.txt | 1 + app/src/main/cpp/skyline/common.h | 68 +++- app/src/main/cpp/skyline/kernel/ipc.cpp | 8 +- app/src/main/cpp/skyline/kernel/ipc.h | 8 +- app/src/main/cpp/skyline/kernel/memory.cpp | 158 ++++++++ app/src/main/cpp/skyline/kernel/memory.h | 357 ++++++++++++++++++ app/src/main/cpp/skyline/kernel/svc.cpp | 274 +++++++------- app/src/main/cpp/skyline/kernel/svc.h | 9 +- .../main/cpp/skyline/kernel/types/KMemory.h | 39 ++ .../skyline/kernel/types/KPrivateMemory.cpp | 97 +++-- .../cpp/skyline/kernel/types/KPrivateMemory.h | 50 +-- .../cpp/skyline/kernel/types/KProcess.cpp | 92 +++-- .../main/cpp/skyline/kernel/types/KProcess.h | 95 ++--- .../skyline/kernel/types/KSharedMemory.cpp | 78 ++-- .../cpp/skyline/kernel/types/KSharedMemory.h | 54 ++- .../main/cpp/skyline/kernel/types/KThread.cpp | 4 +- .../skyline/kernel/types/KTransferMemory.cpp | 206 ++++++---- .../skyline/kernel/types/KTransferMemory.h | 57 ++- app/src/main/cpp/skyline/loader/loader.h | 2 - app/src/main/cpp/skyline/loader/nro.cpp | 35 +- app/src/main/cpp/skyline/memory.h | 138 ------- app/src/main/cpp/skyline/nce.cpp | 14 +- app/src/main/cpp/skyline/nce.h | 7 +- app/src/main/cpp/skyline/nce/guest.cpp | 14 + app/src/main/cpp/skyline/nce/guest.h | 4 +- app/src/main/cpp/skyline/nce/guest_common.h | 11 +- app/src/main/cpp/skyline/os.cpp | 13 +- app/src/main/cpp/skyline/os.h | 1 + app/src/main/cpp/skyline/services/hid/hid.cpp | 2 +- 30 files changed, 1273 insertions(+), 632 deletions(-) create mode 100644 app/src/main/cpp/skyline/kernel/memory.cpp create mode 100644 app/src/main/cpp/skyline/kernel/memory.h create mode 100644 app/src/main/cpp/skyline/kernel/types/KMemory.h delete mode 100644 app/src/main/cpp/skyline/memory.h diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 7e6f4752..a4a819fd 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -13,12 +13,9 @@