2014-07-05 06:55:39 +02:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2
|
2014-11-19 09:49:13 +01:00
|
|
|
// Refer to the license.txt file included.
|
2014-07-05 06:55:39 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2014-07-05 16:22:03 +02:00
|
|
|
/// Permissions for mapped shared memory blocks
|
|
|
|
enum class MemoryPermission : u32 {
|
2014-11-08 03:53:18 +01:00
|
|
|
None = 0,
|
|
|
|
Read = (1u << 0),
|
|
|
|
Write = (1u << 1),
|
|
|
|
ReadWrite = (Read | Write),
|
|
|
|
Execute = (1u << 2),
|
|
|
|
ReadExecute = (Read | Execute),
|
|
|
|
WriteExecute = (Write | Execute),
|
|
|
|
ReadWriteExecute = (Read | Write | Execute),
|
|
|
|
DontCare = (1u << 28)
|
2014-07-05 16:22:03 +02:00
|
|
|
};
|
|
|
|
|
2014-07-05 06:55:39 +02:00
|
|
|
/**
|
|
|
|
* Creates a shared memory object
|
|
|
|
* @param name Optional name of shared memory object
|
|
|
|
* @return Handle of newly created shared memory object
|
|
|
|
*/
|
|
|
|
Handle CreateSharedMemory(const std::string& name="Unknown");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps a shared memory block to an address in system memory
|
|
|
|
* @param handle Shared memory block handle
|
|
|
|
* @param address Address in system memory to map shared memory block to
|
|
|
|
* @param permissions Memory block map permissions (specified by SVC field)
|
|
|
|
* @param other_permissions Memory block map other permissions (specified by SVC field)
|
|
|
|
*/
|
2014-10-23 05:20:01 +02:00
|
|
|
ResultCode MapSharedMemory(Handle handle, u32 address, MemoryPermission permissions,
|
2014-07-05 16:22:03 +02:00
|
|
|
MemoryPermission other_permissions);
|
2014-07-05 06:55:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a pointer to the shared memory block
|
|
|
|
* @param handle Shared memory block handle
|
|
|
|
* @param offset Offset from the start of the shared memory block to get pointer
|
|
|
|
* @return Pointer to the shared memory block from the specified offset
|
|
|
|
*/
|
2014-10-23 05:20:01 +02:00
|
|
|
ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset);
|
2014-07-05 06:55:39 +02:00
|
|
|
|
|
|
|
} // namespace
|