diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/system_archive/ng_word.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/system_archive/system_archive.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/ldr/ldr.cpp | 10 | ||||
| -rw-r--r-- | src/core/memory.cpp | 8 |
4 files changed, 13 insertions, 12 deletions
diff --git a/src/core/file_sys/system_archive/ng_word.cpp b/src/core/file_sys/system_archive/ng_word.cpp index d0acdbd49..a24f1e496 100644 --- a/src/core/file_sys/system_archive/ng_word.cpp +++ b/src/core/file_sys/system_archive/ng_word.cpp | |||
| @@ -26,7 +26,7 @@ constexpr std::array<u8, 30> WORD_TXT{ | |||
| 26 | VirtualDir NgWord1() { | 26 | VirtualDir NgWord1() { |
| 27 | std::vector<VirtualFile> files(NgWord1Data::NUMBER_WORD_TXT_FILES); | 27 | std::vector<VirtualFile> files(NgWord1Data::NUMBER_WORD_TXT_FILES); |
| 28 | 28 | ||
| 29 | for (std::size_t i = 0; i < NgWord1Data::NUMBER_WORD_TXT_FILES; ++i) { | 29 | for (std::size_t i = 0; i < files.size(); ++i) { |
| 30 | files[i] = std::make_shared<ArrayVfsFile<NgWord1Data::WORD_TXT.size()>>( | 30 | files[i] = std::make_shared<ArrayVfsFile<NgWord1Data::WORD_TXT.size()>>( |
| 31 | NgWord1Data::WORD_TXT, fmt::format("{}.txt", i)); | 31 | NgWord1Data::WORD_TXT, fmt::format("{}.txt", i)); |
| 32 | } | 32 | } |
diff --git a/src/core/file_sys/system_archive/system_archive.cpp b/src/core/file_sys/system_archive/system_archive.cpp index c9c40a07d..d3883267c 100644 --- a/src/core/file_sys/system_archive/system_archive.cpp +++ b/src/core/file_sys/system_archive/system_archive.cpp | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <functional> | ||
| 6 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 7 | #include "core/file_sys/romfs.h" | 6 | #include "core/file_sys/romfs.h" |
| 8 | #include "core/file_sys/system_archive/ng_word.h" | 7 | #include "core/file_sys/system_archive/ng_word.h" |
| @@ -13,7 +12,7 @@ namespace FileSys::SystemArchive { | |||
| 13 | constexpr u64 SYSTEM_ARCHIVE_BASE_TITLE_ID = 0x0100000000000800; | 12 | constexpr u64 SYSTEM_ARCHIVE_BASE_TITLE_ID = 0x0100000000000800; |
| 14 | constexpr std::size_t SYSTEM_ARCHIVE_COUNT = 0x28; | 13 | constexpr std::size_t SYSTEM_ARCHIVE_COUNT = 0x28; |
| 15 | 14 | ||
| 16 | using SystemArchiveSupplier = std::function<VirtualDir()>; | 15 | using SystemArchiveSupplier = VirtualDir (*)(); |
| 17 | 16 | ||
| 18 | struct SystemArchiveDescriptor { | 17 | struct SystemArchiveDescriptor { |
| 19 | u64 title_id; | 18 | u64 title_id; |
| @@ -21,7 +20,7 @@ struct SystemArchiveDescriptor { | |||
| 21 | SystemArchiveSupplier supplier; | 20 | SystemArchiveSupplier supplier; |
| 22 | }; | 21 | }; |
| 23 | 22 | ||
| 24 | const std::array<SystemArchiveDescriptor, SYSTEM_ARCHIVE_COUNT> SYSTEM_ARCHIVES = {{ | 23 | constexpr std::array<SystemArchiveDescriptor, SYSTEM_ARCHIVE_COUNT> SYSTEM_ARCHIVES{{ |
| 25 | {0x0100000000000800, "CertStore", nullptr}, | 24 | {0x0100000000000800, "CertStore", nullptr}, |
| 26 | {0x0100000000000801, "ErrorMessage", nullptr}, | 25 | {0x0100000000000801, "ErrorMessage", nullptr}, |
| 27 | {0x0100000000000802, "MiiModel", nullptr}, | 26 | {0x0100000000000802, "MiiModel", nullptr}, |
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index ca119dd3a..453d90a22 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp | |||
| @@ -335,10 +335,7 @@ public: | |||
| 335 | vm_manager.ReprotectRange(*map_address + header.rw_offset, header.rw_size, | 335 | vm_manager.ReprotectRange(*map_address + header.rw_offset, header.rw_size, |
| 336 | Kernel::VMAPermission::ReadWrite); | 336 | Kernel::VMAPermission::ReadWrite); |
| 337 | 337 | ||
| 338 | Core::System::GetInstance().ArmInterface(0).ClearInstructionCache(); | 338 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); |
| 339 | Core::System::GetInstance().ArmInterface(1).ClearInstructionCache(); | ||
| 340 | Core::System::GetInstance().ArmInterface(2).ClearInstructionCache(); | ||
| 341 | Core::System::GetInstance().ArmInterface(3).ClearInstructionCache(); | ||
| 342 | 339 | ||
| 343 | nro.insert_or_assign(*map_address, NROInfo{hash, nro_size + bss_size}); | 340 | nro.insert_or_assign(*map_address, NROInfo{hash, nro_size + bss_size}); |
| 344 | 341 | ||
| @@ -391,10 +388,7 @@ public: | |||
| 391 | Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); | 388 | Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); |
| 392 | ASSERT(process->UnmapMemory(mapped_addr, 0, nro_size) == RESULT_SUCCESS); | 389 | ASSERT(process->UnmapMemory(mapped_addr, 0, nro_size) == RESULT_SUCCESS); |
| 393 | 390 | ||
| 394 | Core::System::GetInstance().ArmInterface(0).ClearInstructionCache(); | 391 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); |
| 395 | Core::System::GetInstance().ArmInterface(1).ClearInstructionCache(); | ||
| 396 | Core::System::GetInstance().ArmInterface(2).ClearInstructionCache(); | ||
| 397 | Core::System::GetInstance().ArmInterface(3).ClearInstructionCache(); | ||
| 398 | 392 | ||
| 399 | nro.erase(iter); | 393 | nro.erase(iter); |
| 400 | IPC::ResponseBuilder rb{ctx, 2}; | 394 | IPC::ResponseBuilder rb{ctx, 2}; |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 70abd856a..41fd2a6a0 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -53,6 +53,14 @@ void PageTable::Resize(std::size_t address_space_width_in_bits) { | |||
| 53 | 53 | ||
| 54 | pointers.resize(num_page_table_entries); | 54 | pointers.resize(num_page_table_entries); |
| 55 | attributes.resize(num_page_table_entries); | 55 | attributes.resize(num_page_table_entries); |
| 56 | |||
| 57 | // The default is a 39-bit address space, which causes an initial 1GB allocation size. If the | ||
| 58 | // vector size is subsequently decreased (via resize), the vector might not automatically | ||
| 59 | // actually reallocate/resize its underlying allocation, which wastes up to ~800 MB for | ||
| 60 | // 36-bit titles. Call shrink_to_fit to reduce capacity to what's actually in use. | ||
| 61 | |||
| 62 | pointers.shrink_to_fit(); | ||
| 63 | attributes.shrink_to_fit(); | ||
| 56 | } | 64 | } |
| 57 | 65 | ||
| 58 | static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { | 66 | static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { |