mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-28 02:26:13 +00:00
kernel: Move serialization code out of headers. (#7312)
This commit is contained in:
parent
9c84721d84
commit
a2d1c4a94c
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include "core/hle/applets/mii_selector.h"
|
||||
|
||||
namespace Frontend {
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -13,6 +17,9 @@
|
|||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::AddressArbiter)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::AddressArbiter::Callback)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
void AddressArbiter::WaitThread(std::shared_ptr<Thread> thread, VAddr wait_address) {
|
||||
|
@ -183,6 +190,16 @@ Result AddressArbiter::ArbitrateAddress(std::shared_ptr<Thread> thread, Arbitrat
|
|||
return ResultSuccess;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void AddressArbiter::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& name;
|
||||
ar& waiting_threads;
|
||||
ar& timeout_callback;
|
||||
ar& resource_limit;
|
||||
}
|
||||
SERIALIZE_IMPL(AddressArbiter)
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
namespace boost::serialization {
|
||||
|
@ -201,6 +218,3 @@ void load_construct_data(Archive& ar, Kernel::AddressArbiter::Callback* t, const
|
|||
}
|
||||
|
||||
} // namespace boost::serialization
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::AddressArbiter)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::AddressArbiter::Callback)
|
||||
|
|
|
@ -6,12 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
|
@ -83,18 +78,11 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& name;
|
||||
ar& waiting_threads;
|
||||
ar& timeout_callback;
|
||||
ar& resource_limit;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::AddressArbiter)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::AddressArbiter::Callback)
|
||||
BOOST_CLASS_VERSION(Kernel::AddressArbiter, 2)
|
||||
CONSTRUCT_KERNEL_OBJECT(Kernel::AddressArbiter)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/global.h"
|
||||
|
@ -48,4 +50,14 @@ void ClientPort::ConnectionClosed() {
|
|||
--active_sessions;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void ClientPort::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& server_port;
|
||||
ar& max_sessions;
|
||||
ar& active_sessions;
|
||||
ar& name;
|
||||
}
|
||||
SERIALIZE_IMPL(ClientPort)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/server_port.h"
|
||||
|
@ -66,13 +64,7 @@ private:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& server_port;
|
||||
ar& max_sessions;
|
||||
ar& active_sessions;
|
||||
ar& name;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/hle/kernel/client_session.h"
|
||||
|
@ -53,4 +56,12 @@ Result ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread) {
|
|||
return server->HandleSyncRequest(std::move(thread));
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void ClientSession::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& name;
|
||||
ar& parent;
|
||||
}
|
||||
SERIALIZE_IMPL(ClientSession)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/result.h"
|
||||
|
@ -54,11 +51,7 @@ public:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& name;
|
||||
ar& parent;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstring>
|
||||
#include <boost/serialization/binary_object.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "core/hle/kernel/config_mem.h"
|
||||
|
||||
|
@ -31,4 +32,11 @@ ConfigMemDef& Handler::GetConfigMem() {
|
|||
return config_mem;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Handler::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<BackingMem>(*this);
|
||||
ar& boost::serialization::make_binary_object(&config_mem, sizeof(config_mem));
|
||||
}
|
||||
SERIALIZE_IMPL(Handler)
|
||||
|
||||
} // namespace ConfigMem
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// bootrom. Because we're not emulating this, and essentially just "stubbing" the functionality, I'm
|
||||
// putting this as a subset of HLE for now.
|
||||
|
||||
#include <boost/serialization/binary_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
|
@ -72,10 +71,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<BackingMem>(*this);
|
||||
ar& boost::serialization::make_binary_object(&config_mem, sizeof(config_mem));
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace ConfigMem
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/hle/kernel/event.h"
|
||||
|
@ -58,4 +60,14 @@ void Event::WakeupAllWaitingThreads() {
|
|||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Event::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& reset_type;
|
||||
ar& signaled;
|
||||
ar& name;
|
||||
ar& resource_limit;
|
||||
}
|
||||
SERIALIZE_IMPL(Event)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/resource_limit.h"
|
||||
#include "core/hle/kernel/wait_object.h"
|
||||
|
@ -57,13 +55,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& reset_type;
|
||||
ar& signaled;
|
||||
ar& name;
|
||||
ar& resource_limit;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <utility>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/hle/kernel/errors.h"
|
||||
|
@ -10,6 +13,8 @@
|
|||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::HandleTable)
|
||||
|
||||
namespace Kernel {
|
||||
namespace {
|
||||
constexpr u16 GetSlot(Handle handle) {
|
||||
|
@ -94,4 +99,13 @@ void HandleTable::Clear() {
|
|||
next_free_slot = 0;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void HandleTable::serialize(Archive& ar, const unsigned int) {
|
||||
ar& objects;
|
||||
ar& generations;
|
||||
ar& next_generation;
|
||||
ar& next_free_slot;
|
||||
}
|
||||
SERIALIZE_IMPL(HandleTable)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/result.h"
|
||||
|
@ -121,12 +120,10 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& objects;
|
||||
ar& generations;
|
||||
ar& next_generation;
|
||||
ar& next_free_slot;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::HandleTable)
|
||||
CONSTRUCT_KERNEL_OBJECT(Kernel::HandleTable)
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/unique_ptr.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
|
@ -15,6 +19,12 @@
|
|||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler::SessionDataBase)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler::SessionInfo)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::HLERequestContext)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::HLERequestContext::ThreadCallback)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class HLERequestContext::ThreadCallback : public Kernel::WakeupCallback {
|
||||
|
@ -77,6 +87,23 @@ void SessionRequestHandler::ClientDisconnected(std::shared_ptr<ServerSession> se
|
|||
connected_sessions.end());
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void SessionRequestHandler::serialize(Archive& ar, const unsigned int) {
|
||||
ar& connected_sessions;
|
||||
}
|
||||
SERIALIZE_IMPL(SessionRequestHandler)
|
||||
|
||||
template <class Archive>
|
||||
void SessionRequestHandler::SessionDataBase::serialize(Archive& ar, const unsigned int) {}
|
||||
SERIALIZE_IMPL(SessionRequestHandler::SessionDataBase)
|
||||
|
||||
template <class Archive>
|
||||
void SessionRequestHandler::SessionInfo::serialize(Archive& ar, const unsigned int) {
|
||||
ar& session;
|
||||
ar& data;
|
||||
}
|
||||
SERIALIZE_IMPL(SessionRequestHandler::SessionInfo)
|
||||
|
||||
std::shared_ptr<Event> HLERequestContext::SleepClientThread(
|
||||
const std::string& reason, std::chrono::nanoseconds timeout,
|
||||
std::shared_ptr<WakeupCallback> callback) {
|
||||
|
@ -295,6 +322,17 @@ void HLERequestContext::ReportUnimplemented() const {
|
|||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void HLERequestContext::serialize(Archive& ar, const unsigned int) {
|
||||
ar& cmd_buf;
|
||||
ar& session;
|
||||
ar& thread;
|
||||
ar& request_handles;
|
||||
ar& static_buffers;
|
||||
ar& request_mapped_buffers;
|
||||
}
|
||||
SERIALIZE_IMPL(HLERequestContext)
|
||||
|
||||
MappedBuffer::MappedBuffer() : memory(&Core::Global<Core::System>().Memory()) {}
|
||||
|
||||
MappedBuffer::MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process,
|
||||
|
@ -318,5 +356,3 @@ void MappedBuffer::Write(const void* src_buffer, std::size_t offset, std::size_t
|
|||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::HLERequestContext::ThreadCallback)
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/unique_ptr.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/serialization/boost_small_vector.hpp"
|
||||
#include "common/swap.h"
|
||||
|
@ -77,7 +74,20 @@ public:
|
|||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
struct SessionInfo {
|
||||
SessionInfo(std::shared_ptr<ServerSession> session, std::unique_ptr<SessionDataBase> data);
|
||||
|
||||
std::shared_ptr<ServerSession> session;
|
||||
std::unique_ptr<SessionDataBase> data;
|
||||
|
||||
private:
|
||||
SessionInfo() = default;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -96,30 +106,13 @@ protected:
|
|||
return static_cast<T*>(itr->data.get());
|
||||
}
|
||||
|
||||
struct SessionInfo {
|
||||
SessionInfo(std::shared_ptr<ServerSession> session, std::unique_ptr<SessionDataBase> data);
|
||||
|
||||
std::shared_ptr<ServerSession> session;
|
||||
std::unique_ptr<SessionDataBase> data;
|
||||
|
||||
private:
|
||||
SessionInfo() = default;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& session;
|
||||
ar& data;
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
/// List of sessions that are connected to this handler. A ServerSession whose server endpoint
|
||||
/// is an HLE implementation is kept alive by this list for the duration of the connection.
|
||||
std::vector<SessionInfo> connected_sessions;
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& connected_sessions;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -388,17 +381,14 @@ private:
|
|||
|
||||
HLERequestContext();
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& cmd_buf;
|
||||
ar& session;
|
||||
ar& thread;
|
||||
ar& request_handles;
|
||||
ar& static_buffers;
|
||||
ar& request_mapped_buffers;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler::SessionDataBase)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler::SessionInfo)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::HLERequestContext)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::HLERequestContext::ThreadCallback)
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include "common/alignment.h"
|
||||
#include "common/archives.h"
|
||||
#include "common/memory_ref.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc.h"
|
||||
|
@ -16,6 +18,8 @@
|
|||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::MappedBufferContext)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
|
||||
|
@ -250,4 +254,15 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
|
|||
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void MappedBufferContext::serialize(Archive& ar, const unsigned int) {
|
||||
ar& permissions;
|
||||
ar& size;
|
||||
ar& source_address;
|
||||
ar& target_address;
|
||||
ar& buffer;
|
||||
}
|
||||
SERIALIZE_IMPL(MappedBufferContext)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/ipc.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
|
@ -29,13 +29,7 @@ struct MappedBufferContext {
|
|||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& permissions;
|
||||
ar& size;
|
||||
ar& source_address;
|
||||
ar& target_address;
|
||||
ar& buffer;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -46,3 +40,5 @@ Result TranslateCommandBuffer(KernelSystem& system, Memory::MemorySystem& memory
|
|||
VAddr dst_address,
|
||||
std::vector<MappedBufferContext>& mapped_buffer_context, bool reply);
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::MappedBufferContext)
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/timer.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::New3dsHwCapabilities)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
/// Initialize the kernel
|
||||
|
@ -162,7 +164,7 @@ void KernelSystem::ResetThreadIDs() {
|
|||
}
|
||||
|
||||
template <class Archive>
|
||||
void KernelSystem::serialize(Archive& ar, const unsigned int file_version) {
|
||||
void KernelSystem::serialize(Archive& ar, const unsigned int) {
|
||||
ar& memory_regions;
|
||||
ar& named_ports;
|
||||
// current_cpu set externally
|
||||
|
@ -195,7 +197,14 @@ void KernelSystem::serialize(Archive& ar, const unsigned int file_version) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SERIALIZE_IMPL(KernelSystem)
|
||||
|
||||
template <class Archive>
|
||||
void New3dsHwCapabilities::serialize(Archive& ar, const unsigned int) {
|
||||
ar& enable_l2_cache;
|
||||
ar& enable_804MHz_cpu;
|
||||
ar& memory_mode;
|
||||
}
|
||||
SERIALIZE_IMPL(New3dsHwCapabilities)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/memory.h"
|
||||
#include "core/hle/result.h"
|
||||
|
@ -124,11 +125,7 @@ struct New3dsHwCapabilities {
|
|||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& enable_l2_cache;
|
||||
ar& enable_804MHz_cpu;
|
||||
ar& memory_mode;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -407,7 +404,9 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::New3dsHwCapabilities)
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <boost/serialization/set.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -19,6 +21,8 @@
|
|||
#include "core/hle/result.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::MemoryRegionInfo)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
/// Size of the APPLICATION, SYSTEM and BASE memory regions (respectively) for each system
|
||||
|
@ -267,4 +271,16 @@ void MemoryRegionInfo::Unlock() {
|
|||
is_locked = false;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void MemoryRegionInfo::serialize(Archive& ar, const unsigned int) {
|
||||
ar& base;
|
||||
ar& size;
|
||||
ar& used;
|
||||
ar& free_blocks;
|
||||
if (Archive::is_loading::value) {
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
SERIALIZE_IMPL(MemoryRegionInfo)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <optional>
|
||||
#include <boost/icl/interval_set.hpp>
|
||||
#include <boost/serialization/set.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/serialization/boost_interval_set.hpp"
|
||||
|
||||
|
@ -83,15 +83,9 @@ struct MemoryRegionInfo {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& base;
|
||||
ar& size;
|
||||
ar& used;
|
||||
ar& free_blocks;
|
||||
if (Archive::is_loading::value) {
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::MemoryRegionInfo)
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/core.h"
|
||||
|
@ -127,4 +130,15 @@ void Mutex::UpdatePriority() {
|
|||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Mutex::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& lock_count;
|
||||
ar& priority;
|
||||
ar& name;
|
||||
ar& holding_thread;
|
||||
ar& resource_limit;
|
||||
}
|
||||
SERIALIZE_IMPL(Mutex)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/resource_limit.h"
|
||||
|
@ -67,14 +64,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& lock_count;
|
||||
ar& priority;
|
||||
ar& name;
|
||||
ar& holding_thread;
|
||||
ar& resource_limit;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
#include "common/archives.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::Object)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
Object::Object(KernelSystem& kernel) : object_id{kernel.GenerateObjectID()} {}
|
||||
|
@ -37,4 +41,10 @@ bool Object::IsWaitable() const {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Object::serialize(Archive& ar, const unsigned int) {
|
||||
ar& object_id;
|
||||
}
|
||||
SERIALIZE_IMPL(Object)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/serialization/atomic.h"
|
||||
|
@ -72,9 +70,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& object_id;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -99,7 +95,7 @@ inline std::shared_ptr<T> DynamicObjectCast(std::shared_ptr<Object> object) {
|
|||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::Object)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::Object)
|
||||
|
||||
#define CONSTRUCT_KERNEL_OBJECT(T) \
|
||||
namespace boost::serialization { \
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/bitset.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/common_funcs.h"
|
||||
|
@ -23,13 +26,24 @@
|
|||
#include "core/loader/loader.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::AddressMapping)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::Process)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::CodeSet)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::CodeSet::Segment)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
template <class Archive>
|
||||
void Process::serialize(Archive& ar, const unsigned int file_version) {
|
||||
void AddressMapping::serialize(Archive& ar, const unsigned int) {
|
||||
ar& address;
|
||||
ar& size;
|
||||
ar& read_only;
|
||||
ar& unk_flag;
|
||||
}
|
||||
SERIALIZE_IMPL(AddressMapping)
|
||||
|
||||
template <class Archive>
|
||||
void Process::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& handle_table;
|
||||
ar& codeset; // TODO: Replace with apploader reference
|
||||
|
@ -52,7 +66,6 @@ void Process::serialize(Archive& ar, const unsigned int file_version) {
|
|||
ar& holding_tls_memory;
|
||||
ar& tls_slots;
|
||||
}
|
||||
|
||||
SERIALIZE_IMPL(Process)
|
||||
|
||||
std::shared_ptr<CodeSet> KernelSystem::CreateCodeSet(std::string name, u64 program_id) {
|
||||
|
@ -67,6 +80,25 @@ std::shared_ptr<CodeSet> KernelSystem::CreateCodeSet(std::string name, u64 progr
|
|||
CodeSet::CodeSet(KernelSystem& kernel) : Object(kernel) {}
|
||||
CodeSet::~CodeSet() {}
|
||||
|
||||
template <class Archive>
|
||||
void CodeSet::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& memory;
|
||||
ar& segments;
|
||||
ar& entrypoint;
|
||||
ar& name;
|
||||
ar& program_id;
|
||||
}
|
||||
SERIALIZE_IMPL(CodeSet)
|
||||
|
||||
template <class Archive>
|
||||
void CodeSet::Segment::serialize(Archive& ar, const unsigned int) {
|
||||
ar& offset;
|
||||
ar& addr;
|
||||
ar& size;
|
||||
}
|
||||
SERIALIZE_IMPL(CodeSet::Segment)
|
||||
|
||||
std::shared_ptr<Process> KernelSystem::CreateProcess(std::shared_ptr<CodeSet> code_set) {
|
||||
auto process{std::make_shared<Process>(*this)};
|
||||
|
||||
|
|
|
@ -11,10 +11,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/container/static_vector.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
|
@ -33,12 +30,7 @@ struct AddressMapping {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& address;
|
||||
ar& size;
|
||||
ar& read_only;
|
||||
ar& unk_flag;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
union ProcessFlags {
|
||||
|
@ -77,11 +69,7 @@ public:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& offset;
|
||||
ar& addr;
|
||||
ar& size;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
std::string GetTypeName() const override {
|
||||
|
@ -133,14 +121,7 @@ public:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& memory;
|
||||
ar& segments;
|
||||
ar& entrypoint;
|
||||
ar& name;
|
||||
ar& program_id;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
class Process final : public Object {
|
||||
|
@ -257,7 +238,9 @@ private:
|
|||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::AddressMapping)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::CodeSet)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::CodeSet::Segment)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::Process)
|
||||
CONSTRUCT_KERNEL_OBJECT(Kernel::CodeSet)
|
||||
CONSTRUCT_KERNEL_OBJECT(Kernel::Process)
|
||||
|
|
|
@ -2,12 +2,17 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/hle/kernel/resource_limit.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::ResourceLimit)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::ResourceLimitList)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -61,6 +66,15 @@ bool ResourceLimit::Release(ResourceLimitType type, s32 amount) {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void ResourceLimit::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& m_name;
|
||||
ar& m_limit_values;
|
||||
ar& m_current_values;
|
||||
}
|
||||
SERIALIZE_IMPL(ResourceLimit)
|
||||
|
||||
ResourceLimitList::ResourceLimitList(KernelSystem& kernel) {
|
||||
// PM makes APPMEMALLOC always match app RESLIMIT_COMMIT.
|
||||
// See: https://github.com/LumaTeam/Luma3DS/blob/e2778a45/sysmodules/pm/source/reslimit.c#L275
|
||||
|
@ -138,4 +152,10 @@ std::shared_ptr<ResourceLimit> ResourceLimitList::GetForCategory(ResourceLimitCa
|
|||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void ResourceLimitList::serialize(Archive& ar, const unsigned int) {
|
||||
ar& resource_limits;
|
||||
}
|
||||
SERIALIZE_IMPL(ResourceLimitList)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
|
@ -76,12 +73,7 @@ private:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& m_name;
|
||||
ar& m_limit_values;
|
||||
ar& m_current_values;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
class ResourceLimitList {
|
||||
|
@ -101,12 +93,12 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& resource_limits;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::ResourceLimit)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::ResourceLimitList)
|
||||
CONSTRUCT_KERNEL_OBJECT(Kernel::ResourceLimit)
|
||||
CONSTRUCT_KERNEL_OBJECT(Kernel::ResourceLimitList)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "core/hle/kernel/errors.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
|
@ -58,4 +60,14 @@ Result Semaphore::Release(s32* out_count, s32 release_count) {
|
|||
return ResultSuccess;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Semaphore::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& max_count;
|
||||
ar& available_count;
|
||||
ar& name;
|
||||
ar& resource_limit;
|
||||
}
|
||||
SERIALIZE_IMPL(Semaphore)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/wait_object.h"
|
||||
|
@ -52,13 +50,7 @@ public:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& max_count;
|
||||
ar& available_count;
|
||||
ar& name;
|
||||
ar& resource_limit;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -55,7 +55,7 @@ KernelSystem::PortPair KernelSystem::CreatePortPair(u32 max_sessions, std::strin
|
|||
}
|
||||
|
||||
template <class Archive>
|
||||
void ServerPort::serialize(Archive& ar, const unsigned int file_version) {
|
||||
void ServerPort::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& name;
|
||||
ar& pending_sessions;
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -19,7 +19,7 @@ SERIALIZE_EXPORT_IMPL(Kernel::ServerSession)
|
|||
namespace Kernel {
|
||||
|
||||
template <class Archive>
|
||||
void ServerSession::serialize(Archive& ar, const unsigned int file_version) {
|
||||
void ServerSession::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& name;
|
||||
ar& parent;
|
||||
|
|
|
@ -108,7 +108,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "core/hle/kernel/server_session.h"
|
||||
#include "core/hle/kernel/session.h"
|
||||
|
||||
SERIALIZE_IMPL(Kernel::Session)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::Session)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -19,5 +19,6 @@ void Session::serialize(Archive& ar, const unsigned int file_version) {
|
|||
ar& server;
|
||||
ar& port;
|
||||
}
|
||||
SERIALIZE_IMPL(Session)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -29,6 +29,8 @@ public:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::Session)
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
#include <boost/serialization/weak_ptr.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/hle/kernel/errors.h"
|
||||
|
@ -217,4 +221,20 @@ const u8* SharedMemory::GetPointer(u32 offset) const {
|
|||
return backing_blocks[0].first + offset;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void SharedMemory::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& linear_heap_phys_offset;
|
||||
ar& backing_blocks;
|
||||
ar& size;
|
||||
ar& memory_region;
|
||||
ar& permissions;
|
||||
ar& other_permissions;
|
||||
ar& owner_process;
|
||||
ar& base_address;
|
||||
ar& name;
|
||||
ar& holding_memory;
|
||||
}
|
||||
SERIALIZE_IMPL(SharedMemory)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/weak_ptr.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/memory_ref.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
@ -113,19 +110,7 @@ private:
|
|||
KernelSystem& kernel;
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& linear_heap_phys_offset;
|
||||
ar& backing_blocks;
|
||||
ar& size;
|
||||
ar& memory_region;
|
||||
ar& permissions;
|
||||
ar& other_permissions;
|
||||
ar& owner_process;
|
||||
ar& base_address;
|
||||
ar& name;
|
||||
ar& holding_memory;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/binary_object.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/settings.h"
|
||||
|
@ -172,4 +174,11 @@ SharedPageDef& Handler::GetSharedPage() {
|
|||
return shared_page;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Handler::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<BackingMem>(*this);
|
||||
ar& boost::serialization::make_binary_object(&shared_page, sizeof(shared_page));
|
||||
}
|
||||
SERIALIZE_IMPL(Handler)
|
||||
|
||||
} // namespace SharedPage
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/binary_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_funcs.h"
|
||||
|
@ -141,10 +139,7 @@ private:
|
|||
SharedPageDef shared_page;
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<BackingMem>(*this);
|
||||
ar& boost::serialization::make_binary_object(&shared_page, sizeof(shared_page));
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/unordered_map.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/weak_ptr.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
|
@ -24,9 +27,19 @@
|
|||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::Thread)
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::WakeupCallback)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
template <class Archive>
|
||||
void ThreadManager::serialize(Archive& ar, const unsigned int) {
|
||||
ar& current_thread;
|
||||
ar& ready_queue;
|
||||
ar& wakeup_callback_table;
|
||||
ar& thread_list;
|
||||
}
|
||||
SERIALIZE_IMPL(ThreadManager)
|
||||
|
||||
template <class Archive>
|
||||
void Thread::serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
|
@ -48,9 +61,12 @@ void Thread::serialize(Archive& ar, const unsigned int file_version) {
|
|||
ar& name;
|
||||
ar& wakeup_callback;
|
||||
}
|
||||
|
||||
SERIALIZE_IMPL(Thread)
|
||||
|
||||
template <class Archive>
|
||||
void WakeupCallback::serialize(Archive& ar, const unsigned int) {}
|
||||
SERIALIZE_IMPL(WakeupCallback)
|
||||
|
||||
bool Thread::ShouldWait(const Thread* thread) const {
|
||||
return status != ThreadStatus::Dead;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
#include <vector>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/unordered_map.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/weak_ptr.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/thread_queue_list.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
|
@ -72,7 +69,7 @@ public:
|
|||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -164,12 +161,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& current_thread;
|
||||
ar& ready_queue;
|
||||
ar& wakeup_callback_table;
|
||||
ar& thread_list;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
class Thread final : public WaitObject {
|
||||
|
@ -336,7 +328,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -353,17 +345,17 @@ std::shared_ptr<Thread> SetupMainThread(KernelSystem& kernel, u32 entry_point, u
|
|||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::Thread)
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::WakeupCallback)
|
||||
|
||||
namespace boost::serialization {
|
||||
|
||||
template <class Archive>
|
||||
inline void save_construct_data(Archive& ar, const Kernel::Thread* t,
|
||||
const unsigned int file_version) {
|
||||
void save_construct_data(Archive& ar, const Kernel::Thread* t, const unsigned int) {
|
||||
ar << t->core_id;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void load_construct_data(Archive& ar, Kernel::Thread* t, const unsigned int file_version) {
|
||||
void load_construct_data(Archive& ar, Kernel::Thread* t, const unsigned int) {
|
||||
u32 core_id;
|
||||
ar >> core_id;
|
||||
::new (t) Kernel::Thread(Core::Global<Kernel::KernelSystem>(), core_id);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/unordered_map.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -97,6 +99,19 @@ void Timer::Signal(s64 cycles_late) {
|
|||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Timer::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& reset_type;
|
||||
ar& initial_delay;
|
||||
ar& interval_delay;
|
||||
ar& signaled;
|
||||
ar& name;
|
||||
ar& callback_id;
|
||||
ar& resource_limit;
|
||||
}
|
||||
SERIALIZE_IMPL(Timer)
|
||||
|
||||
/// The timer callback event, called when a timer is fired
|
||||
void TimerManager::TimerCallback(u64 callback_id, s64 cycles_late) {
|
||||
std::shared_ptr<Timer> timer = SharedFrom(timer_callback_table.at(callback_id));
|
||||
|
@ -116,4 +131,11 @@ TimerManager::TimerManager(Core::Timing& timing) : timing(timing) {
|
|||
});
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void TimerManager::serialize(Archive& ar, const unsigned int) {
|
||||
ar& next_timer_callback_id;
|
||||
ar& timer_callback_table;
|
||||
}
|
||||
SERIALIZE_IMPL(TimerManager)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/unordered_map.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
@ -38,10 +37,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& next_timer_callback_id;
|
||||
ar& timer_callback_table;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
class ResourceLimit;
|
||||
|
@ -119,16 +115,7 @@ private:
|
|||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<WaitObject>(*this);
|
||||
ar& reset_type;
|
||||
ar& initial_delay;
|
||||
ar& interval_delay;
|
||||
ar& signaled;
|
||||
ar& name;
|
||||
ar& callback_id;
|
||||
ar& resource_limit;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <boost/serialization/map.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/errors.h"
|
||||
|
@ -11,6 +15,8 @@
|
|||
#include "core/hle/service/plgldr/plgldr.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::VirtualMemoryArea)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static const char* GetMemoryStateName(MemoryState state) {
|
||||
|
@ -35,6 +41,17 @@ bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void VirtualMemoryArea::serialize(Archive& ar, const unsigned int) {
|
||||
ar& base;
|
||||
ar& size;
|
||||
ar& type;
|
||||
ar& permissions;
|
||||
ar& meminfo_state;
|
||||
ar& backing_memory;
|
||||
}
|
||||
SERIALIZE_IMPL(VirtualMemoryArea)
|
||||
|
||||
VMManager::VMManager(Memory::MemorySystem& memory, Kernel::Process& proc)
|
||||
: page_table(std::make_shared<Memory::PageTable>()), memory(memory), process(proc) {
|
||||
Reset();
|
||||
|
@ -379,4 +396,15 @@ ResultVal<std::vector<std::pair<MemoryRef, u32>>> VMManager::GetBackingBlocksFor
|
|||
}
|
||||
return backing_blocks;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void VMManager::serialize(Archive& ar, const unsigned int) {
|
||||
ar& vma_map;
|
||||
ar& page_table;
|
||||
if (Archive::is_loading::value) {
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
SERIALIZE_IMPL(VMManager)
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <boost/serialization/map.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/memory_ref.h"
|
||||
#include "core/hle/kernel/memory.h"
|
||||
|
@ -79,14 +77,7 @@ struct VirtualMemoryArea {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& base;
|
||||
ar& size;
|
||||
ar& type;
|
||||
ar& permissions;
|
||||
ar& meminfo_state;
|
||||
ar& backing_memory;
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -238,13 +229,9 @@ private:
|
|||
bool is_locked{};
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& vma_map;
|
||||
ar& page_table;
|
||||
if (Archive::is_loading::value) {
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::VirtualMemoryArea)
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -15,10 +18,12 @@
|
|||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/timer.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Kernel::WaitObject)
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
template <class Archive>
|
||||
void WaitObject::serialize(Archive& ar, const unsigned int file_version) {
|
||||
void WaitObject::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& waiting_threads;
|
||||
// NB: hle_notifier *not* serialized since it's a callback!
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
|
@ -69,7 +66,7 @@ private:
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
};
|
||||
|
||||
// Specialization of DynamicObjectCast for WaitObjects
|
||||
|
@ -82,3 +79,5 @@ inline std::shared_ptr<WaitObject> DynamicObjectCast<WaitObject>(std::shared_ptr
|
|||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Kernel::WaitObject)
|
||||
|
|
|
@ -3,9 +3,26 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/crc.hpp>
|
||||
#include <boost/serialization/binary_object.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "core/hle/mii.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Mii::MiiData)
|
||||
SERIALIZE_EXPORT_IMPL(Mii::ChecksummedMiiData)
|
||||
|
||||
namespace Mii {
|
||||
template <class Archive>
|
||||
void MiiData::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::make_binary_object(this, sizeof(MiiData));
|
||||
}
|
||||
SERIALIZE_IMPL(MiiData)
|
||||
|
||||
template <class Archive>
|
||||
void ChecksummedMiiData::serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::make_binary_object(this, sizeof(ChecksummedMiiData));
|
||||
}
|
||||
SERIALIZE_IMPL(ChecksummedMiiData)
|
||||
|
||||
u16 ChecksummedMiiData::CalculateChecksum() {
|
||||
// Calculate the checksum of the selected Mii, see https://www.3dbrew.org/wiki/Mii#Checksum
|
||||
return boost::crc<16, 0x1021, 0, 0, false, false>(this, offsetof(ChecksummedMiiData, crc16));
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/binary_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
|
@ -178,9 +177,7 @@ struct MiiData {
|
|||
Nickname author_name; ///< Name of Mii's author (Encoded using UTF16)
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::make_binary_object(this, sizeof(MiiData));
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -230,9 +227,7 @@ public:
|
|||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::make_binary_object(this, sizeof(ChecksummedMiiData));
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int);
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
@ -242,3 +237,6 @@ static_assert(std::is_trivial_v<ChecksummedMiiData>, "ChecksummedMiiData must be
|
|||
static_assert(std::is_trivially_copyable_v<ChecksummedMiiData>,
|
||||
"ChecksummedMiiData must be trivially copyable.");
|
||||
} // namespace Mii
|
||||
|
||||
BOOST_CLASS_EXPORT_KEY(Mii::MiiData)
|
||||
BOOST_CLASS_EXPORT_KEY(Mii::ChecksummedMiiData)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <boost/serialization/set.hpp>
|
||||
#include <boost/serialization/unordered_map.hpp>
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
|
Loading…
Reference in a new issue