2017-10-02 03:56:43 +01:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-11-08 19:05:54 +00:00
|
|
|
#include <memory>
|
2018-11-08 18:53:20 +00:00
|
|
|
#include <vector>
|
2019-12-23 11:41:07 +00:00
|
|
|
#include <boost/serialization/unique_ptr.hpp>
|
2017-10-02 03:56:43 +01:00
|
|
|
#include "common/common_types.h"
|
2018-11-08 18:53:20 +00:00
|
|
|
#include "core/hle/ipc.h"
|
2017-10-02 03:56:43 +01:00
|
|
|
#include "core/hle/kernel/thread.h"
|
|
|
|
|
2019-02-01 17:32:49 +00:00
|
|
|
namespace Memory {
|
|
|
|
class MemorySystem;
|
|
|
|
}
|
|
|
|
|
2017-10-02 03:56:43 +01:00
|
|
|
namespace Kernel {
|
2018-11-08 18:53:20 +00:00
|
|
|
|
2019-07-22 13:19:03 +01:00
|
|
|
class KernelSystem;
|
|
|
|
|
2018-11-08 18:53:20 +00:00
|
|
|
struct MappedBufferContext {
|
|
|
|
IPC::MappedBufferPermissions permissions;
|
|
|
|
u32 size;
|
|
|
|
VAddr source_address;
|
|
|
|
VAddr target_address;
|
2018-11-08 19:05:54 +00:00
|
|
|
|
|
|
|
std::unique_ptr<u8[]> buffer;
|
|
|
|
std::unique_ptr<u8[]> reserve_buffer;
|
2019-12-23 11:41:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
template <class Archive>
|
2019-12-27 21:07:29 +00:00
|
|
|
void serialize(Archive& ar, const unsigned int file_version) {
|
|
|
|
ar& permissions;
|
|
|
|
ar& size;
|
|
|
|
ar& source_address;
|
|
|
|
ar& target_address;
|
|
|
|
// TODO: Check whether we need these. If we do, add a field for the size and/or change to a
|
|
|
|
// 'vector'
|
|
|
|
// ar & buffer;
|
|
|
|
// ar & reserve_buffer;
|
2019-12-23 11:41:07 +00:00
|
|
|
}
|
|
|
|
friend class boost::serialization::access;
|
2018-11-08 18:53:20 +00:00
|
|
|
};
|
|
|
|
|
2017-10-02 03:56:43 +01:00
|
|
|
/// Performs IPC command buffer translation from one process to another.
|
2019-07-22 13:19:03 +01:00
|
|
|
ResultCode TranslateCommandBuffer(KernelSystem& system, Memory::MemorySystem& memory,
|
|
|
|
std::shared_ptr<Thread> src_thread,
|
2019-03-23 20:04:19 +00:00
|
|
|
std::shared_ptr<Thread> dst_thread, VAddr src_address,
|
2019-02-01 17:32:49 +00:00
|
|
|
VAddr dst_address,
|
2018-11-08 18:53:20 +00:00
|
|
|
std::vector<MappedBufferContext>& mapped_buffer_context,
|
|
|
|
bool reply);
|
2017-10-02 03:56:43 +01:00
|
|
|
} // namespace Kernel
|