Serialize NIM, PS, PXI, SOC, SSL services

This commit is contained in:
Hamish Milne 2020-01-01 00:58:36 +00:00 committed by zhupengfei
parent 2409ee39cb
commit 571b1062f0
15 changed files with 66 additions and 8 deletions

15
TODO
View File

@ -17,7 +17,7 @@
☐ Telemetry session ☐ Telemetry session
☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE ☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE
☐ Review constructor/initialization code ☐ Review constructor/initialization code
☐ Fix CI ✔ Fix CI @done(19-12-31 21:32)
✔ HW @done(19-08-13 15:41) ✔ HW @done(19-08-13 15:41)
✔ GPU regs @done(19-08-13 15:41) ✔ GPU regs @done(19-08-13 15:41)
✔ LCD regs @done(19-08-13 15:41) ✔ LCD regs @done(19-08-13 15:41)
@ -92,15 +92,14 @@
✔ NDM @done(19-12-31 18:26) ✔ NDM @done(19-12-31 18:26)
✔ NEWS @done(19-12-31 18:29) ✔ NEWS @done(19-12-31 18:29)
✔ NFC @done(19-12-31 20:35) ✔ NFC @done(19-12-31 20:35)
☐ NIM ✔ NIM @done(19-12-31 21:08)
☐ NS ✔ NS @done(20-01-01 00:46)
☐ NWM ☐ NWM
☐ PM ☐ PM
☐ PS ✔ PS @done(20-01-01 00:54)
☐ PTM ☐ PTM
☐ PXI ✔ PXI @done(20-01-01 00:53)
☐ QTM ☐ QTM
☐ SM ✔ SOC @done(20-01-01 00:51)
☐ SOC ✔ SSL @done(20-01-01 00:48)
☐ SSL
☐ Y2R ☐ Y2R

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nim/nim_aoc.h" #include "core/hle/service/nim/nim_aoc.h"
SERIALIZE_EXPORT_IMPL(Service::NIM::NIM_AOC)
namespace Service::NIM { namespace Service::NIM {
NIM_AOC::NIM_AOC() : ServiceFramework("nim:aoc", 2) { NIM_AOC::NIM_AOC() : ServiceFramework("nim:aoc", 2) {

View File

@ -15,3 +15,5 @@ public:
}; };
} // namespace Service::NIM } // namespace Service::NIM
BOOST_CLASS_EXPORT_KEY(Service::NIM::NIM_AOC)

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nim/nim_s.h" #include "core/hle/service/nim/nim_s.h"
SERIALIZE_EXPORT_IMPL(Service::NIM::NIM_S)
namespace Service::NIM { namespace Service::NIM {
NIM_S::NIM_S() : ServiceFramework("nim:s", 1) { NIM_S::NIM_S() : ServiceFramework("nim:s", 1) {

View File

@ -15,3 +15,5 @@ public:
}; };
} // namespace Service::NIM } // namespace Service::NIM
BOOST_CLASS_EXPORT_KEY(Service::NIM::NIM_S)

View File

@ -2,11 +2,15 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/service/nim/nim_u.h" #include "core/hle/service/nim/nim_u.h"
SERVICE_CONSTRUCT_IMPL(Service::NIM::NIM_U)
SERIALIZE_EXPORT_IMPL(Service::NIM::NIM_U)
namespace Service::NIM { namespace Service::NIM {
NIM_U::NIM_U(Core::System& system) : ServiceFramework("nim:u", 2) { NIM_U::NIM_U(Core::System& system) : ServiceFramework("nim:u", 2) {

View File

@ -41,6 +41,16 @@ private:
void CheckSysUpdateAvailable(Kernel::HLERequestContext& ctx); void CheckSysUpdateAvailable(Kernel::HLERequestContext& ctx);
std::shared_ptr<Kernel::Event> nim_system_update_event; std::shared_ptr<Kernel::Event> nim_system_update_event;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar& nim_system_update_event;
}
friend class boost::serialization::access;
}; };
} // namespace Service::NIM } // namespace Service::NIM
SERVICE_CONSTRUCT(Service::NIM::NIM_U)
BOOST_CLASS_EXPORT_KEY(Service::NIM::NIM_U)

View File

@ -4,6 +4,7 @@
#include <cryptopp/aes.h> #include <cryptopp/aes.h>
#include <cryptopp/modes.h> #include <cryptopp/modes.h>
#include "common/archives.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
@ -11,6 +12,8 @@
#include "core/hw/aes/arithmetic128.h" #include "core/hw/aes/arithmetic128.h"
#include "core/hw/aes/key.h" #include "core/hw/aes/key.h"
SERIALIZE_EXPORT_IMPL(Service::PS::PS_PS)
namespace Service::PS { namespace Service::PS {
enum class AlgorithmType : u8 { enum class AlgorithmType : u8 {

View File

@ -231,3 +231,5 @@ private:
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);
} // namespace Service::PS } // namespace Service::PS
BOOST_CLASS_EXPORT_KEY(Service::PS::PS_PS)

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/pxi/dev.h" #include "core/hle/service/pxi/dev.h"
SERIALIZE_EXPORT_IMPL(Service::PXI::DEV)
namespace Service::PXI { namespace Service::PXI {
DEV::DEV() : ServiceFramework("pxi:dev", 1) { DEV::DEV() : ServiceFramework("pxi:dev", 1) {

View File

@ -16,3 +16,5 @@ public:
}; };
} // namespace Service::PXI } // namespace Service::PXI
BOOST_CLASS_EXPORT_KEY(Service::PXI::DEV)

View File

@ -5,6 +5,7 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -52,6 +53,8 @@
#define closesocket(x) close(x) #define closesocket(x) close(x)
#endif #endif
SERIALIZE_EXPORT_IMPL(Service::SOC::SOC_U)
namespace Service::SOC { namespace Service::SOC {
const s32 SOCKET_ERROR_VALUE = -1; const s32 SOCKET_ERROR_VALUE = -1;

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <unordered_map> #include <unordered_map>
#include <boost/serialization/unordered_map.hpp>
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core { namespace Core {
@ -17,6 +18,14 @@ namespace Service::SOC {
struct SocketHolder { struct SocketHolder {
u32 socket_fd; ///< The socket descriptor u32 socket_fd; ///< The socket descriptor
bool blocking; ///< Whether the socket is blocking or not, it is only read on Windows. bool blocking; ///< Whether the socket is blocking or not, it is only read on Windows.
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& socket_fd;
ar& blocking;
}
friend class boost::serialization::access;
}; };
class SOC_U final : public ServiceFramework<SOC_U> { class SOC_U final : public ServiceFramework<SOC_U> {
@ -55,8 +64,17 @@ private:
/// Holds info about the currently open sockets /// Holds info about the currently open sockets
std::unordered_map<u32, SocketHolder> open_sockets; std::unordered_map<u32, SocketHolder> open_sockets;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar& open_sockets;
}
friend class boost::serialization::access;
}; };
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);
} // namespace Service::SOC } // namespace Service::SOC
BOOST_CLASS_EXPORT_KEY(Service::SOC::SOC_U)

View File

@ -2,12 +2,14 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/ssl_c.h" #include "core/hle/service/ssl_c.h"
SERIALIZE_EXPORT_IMPL(Service::SSL::SSL_C)
namespace Service::SSL { namespace Service::SSL {
void SSL_C::Initialize(Kernel::HLERequestContext& ctx) { void SSL_C::Initialize(Kernel::HLERequestContext& ctx) {

View File

@ -28,3 +28,5 @@ private:
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);
} // namespace Service::SSL } // namespace Service::SSL
BOOST_CLASS_EXPORT_KEY(Service::SSL::SSL_C)