2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2022-03-11 09:18:35 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "core/hle/kernel/memory_types.h"
|
2022-03-18 03:09:01 +01:00
|
|
|
#include "core/hle/kernel/slab_helpers.h"
|
2022-03-11 09:18:35 +01:00
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2022-10-29 22:46:39 +02:00
|
|
|
class KernelCore;
|
|
|
|
|
|
|
|
class KPageBufferSlabHeap : protected impl::KSlabHeapImpl {
|
|
|
|
public:
|
|
|
|
static constexpr size_t BufferSize = PageSize;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void Initialize(Core::System& system);
|
|
|
|
};
|
|
|
|
|
2022-03-11 09:18:35 +01:00
|
|
|
class KPageBuffer final : public KSlabAllocated<KPageBuffer> {
|
|
|
|
public:
|
2022-10-15 03:24:25 +02:00
|
|
|
explicit KPageBuffer(KernelCore&) {}
|
2022-03-11 09:18:35 +01:00
|
|
|
KPageBuffer() = default;
|
|
|
|
|
2022-03-18 03:09:01 +01:00
|
|
|
static KPageBuffer* FromPhysicalAddress(Core::System& system, PAddr phys_addr);
|
2022-03-11 09:18:35 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
[[maybe_unused]] alignas(PageSize) std::array<u8, PageSize> m_buffer{};
|
|
|
|
};
|
2022-10-29 22:46:39 +02:00
|
|
|
static_assert(sizeof(KPageBuffer) == KPageBufferSlabHeap::BufferSize);
|
2022-03-11 09:18:35 +01:00
|
|
|
|
|
|
|
} // namespace Kernel
|