hle: kernel: Migrate KSharedMemory to KAutoObject.
This commit is contained in:
parent
7ccbdd4d8d
commit
086db71e94
16 changed files with 128 additions and 114 deletions
|
@ -16,16 +16,11 @@ namespace Service::Time {
|
|||
static constexpr std::size_t SHARED_MEMORY_SIZE{0x1000};
|
||||
|
||||
SharedMemory::SharedMemory(Core::System& system) : system(system) {
|
||||
shared_memory_holder = SharedFrom(&system.Kernel().GetTimeSharedMem());
|
||||
std::memset(shared_memory_holder->GetPointer(), 0, SHARED_MEMORY_SIZE);
|
||||
std::memset(system.Kernel().GetTimeSharedMem().GetPointer(), 0, SHARED_MEMORY_SIZE);
|
||||
}
|
||||
|
||||
SharedMemory::~SharedMemory() = default;
|
||||
|
||||
std::shared_ptr<Kernel::KSharedMemory> SharedMemory::GetSharedMemoryHolder() const {
|
||||
return shared_memory_holder;
|
||||
}
|
||||
|
||||
void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id,
|
||||
Clock::TimeSpanType current_time_point) {
|
||||
const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks(
|
||||
|
@ -34,22 +29,22 @@ void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id,
|
|||
static_cast<u64>(current_time_point.nanoseconds - ticks_time_span.nanoseconds),
|
||||
clock_source_id};
|
||||
shared_memory_format.standard_steady_clock_timepoint.StoreData(
|
||||
shared_memory_holder->GetPointer(), context);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), context);
|
||||
}
|
||||
|
||||
void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) {
|
||||
shared_memory_format.standard_local_system_clock_context.StoreData(
|
||||
shared_memory_holder->GetPointer(), context);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), context);
|
||||
}
|
||||
|
||||
void SharedMemory::UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context) {
|
||||
shared_memory_format.standard_network_system_clock_context.StoreData(
|
||||
shared_memory_holder->GetPointer(), context);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), context);
|
||||
}
|
||||
|
||||
void SharedMemory::SetAutomaticCorrectionEnabled(bool is_enabled) {
|
||||
shared_memory_format.standard_user_system_clock_automatic_correction.StoreData(
|
||||
shared_memory_holder->GetPointer(), is_enabled);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), is_enabled);
|
||||
}
|
||||
|
||||
} // namespace Service::Time
|
||||
|
|
|
@ -17,9 +17,6 @@ public:
|
|||
explicit SharedMemory(Core::System& system);
|
||||
~SharedMemory();
|
||||
|
||||
// Return the shared memory handle
|
||||
std::shared_ptr<Kernel::KSharedMemory> GetSharedMemoryHolder() const;
|
||||
|
||||
// TODO(ogniK): We have to properly simulate memory barriers, how are we going to do this?
|
||||
template <typename T, std::size_t Offset>
|
||||
struct MemoryBarrier {
|
||||
|
@ -63,7 +60,6 @@ public:
|
|||
void SetAutomaticCorrectionEnabled(bool is_enabled);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Kernel::KSharedMemory> shared_memory_holder;
|
||||
Core::System& system;
|
||||
Format shared_memory_format{};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue