skyline/app/src/main/cpp/skyline/kernel/types/KSharedMemory.h
2023-05-05 18:16:16 +02:00

32 lines
899 B
C++

// SPDX-License-Identifier: MPL-2.0
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include "KMemory.h"
namespace skyline::kernel::type {
/**
* @brief KSharedMemory is used to retain two mappings of the same underlying memory, allowing sharing memory between two processes
*/
class KSharedMemory : public KMemory {
public:
KSharedMemory(const DeviceState &state, size_t size);
/**
* @note 'ptr' needs to be in guest-reserved address space
*/
u8 *Map(span<u8> map, memory::Permission permission);
/**
* @note 'ptr' needs to be in guest-reserved address space
*/
void Unmap(span<u8> map);
/**
* @brief The destructor of shared memory, it deallocates the memory from all processes
*/
~KSharedMemory();
};
}