summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_slab_heap.h
blob: 81d472a3ee2341be0fb1e9b4b7dddad7baec2bc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2020 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

namespace Kernel {

class KernelCore;

/// This is a placeholder class to manage slab heaps for kernel objects. For now, we just allocate
/// these with new/delete, but this can be re-implemented later to allocate these in emulated
/// memory.

template <typename T>
class KSlabHeap final : NonCopyable {
public:
    KSlabHeap() = default;

    void Initialize([[maybe_unused]] void* memory, [[maybe_unused]] std::size_t memory_size) {
        // Placeholder that should initialize the backing slab heap implementation.
    }

    T* Allocate() {
        return new T();
    }

    T* AllocateWithKernel(KernelCore& kernel) {
        return new T(kernel);
    }

    void Free(T* obj) {
        delete obj;
    }
};

} // namespace Kernel