mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Serialize some more kernel objects
This commit is contained in:
		
							parent
							
								
									8c81500dee
								
							
						
					
					
						commit
						4f95575d41
					
				
					 15 changed files with 66 additions and 12 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| #include "boost/archive/binary_iarchive.hpp" | ||||
| #include "boost/archive/binary_oarchive.hpp" | ||||
| #include "boost/serialization/export.hpp" | ||||
| 
 | ||||
| using iarchive = boost::archive::binary_iarchive; | ||||
| using oarchive = boost::archive::binary_oarchive; | ||||
|  |  | |||
|  | @ -398,6 +398,8 @@ void System::Reset() { | |||
| template<class Archive> | ||||
| void System::serialize(Archive & ar, const unsigned int file_version) | ||||
| { | ||||
|     ar & *cpu_core.get(); | ||||
|     //ar & *service_manager.get();
 | ||||
|     ar & GPU::g_regs; | ||||
|     ar & LCD::g_regs; | ||||
|     ar & dsp_core->GetDspMemory(); | ||||
|  |  | |||
|  | @ -6,17 +6,20 @@ | |||
| #include <map> | ||||
| #include <vector> | ||||
| #include "common/assert.h" | ||||
| #include "common/archives.h" | ||||
| #include "core/hle/kernel/event.h" | ||||
| #include "core/hle/kernel/kernel.h" | ||||
| #include "core/hle/kernel/thread.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Kernel::Event) | ||||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| Event::Event(KernelSystem& kernel) : WaitObject(kernel) {} | ||||
| Event::Event() : WaitObject() {} | ||||
| Event::~Event() {} | ||||
| 
 | ||||
| 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->reset_type = reset_type; | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <boost/serialization/export.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "core/hle/kernel/object.h" | ||||
| #include "core/hle/kernel/wait_object.h" | ||||
|  | @ -12,7 +13,7 @@ namespace Kernel { | |||
| 
 | ||||
| class Event final : public WaitObject { | ||||
| public: | ||||
|     explicit Event(KernelSystem& kernel); | ||||
|     explicit Event(); | ||||
|     ~Event() override; | ||||
| 
 | ||||
|     std::string GetTypeName() const override { | ||||
|  | @ -62,3 +63,5 @@ private: | |||
| }; | ||||
| 
 | ||||
| } // 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 & *config_mem_handler.get(); | ||||
|     // 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) | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| 
 | ||||
| #include <map> | ||||
| #include <vector> | ||||
| #include "common/archives.h" | ||||
| #include "common/assert.h" | ||||
| #include "core/core.h" | ||||
| #include "core/hle/kernel/errors.h" | ||||
|  | @ -12,6 +13,8 @@ | |||
| #include "core/hle/kernel/object.h" | ||||
| #include "core/hle/kernel/thread.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Kernel::Mutex) | ||||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| void ReleaseThreadMutexes(Thread* thread) { | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include <boost/serialization/export.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "core/hle/kernel/kernel.h" | ||||
| #include "core/hle/kernel/wait_object.h" | ||||
|  | @ -78,3 +79,5 @@ private: | |||
| void ReleaseThreadMutexes(Thread* thread); | ||||
| 
 | ||||
| } // 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 & kernel_version; | ||||
|     ar & ideal_processor; | ||||
|     ar & status; | ||||
|     ar & process_id; | ||||
|     ar & vm_manager; | ||||
|     ar & memory_used; | ||||
|  |  | |||
|  | @ -3,14 +3,17 @@ | |||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #include "common/assert.h" | ||||
| #include "common/archives.h" | ||||
| #include "core/hle/kernel/errors.h" | ||||
| #include "core/hle/kernel/kernel.h" | ||||
| #include "core/hle/kernel/semaphore.h" | ||||
| #include "core/hle/kernel/thread.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Kernel::Semaphore) | ||||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| Semaphore::Semaphore(KernelSystem& kernel) : WaitObject(kernel) {} | ||||
| Semaphore::Semaphore() : WaitObject() {} | ||||
| Semaphore::~Semaphore() {} | ||||
| 
 | ||||
| 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) | ||||
|         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,
 | ||||
|     // and the rest is reserved for the caller thread
 | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <string> | ||||
| #include <queue> | ||||
| #include <boost/serialization/export.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "core/hle/kernel/object.h" | ||||
| #include "core/hle/kernel/wait_object.h" | ||||
|  | @ -15,7 +16,7 @@ namespace Kernel { | |||
| 
 | ||||
| class Semaphore final : public WaitObject { | ||||
| public: | ||||
|     explicit Semaphore(KernelSystem& kernel); | ||||
|     explicit Semaphore(); | ||||
|     ~Semaphore() override; | ||||
| 
 | ||||
|     std::string GetTypeName() const override { | ||||
|  | @ -57,3 +58,5 @@ private: | |||
| }; | ||||
| 
 | ||||
| } // namespace Kernel
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Kernel::Semaphore) | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <string> | ||||
| #include <utility> | ||||
| #include <boost/serialization/export.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "core/hle/kernel/object.h" | ||||
| #include "core/hle/kernel/process.h" | ||||
|  | @ -104,6 +105,21 @@ private: | |||
| 
 | ||||
|     friend class KernelSystem; | ||||
|     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
 | ||||
|  |  | |||
|  | @ -25,6 +25,8 @@ | |||
| #include "core/hle/result.h" | ||||
| #include "core/memory.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Kernel::Thread) | ||||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| template <class Archive> | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ | |||
| #include <boost/serialization/shared_ptr.hpp> | ||||
| #include <boost/serialization/unordered_map.hpp> | ||||
| #include <boost/serialization/vector.hpp> | ||||
| #include <boost/serialization/export.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "common/thread_queue_list.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); | ||||
| 
 | ||||
| } // namespace Kernel
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Kernel::Thread) | ||||
|  |  | |||
|  | @ -94,6 +94,7 @@ private: | |||
|         ar & permissions; | ||||
|         ar & meminfo_state; | ||||
|         // TODO: backing memory ref
 | ||||
|         // backing memory can be: Physical/FCRAM pointer, config mem, shared page
 | ||||
|         ar & paddr; | ||||
|         ar & mmio_handler; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue