Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

kernel/process: Store the total size of the code memory loaded

Lioncash4ee615b15a10
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index bb26737325..819d2cb0bc 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -228,6 +228,8 @@ void Process::LoadModule(CodeSet module_, VAddr base_addr) {
MapSegment(module_.RODataSegment(), VMAPermission::Read, MemoryState::CodeData);
MapSegment(module_.DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeData);
+ code_memory_size += module_.memory->size();
+
// Clear instruction cache in CPU JIT
system.InvalidateCpuInstructionCaches();
}
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index ee559fe4ce..16193ca563 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -250,6 +250,9 @@ private:
/// Size of the main thread's stack in bytes.
u64 main_thread_stack_size = 0;
+ /// Size of the loaded code memory in bytes.
+ u64 code_memory_size = 0;
+
/// Current status of the process
ProcessStatus status;