mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 18:12:44 -06:00
Serialize some more kernel objects
This commit is contained in:
parent
8c81500dee
commit
4f95575d41
15 changed files with 66 additions and 12 deletions
21
TODO
21
TODO
|
@ -2,6 +2,10 @@
|
||||||
✔ 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
|
||||||
|
☐ App loader
|
||||||
|
☐ Archive manager
|
||||||
|
☐ Custom texture cache
|
||||||
☐ MMIO
|
☐ MMIO
|
||||||
☐ Movie
|
☐ Movie
|
||||||
☐ Perf stats
|
☐ Perf stats
|
||||||
|
@ -24,27 +28,32 @@
|
||||||
✔ Client port @done(19-08-13 16:40)
|
✔ Client port @done(19-08-13 16:40)
|
||||||
✔ Client session @done(19-08-13 16:40)
|
✔ Client session @done(19-08-13 16:40)
|
||||||
✔ Config mem @done(19-08-13 16:40)
|
✔ Config mem @done(19-08-13 16:40)
|
||||||
☐ Event
|
✔ 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
|
||||||
☐ IPC
|
☐ IPC
|
||||||
✔ 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 @started(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)
|
||||||
☐ Process @started(19-08-13 16:43)
|
✔ Process @started(19-08-13 16:43) @done(19-12-22 18:41)
|
||||||
|
☐ Code set @started(19-12-22 18:41)
|
||||||
|
Needs a way to reference loaded images (so we don't serialize the entire ROM as well)
|
||||||
✔ Resource limit @done(19-08-13 16:43)
|
✔ Resource limit @done(19-08-13 16:43)
|
||||||
☐ Semaphore @started(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)
|
||||||
✔ Session @done(19-08-13 16:44)
|
✔ Session @done(19-08-13 16:44)
|
||||||
☐ Shared memory
|
☐ Shared memory @started(19-12-22 21:20)
|
||||||
|
Need to figure out backing memory (a u8*)
|
||||||
✘ Shared page @started(19-08-13 16:44) @cancelled(19-12-22 11:19)
|
✘ Shared page @started(19-08-13 16:44) @cancelled(19-12-22 11:19)
|
||||||
Not needed right now as shared_page is read-only and derived from other data
|
Not needed right now as shared_page is read-only and derived from other data
|
||||||
☐ SVC
|
✔ SVC @done(19-12-22 21:32)
|
||||||
|
Nothing to do - all data is constant
|
||||||
☐ Thread @started(19-08-13 16:45)
|
☐ Thread @started(19-08-13 16:45)
|
||||||
This requires refactoring wakeup_callback to be an object ref
|
This requires refactoring wakeup_callback to be an object ref
|
||||||
✔ Timer @done(19-08-13 16:45)
|
✔ Timer @done(19-08-13 16:45)
|
||||||
☐ VM Manager @started(19-08-13 16:46)
|
☐ VM Manager @started(19-08-13 16:46)
|
||||||
|
Just need to figure out backing_mem (a u8*)
|
||||||
✔ Wait object @done(19-08-13 16:46)
|
✔ Wait object @done(19-08-13 16:46)
|
||||||
☐ Service
|
☐ Service
|
||||||
☐ AC
|
☐ AC
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "boost/archive/binary_iarchive.hpp"
|
#include "boost/archive/binary_iarchive.hpp"
|
||||||
#include "boost/archive/binary_oarchive.hpp"
|
#include "boost/archive/binary_oarchive.hpp"
|
||||||
|
#include "boost/serialization/export.hpp"
|
||||||
|
|
||||||
using iarchive = boost::archive::binary_iarchive;
|
using iarchive = boost::archive::binary_iarchive;
|
||||||
using oarchive = boost::archive::binary_oarchive;
|
using oarchive = boost::archive::binary_oarchive;
|
||||||
|
|
|
@ -398,6 +398,8 @@ void System::Reset() {
|
||||||
template<class Archive>
|
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 & *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();
|
||||||
|
|
|
@ -6,17 +6,20 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/archives.h"
|
||||||
#include "core/hle/kernel/event.h"
|
#include "core/hle/kernel/event.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Kernel::Event)
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
Event::Event(KernelSystem& kernel) : WaitObject(kernel) {}
|
Event::Event() : WaitObject() {}
|
||||||
Event::~Event() {}
|
Event::~Event() {}
|
||||||
|
|
||||||
std::shared_ptr<Event> KernelSystem::CreateEvent(ResetType reset_type, std::string name) {
|
std::shared_ptr<Event> KernelSystem::CreateEvent(ResetType reset_type, std::string name) {
|
||||||
auto evt{std::make_shared<Event>(*this)};
|
auto evt{std::make_shared<Event>()};
|
||||||
|
|
||||||
evt->signaled = false;
|
evt->signaled = false;
|
||||||
evt->reset_type = reset_type;
|
evt->reset_type = reset_type;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <boost/serialization/export.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/kernel/wait_object.h"
|
#include "core/hle/kernel/wait_object.h"
|
||||||
|
@ -12,7 +13,7 @@ namespace Kernel {
|
||||||
|
|
||||||
class Event final : public WaitObject {
|
class Event final : public WaitObject {
|
||||||
public:
|
public:
|
||||||
explicit Event(KernelSystem& kernel);
|
explicit Event();
|
||||||
~Event() override;
|
~Event() override;
|
||||||
|
|
||||||
std::string GetTypeName() const override {
|
std::string GetTypeName() const override {
|
||||||
|
@ -62,3 +63,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Kernel::Event)
|
||||||
|
|
|
@ -121,6 +121,7 @@ void KernelSystem::serialize(Archive& ar, const unsigned int file_version)
|
||||||
ar & *thread_manager.get();
|
ar & *thread_manager.get();
|
||||||
ar & *config_mem_handler.get();
|
ar & *config_mem_handler.get();
|
||||||
// Shared page data is read-only at the moment, so doesn't need serializing
|
// Shared page data is read-only at the moment, so doesn't need serializing
|
||||||
|
// Deliberately don't include debugger info to allow debugging through loads
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIALIZE_IMPL(KernelSystem)
|
SERIALIZE_IMPL(KernelSystem)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "common/archives.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/errors.h"
|
#include "core/hle/kernel/errors.h"
|
||||||
|
@ -12,6 +13,8 @@
|
||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Kernel::Mutex)
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
void ReleaseThreadMutexes(Thread* thread) {
|
void ReleaseThreadMutexes(Thread* thread) {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <boost/serialization/export.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/wait_object.h"
|
#include "core/hle/kernel/wait_object.h"
|
||||||
|
@ -78,3 +79,5 @@ private:
|
||||||
void ReleaseThreadMutexes(Thread* thread);
|
void ReleaseThreadMutexes(Thread* thread);
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Kernel::Mutex)
|
||||||
|
|
|
@ -34,6 +34,7 @@ void Process::serialize(Archive& ar, const unsigned int file_version)
|
||||||
ar & flags.raw;
|
ar & flags.raw;
|
||||||
ar & kernel_version;
|
ar & kernel_version;
|
||||||
ar & ideal_processor;
|
ar & ideal_processor;
|
||||||
|
ar & status;
|
||||||
ar & process_id;
|
ar & process_id;
|
||||||
ar & vm_manager;
|
ar & vm_manager;
|
||||||
ar & memory_used;
|
ar & memory_used;
|
||||||
|
|
|
@ -3,14 +3,17 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/archives.h"
|
||||||
#include "core/hle/kernel/errors.h"
|
#include "core/hle/kernel/errors.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/semaphore.h"
|
#include "core/hle/kernel/semaphore.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Kernel::Semaphore)
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
Semaphore::Semaphore(KernelSystem& kernel) : WaitObject(kernel) {}
|
Semaphore::Semaphore() : WaitObject() {}
|
||||||
Semaphore::~Semaphore() {}
|
Semaphore::~Semaphore() {}
|
||||||
|
|
||||||
ResultVal<std::shared_ptr<Semaphore>> KernelSystem::CreateSemaphore(s32 initial_count,
|
ResultVal<std::shared_ptr<Semaphore>> KernelSystem::CreateSemaphore(s32 initial_count,
|
||||||
|
@ -20,7 +23,7 @@ ResultVal<std::shared_ptr<Semaphore>> KernelSystem::CreateSemaphore(s32 initial_
|
||||||
if (initial_count > max_count)
|
if (initial_count > max_count)
|
||||||
return ERR_INVALID_COMBINATION_KERNEL;
|
return ERR_INVALID_COMBINATION_KERNEL;
|
||||||
|
|
||||||
auto semaphore{std::make_shared<Semaphore>(*this)};
|
auto semaphore{std::make_shared<Semaphore>()};
|
||||||
|
|
||||||
// When the semaphore is created, some slots are reserved for other threads,
|
// When the semaphore is created, some slots are reserved for other threads,
|
||||||
// and the rest is reserved for the caller thread
|
// and the rest is reserved for the caller thread
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <boost/serialization/export.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/kernel/wait_object.h"
|
#include "core/hle/kernel/wait_object.h"
|
||||||
|
@ -15,7 +16,7 @@ namespace Kernel {
|
||||||
|
|
||||||
class Semaphore final : public WaitObject {
|
class Semaphore final : public WaitObject {
|
||||||
public:
|
public:
|
||||||
explicit Semaphore(KernelSystem& kernel);
|
explicit Semaphore();
|
||||||
~Semaphore() override;
|
~Semaphore() override;
|
||||||
|
|
||||||
std::string GetTypeName() const override {
|
std::string GetTypeName() const override {
|
||||||
|
@ -57,3 +58,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Kernel::Semaphore)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <boost/serialization/export.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/kernel/process.h"
|
#include "core/hle/kernel/process.h"
|
||||||
|
@ -104,6 +105,21 @@ private:
|
||||||
|
|
||||||
friend class KernelSystem;
|
friend class KernelSystem;
|
||||||
KernelSystem& kernel;
|
KernelSystem& kernel;
|
||||||
|
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int file_version)
|
||||||
|
{
|
||||||
|
ar & linear_heap_phys_offset;
|
||||||
|
// TODO: backing blocks u8* (this is always FCRAM I think)
|
||||||
|
ar & size;
|
||||||
|
ar & permissions;
|
||||||
|
ar & other_permissions;
|
||||||
|
ar & owner_process;
|
||||||
|
ar & base_address;
|
||||||
|
ar & name;
|
||||||
|
ar & *(reinterpret_cast<MemoryRegionInfo::IntervalSet::ImplSetT*>(&holding_memory));;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Kernel::Thread)
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <boost/serialization/shared_ptr.hpp>
|
#include <boost/serialization/shared_ptr.hpp>
|
||||||
#include <boost/serialization/unordered_map.hpp>
|
#include <boost/serialization/unordered_map.hpp>
|
||||||
#include <boost/serialization/vector.hpp>
|
#include <boost/serialization/vector.hpp>
|
||||||
|
#include <boost/serialization/export.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/thread_queue_list.h"
|
#include "common/thread_queue_list.h"
|
||||||
#include "core/arm/arm_interface.h"
|
#include "core/arm/arm_interface.h"
|
||||||
|
@ -337,3 +338,5 @@ std::shared_ptr<Thread> SetupMainThread(KernelSystem& kernel, u32 entry_point, u
|
||||||
std::shared_ptr<Process> owner_process);
|
std::shared_ptr<Process> owner_process);
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Kernel::Thread)
|
||||||
|
|
|
@ -94,6 +94,7 @@ private:
|
||||||
ar & permissions;
|
ar & permissions;
|
||||||
ar & meminfo_state;
|
ar & meminfo_state;
|
||||||
// TODO: backing memory ref
|
// TODO: backing memory ref
|
||||||
|
// backing memory can be: Physical/FCRAM pointer, config mem, shared page
|
||||||
ar & paddr;
|
ar & paddr;
|
||||||
ar & mmio_handler;
|
ar & mmio_handler;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue