diff options
| author | bunnei <bunneidev@gmail.com> | 2021-05-20 18:15:59 -0700 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2021-05-20 21:41:52 -0700 |
| commit | b4fc2e52a2d51f8958b77fbe4fb76c854cd4593b (patch) | |
| tree | 64efafb1dfba8ba239d84d35fd78a584a6f4cb3a /src/core/hle/kernel/init | |
| parent | 7331bb9d8d679e9f53b4888f042a347c23b1eb74 (diff) | |
hle: kernel: Use host memory allocations for KSlabMemory.
- There are some issues with the current workaround, we will just use host memory until we have a complete kernel memory implementation.
Diffstat (limited to 'src/core/hle/kernel/init')
| -rw-r--r-- | src/core/hle/kernel/init/init_slab_setup.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp index 69ae405e6..10edede17 100644 --- a/src/core/hle/kernel/init/init_slab_setup.cpp +++ b/src/core/hle/kernel/init/init_slab_setup.cpp @@ -70,14 +70,22 @@ constexpr size_t SlabCountExtraKThread = 160; template <typename T> VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAddr address, size_t num_objects) { + // TODO(bunnei): This is just a place holder. We should initialize the appropriate KSlabHeap for + // kernel object type T with the backing kernel memory pointer once we emulate kernel memory. + const size_t size = Common::AlignUp(sizeof(T) * num_objects, alignof(void*)); VAddr start = Common::AlignUp(address, alignof(T)); + // This is intentionally empty. Once KSlabHeap is fully implemented, we can replace this with + // the pointer to emulated memory to pass along. Until then, KSlabHeap will just allocate/free + // host memory. + void* backing_kernel_memory{}; + if (size > 0) { const KMemoryRegion* region = memory_layout.FindVirtual(start + size - 1); ASSERT(region != nullptr); ASSERT(region->IsDerivedFrom(KMemoryRegionType_KernelSlab)); - T::InitializeSlabHeap(system.Kernel(), system.Memory().GetKernelBuffer(start, size), size); + T::InitializeSlabHeap(system.Kernel(), backing_kernel_memory, size); } return start + size; |
