citra-emu
/
citra-canary
Archived
1
0
Fork 0

Serialize service manager, server prt

This commit is contained in:
Hamish Milne 2019-12-23 11:41:07 +00:00 committed by zhupengfei
parent 4f95575d41
commit 7a5bde0b44
11 changed files with 77 additions and 16 deletions

9
TODO
View File

@ -2,7 +2,8 @@
✔ CPU @done(19-08-13 15:41) ✔ CPU @done(19-08-13 15:41)
✔ Memory @done(19-08-13 15:41) ✔ Memory @done(19-08-13 15:41)
✔ DSP @done(19-08-13 15:41) ✔ DSP @done(19-08-13 15:41)
☐ Service manager ✔ Service manager @started(19-12-23 00:36) @done(19-12-23 11:38) @lasted(11h2m3s)
☐ Fix or ignore inverse map
☐ App loader ☐ App loader
☐ Archive manager ☐ Archive manager
☐ Custom texture cache ☐ Custom texture cache
@ -30,8 +31,8 @@
✔ Config mem @done(19-08-13 16:40) ✔ Config mem @done(19-08-13 16:40)
✔ Event @done(19-12-22 18:44) ✔ Event @done(19-12-22 18:44)
✔ Handle table @done(19-08-13 16:42) ✔ Handle table @done(19-08-13 16:42)
☐ HLE IPC ✔ HLE IPC @done(19-12-23 00:36)
☐ IPC ✔ IPC @done(19-12-23 00:36)
✔ Memory @started(19-08-13 16:43) @done(19-12-22 18:34) ✔ Memory @started(19-08-13 16:43) @done(19-12-22 18:34)
✔ Mutex @done(19-08-13 16:43) ✔ Mutex @done(19-08-13 16:43)
✔ Object @done(19-08-13 15:41) ✔ Object @done(19-08-13 15:41)
@ -42,6 +43,8 @@
✔ Semaphore @done(19-08-13 16:44) ✔ Semaphore @done(19-08-13 16:44)
✔ Server port @done(19-08-13 16:44) ✔ Server port @done(19-08-13 16:44)
✔ Server session @done(19-08-13 16:44) ✔ Server session @done(19-08-13 16:44)
☐ Mapped buffer context
This may not be needed!
✔ Session @done(19-08-13 16:44) ✔ Session @done(19-08-13 16:44)
☐ Shared memory @started(19-12-22 21:20) ☐ Shared memory @started(19-12-22 21:20)
Need to figure out backing memory (a u8*) Need to figure out backing memory (a u8*)

View File

@ -235,7 +235,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
rpc_server = std::make_unique<RPC::RPCServer>(); rpc_server = std::make_unique<RPC::RPCServer>();
service_manager = std::make_shared<Service::SM::ServiceManager>(*this); service_manager = std::make_unique<Service::SM::ServiceManager>(*this);
archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this); archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this);
HW::Init(*memory); HW::Init(*memory);
@ -399,7 +399,7 @@ template<class Archive>
void System::serialize(Archive & ar, const unsigned int file_version) void System::serialize(Archive & ar, const unsigned int file_version)
{ {
ar & *cpu_core.get(); ar & *cpu_core.get();
//ar & *service_manager.get(); ar & *service_manager.get();
ar & GPU::g_regs; ar & GPU::g_regs;
ar & LCD::g_regs; ar & LCD::g_regs;
ar & dsp_core->GetDspMemory(); ar & dsp_core->GetDspMemory();

View File

@ -305,7 +305,7 @@ private:
std::unique_ptr<Core::TelemetrySession> telemetry_session; std::unique_ptr<Core::TelemetrySession> telemetry_session;
/// Service manager /// Service manager
std::shared_ptr<Service::SM::ServiceManager> service_manager; std::unique_ptr<Service::SM::ServiceManager> service_manager;
/// Frontend applets /// Frontend applets
std::shared_ptr<Frontend::MiiSelector> registered_mii_selector; std::shared_ptr<Frontend::MiiSelector> registered_mii_selector;

View File

@ -11,12 +11,19 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/container/small_vector.hpp> #include <boost/container/small_vector.hpp>
#include <boost/serialization/unique_ptr.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler)
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler::SessionDataBase)
namespace Service { namespace Service {
class ServiceFrameworkBase; class ServiceFrameworkBase;
} }
@ -90,12 +97,31 @@ protected:
std::shared_ptr<ServerSession> session; std::shared_ptr<ServerSession> session;
std::unique_ptr<SessionDataBase> data; std::unique_ptr<SessionDataBase> data;
private:
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 /// 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. /// is an HLE implementation is kept alive by this list for the duration of the connection.
std::vector<SessionInfo> connected_sessions; std::vector<SessionInfo> connected_sessions;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version)
{
ar & connected_sessions;
}
friend class boost::serialization::access;
}; };
// NOTE: The below classes are ephemeral and don't need serialization
class MappedBuffer { class MappedBuffer {
public: public:
MappedBuffer(Memory::MemorySystem& memory, const Process& process, u32 descriptor, MappedBuffer(Memory::MemorySystem& memory, const Process& process, u32 descriptor,

View File

@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <boost/serialization/unique_ptr.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
@ -26,6 +27,20 @@ struct MappedBufferContext {
std::unique_ptr<u8[]> buffer; std::unique_ptr<u8[]> buffer;
std::unique_ptr<u8[]> reserve_buffer; std::unique_ptr<u8[]> reserve_buffer;
private:
template <class Archive>
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;
}
friend class boost::serialization::access;
}; };
/// Performs IPC command buffer translation from one process to another. /// Performs IPC command buffer translation from one process to another.

View File

@ -11,6 +11,7 @@
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/kernel/hle_ipc.h"
SERIALIZE_EXPORT_IMPL(Kernel::ServerPort) SERIALIZE_EXPORT_IMPL(Kernel::ServerPort)
@ -50,4 +51,14 @@ KernelSystem::PortPair KernelSystem::CreatePortPair(u32 max_sessions, std::strin
return std::make_pair(std::move(server_port), std::move(client_port)); return std::make_pair(std::move(server_port), std::move(client_port));
} }
template <class Archive>
void ServerPort::serialize(Archive& ar, const unsigned int file_version)
{
ar & boost::serialization::base_object<WaitObject>(*this);
ar & name;
ar & pending_sessions;
ar & hle_handler;
}
SERIALIZE_IMPL(ServerPort)
} // namespace Kernel } // namespace Kernel

View File

@ -67,13 +67,7 @@ public:
private: private:
friend class boost::serialization::access; friend class boost::serialization::access;
template <class Archive> template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) void serialize(Archive& ar, const unsigned int file_version);
{
ar & boost::serialization::base_object<Object>(*this);
ar & name;
ar & pending_sessions;
//ar & hle_handler;
}
}; };
} // namespace Kernel } // namespace Kernel

View File

@ -115,10 +115,10 @@ private:
ar & boost::serialization::base_object<Object>(*this); ar & boost::serialization::base_object<Object>(*this);
ar & name; ar & name;
ar & parent; ar & parent;
//ar & hle_handler; ar & hle_handler;
ar & pending_requesting_threads; ar & pending_requesting_threads;
ar & currently_handling; ar & currently_handling;
//ar & mapped_buffer_context; ar & mapped_buffer_context;
} }
}; };

View File

@ -8,6 +8,7 @@
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/hle_ipc.h"
SERIALIZE_IMPL(Kernel::Session) SERIALIZE_IMPL(Kernel::Session)

View File

@ -117,7 +117,7 @@ private:
ar & owner_process; ar & owner_process;
ar & base_address; ar & base_address;
ar & name; ar & name;
ar & *(reinterpret_cast<MemoryRegionInfo::IntervalSet::ImplSetT*>(&holding_memory));; ar & *(reinterpret_cast<MemoryRegionInfo::IntervalSet::ImplSetT*>(&holding_memory));
} }
friend class boost::serialization::access; friend class boost::serialization::access;
}; };

View File

@ -8,6 +8,9 @@
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/unordered_map.hpp>
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
@ -80,6 +83,14 @@ private:
// For IPC Recorder // For IPC Recorder
/// client port Object id -> service name /// client port Object id -> service name
std::unordered_map<u32, std::string> registered_services_inverse; std::unordered_map<u32, std::string> registered_services_inverse;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version)
{
ar & registered_services;
ar & registered_services_inverse; // TODO: Instead, compute this from registered_services
}
friend class boost::serialization::access;
}; };
} // namespace Service::SM } // namespace Service::SM