summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/init
diff options
context:
space:
mode:
authorGravatar bunnei2021-05-20 18:15:59 -0700
committerGravatar bunnei2021-05-20 21:41:52 -0700
commitb4fc2e52a2d51f8958b77fbe4fb76c854cd4593b (patch)
tree64efafb1dfba8ba239d84d35fd78a584a6f4cb3a /src/core/hle/kernel/init
parentRevert "WORKAROUND: Do not use slab heap while we track down issues with reso... (diff)
downloadyuzu-b4fc2e52a2d51f8958b77fbe4fb76c854cd4593b.tar.gz
yuzu-b4fc2e52a2d51f8958b77fbe4fb76c854cd4593b.tar.xz
yuzu-b4fc2e52a2d51f8958b77fbe4fb76c854cd4593b.zip
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.cpp10
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;
70template <typename T> 70template <typename T>
71VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAddr address, 71VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAddr address,
72 size_t num_objects) { 72 size_t num_objects) {
73 // TODO(bunnei): This is just a place holder. We should initialize the appropriate KSlabHeap for
74 // kernel object type T with the backing kernel memory pointer once we emulate kernel memory.
75
73 const size_t size = Common::AlignUp(sizeof(T) * num_objects, alignof(void*)); 76 const size_t size = Common::AlignUp(sizeof(T) * num_objects, alignof(void*));
74 VAddr start = Common::AlignUp(address, alignof(T)); 77 VAddr start = Common::AlignUp(address, alignof(T));
75 78
79 // This is intentionally empty. Once KSlabHeap is fully implemented, we can replace this with
80 // the pointer to emulated memory to pass along. Until then, KSlabHeap will just allocate/free
81 // host memory.
82 void* backing_kernel_memory{};
83
76 if (size > 0) { 84 if (size > 0) {
77 const KMemoryRegion* region = memory_layout.FindVirtual(start + size - 1); 85 const KMemoryRegion* region = memory_layout.FindVirtual(start + size - 1);
78 ASSERT(region != nullptr); 86 ASSERT(region != nullptr);
79 ASSERT(region->IsDerivedFrom(KMemoryRegionType_KernelSlab)); 87 ASSERT(region->IsDerivedFrom(KMemoryRegionType_KernelSlab));
80 T::InitializeSlabHeap(system.Kernel(), system.Memory().GetKernelBuffer(start, size), size); 88 T::InitializeSlabHeap(system.Kernel(), backing_kernel_memory, size);
81 } 89 }
82 90
83 return start + size; 91 return start + size;