mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-06-01 10:08:49 +02:00
32 lines
899 B
C++
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();
|
|
};
|
|
}
|