mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-23 18:02:46 -06:00
hle: kernel: Ensure all kernel objects with KAutoObject are properly created.
This commit is contained in:
parent
722195cf70
commit
ab704acab8
20 changed files with 55 additions and 0 deletions
|
@ -793,6 +793,7 @@ void KScheduler::UpdateLastContextSwitchTime(KThread* thread, Process* process)
|
|||
|
||||
void KScheduler::Initialize() {
|
||||
idle_thread = std::make_unique<KThread>(system.Kernel());
|
||||
KAutoObject::Create(idle_thread.get());
|
||||
ASSERT(KThread::InitializeIdleThread(system, idle_thread.get(), core_id).IsSuccess());
|
||||
idle_thread->SetName(fmt::format("IdleThread:{}", core_id));
|
||||
}
|
||||
|
|
|
@ -196,6 +196,7 @@ struct KernelCore::Impl {
|
|||
void InitializeSuspendThreads() {
|
||||
for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
|
||||
suspend_threads[core_id] = std::make_unique<KThread>(system.Kernel());
|
||||
KAutoObject::Create(suspend_threads[core_id].get());
|
||||
ASSERT(KThread::InitializeHighPriorityThread(system, suspend_threads[core_id].get(), {},
|
||||
{}, core_id)
|
||||
.IsSuccess());
|
||||
|
@ -236,6 +237,7 @@ struct KernelCore::Impl {
|
|||
KThread* GetHostDummyThread() {
|
||||
auto make_thread = [this]() {
|
||||
std::unique_ptr<KThread> thread = std::make_unique<KThread>(system.Kernel());
|
||||
KAutoObject::Create(thread.get());
|
||||
ASSERT(KThread::InitializeDummyThread(thread.get()).IsSuccess());
|
||||
thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
|
||||
return std::move(thread);
|
||||
|
@ -580,6 +582,11 @@ struct KernelCore::Impl {
|
|||
irs_shared_mem = std::make_unique<KSharedMemory>(system.Kernel());
|
||||
time_shared_mem = std::make_unique<KSharedMemory>(system.Kernel());
|
||||
|
||||
KAutoObject::Create(hid_shared_mem.get());
|
||||
KAutoObject::Create(font_shared_mem.get());
|
||||
KAutoObject::Create(irs_shared_mem.get());
|
||||
KAutoObject::Create(time_shared_mem.get());
|
||||
|
||||
hid_shared_mem->Initialize(system.Kernel(), system.DeviceMemory(), nullptr,
|
||||
{hid_phys_addr, hid_size / PageSize}, KMemoryPermission::None,
|
||||
KMemoryPermission::Read, hid_phys_addr, hid_size,
|
||||
|
|
|
@ -307,6 +307,8 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv
|
|||
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(launchable_event));
|
||||
|
||||
launchable_event.Initialize("ISelfController:LaunchableEvent");
|
||||
|
||||
// This event is created by AM on the first time GetAccumulatedSuspendedTickChangedEvent() is
|
||||
|
@ -315,6 +317,7 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv
|
|||
// suspended if the event has previously been created by a call to
|
||||
// GetAccumulatedSuspendedTickChangedEvent.
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(accumulated_suspended_tick_changed_event));
|
||||
accumulated_suspended_tick_changed_event.Initialize(
|
||||
"ISelfController:AccumulatedSuspendedTickChangedEvent");
|
||||
accumulated_suspended_tick_changed_event.GetWritableEvent()->Signal();
|
||||
|
@ -579,6 +582,10 @@ void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestCo
|
|||
|
||||
AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel)
|
||||
: on_new_message{kernel}, on_operation_mode_changed{kernel} {
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(on_new_message));
|
||||
Kernel::KAutoObject::Create(std::addressof(on_operation_mode_changed));
|
||||
|
||||
on_new_message.Initialize("AMMessageQueue:OnMessageReceived");
|
||||
on_operation_mode_changed.Initialize("AMMessageQueue:OperationModeChanged");
|
||||
}
|
||||
|
@ -1333,6 +1340,11 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_)
|
|||
RegisterHandlers(functions);
|
||||
|
||||
auto& kernel = system.Kernel();
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(gpu_error_detected_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(friend_invitation_storage_channel_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(health_warning_disappeared_system_event));
|
||||
|
||||
gpu_error_detected_event.Initialize("IApplicationFunctions:GpuErrorDetectedSystemEvent");
|
||||
friend_invitation_storage_channel_event.Initialize(
|
||||
"IApplicationFunctions:FriendInvitationStorageChannelEvent");
|
||||
|
@ -1798,6 +1810,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
|
|||
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(pop_from_general_channel_event));
|
||||
pop_from_general_channel_event.Initialize("IHomeMenuFunctions:PopFromGeneralChannelEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@ namespace Service::AM::Applets {
|
|||
AppletDataBroker::AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_)
|
||||
: system{system_}, applet_mode{applet_mode_}, state_changed_event{system.Kernel()},
|
||||
pop_out_data_event{system.Kernel()}, pop_interactive_out_data_event{system.Kernel()} {
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(state_changed_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(pop_out_data_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(pop_interactive_out_data_event));
|
||||
|
||||
state_changed_event.Initialize("ILibraryAppletAccessor:StateChangedEvent");
|
||||
pop_out_data_event.Initialize("ILibraryAppletAccessor:PopDataOutEvent");
|
||||
pop_interactive_out_data_event.Initialize("ILibraryAppletAccessor:PopInteractiveDataOutEvent");
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(purchased_event));
|
||||
purchased_event.Initialize("IPurchaseEventManager:PurchasedEvent");
|
||||
}
|
||||
|
||||
|
@ -125,6 +126,7 @@ AOC_U::AOC_U(Core::System& system_)
|
|||
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(aoc_change_event));
|
||||
aoc_change_event.Initialize("GetAddOnContentListChanged:Event");
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
RegisterHandlers(functions);
|
||||
|
||||
// This is the event handle used to check if the audio buffer was released
|
||||
Kernel::KAutoObject::Create(std::addressof(buffer_event));
|
||||
buffer_event.Initialize("IAudioOutBufferReleased");
|
||||
|
||||
stream = audio_core.OpenStream(system.CoreTiming(), audio_params.sample_rate,
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
// clang-format on
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(system_event));
|
||||
system_event.Initialize("IAudioRenderer:SystemEvent");
|
||||
renderer = std::make_unique<AudioCore::AudioRenderer>(
|
||||
system.CoreTiming(), system.Memory(), audren_params,
|
||||
|
@ -189,13 +190,16 @@ public:
|
|||
};
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(buffer_event));
|
||||
buffer_event.Initialize("IAudioOutBufferReleasedEvent");
|
||||
|
||||
// Should be similar to audio_output_device_switch_event
|
||||
Kernel::KAutoObject::Create(std::addressof(audio_input_device_switch_event));
|
||||
audio_input_device_switch_event.Initialize("IAudioDevice:AudioInputDeviceSwitchedEvent");
|
||||
|
||||
// Should only be signalled when an audio output device has been changed, example: speaker
|
||||
// to headset
|
||||
Kernel::KAutoObject::Create(std::addressof(audio_output_device_switch_event));
|
||||
audio_output_device_switch_event.Initialize("IAudioDevice:AudioOutputDeviceSwitchedEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Service::BCAT {
|
|||
ProgressServiceBackend::ProgressServiceBackend(Kernel::KernelCore& kernel,
|
||||
std::string_view event_name)
|
||||
: update_event{kernel} {
|
||||
Kernel::KAutoObject::Create(std::addressof(update_event));
|
||||
update_event.Initialize("ProgressServiceBackend:UpdateEvent:" + std::string(event_name));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
// clang-format on
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(register_event));
|
||||
register_event.Initialize("BT:RegisterEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,11 @@ public:
|
|||
// clang-format on
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(scan_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(connection_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(service_discovery));
|
||||
Kernel::KAutoObject::Create(std::addressof(config_event));
|
||||
|
||||
scan_event.Initialize("IBtmUserCore:ScanEvent");
|
||||
connection_event.Initialize("IBtmUserCore:ConnectionEvent");
|
||||
service_discovery.Initialize("IBtmUserCore:Discovery");
|
||||
|
|
|
@ -197,6 +197,7 @@ public:
|
|||
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(notification_event));
|
||||
notification_event.Initialize("INotificationService:NotifyEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -254,6 +254,7 @@ void Controller_NPad::OnInit() {
|
|||
auto& kernel = system.Kernel();
|
||||
for (std::size_t i = 0; i < styleset_changed_events.size(); ++i) {
|
||||
styleset_changed_events[i] = std::make_unique<Kernel::KEvent>(kernel);
|
||||
Kernel::KAutoObject::Create(styleset_changed_events[i].get());
|
||||
styleset_changed_events[i]->Initialize(fmt::format("npad:NpadStyleSetChanged_{}", i));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152);
|
|||
Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
|
||||
const char* name)
|
||||
: ServiceFramework{system_, name}, nfc_tag_load{system.Kernel()}, module{std::move(module_)} {
|
||||
Kernel::KAutoObject::Create(std::addressof(nfc_tag_load));
|
||||
nfc_tag_load.Initialize("IUser:NFCTagDetected");
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,9 @@ public:
|
|||
};
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(deactivate_event));
|
||||
Kernel::KAutoObject::Create(std::addressof(availability_change_event));
|
||||
|
||||
deactivate_event.Initialize("IUser:DeactivateEvent");
|
||||
availability_change_event.Initialize("IUser:AvailabilityChangeEvent");
|
||||
}
|
||||
|
|
|
@ -160,6 +160,9 @@ public:
|
|||
|
||||
auto& kernel = system.Kernel();
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(event1));
|
||||
Kernel::KAutoObject::Create(std::addressof(event2));
|
||||
|
||||
event1.Initialize("IRequest:Event1");
|
||||
event2.Initialize("IRequest:Event2");
|
||||
}
|
||||
|
|
|
@ -313,6 +313,7 @@ public:
|
|||
};
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(finished_event));
|
||||
finished_event.Initialize("IEnsureNetworkClockAvailabilityService:FinishEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ Module::Module(Core::System& system) : syncpoint_manager{system.GPU()} {
|
|||
auto& kernel = system.Kernel();
|
||||
for (u32 i = 0; i < MaxNvEvents; i++) {
|
||||
events_interface.events[i].event = std::make_unique<Kernel::KEvent>(kernel);
|
||||
Kernel::KAutoObject::Create(events_interface.events[i].event.get());
|
||||
events_interface.events[i].event->Initialize(fmt::format("NVDRV::NvEvent_{}", i));
|
||||
events_interface.status[i] = EventState::Free;
|
||||
events_interface.registered[i] = false;
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Service::NVFlinger {
|
|||
|
||||
BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id)
|
||||
: id(id), layer_id(layer_id), buffer_wait_event{kernel} {
|
||||
Kernel::KAutoObject::Create(std::addressof(buffer_wait_event));
|
||||
buffer_wait_event.Initialize("BufferQueue:WaitEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
|
||||
RegisterHandlers(functions);
|
||||
|
||||
Kernel::KAutoObject::Create(std::addressof(state_change_event));
|
||||
state_change_event.Initialize("IPsmSession::state_change_event");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ StandardUserSystemClockCore::StandardUserSystemClockCore(
|
|||
network_system_clock_core{network_system_clock_core}, auto_correction_enabled{},
|
||||
auto_correction_time{SteadyClockTimePoint::GetRandom()}, auto_correction_event{
|
||||
system.Kernel()} {
|
||||
Kernel::KAutoObject::Create(std::addressof(auto_correction_event));
|
||||
auto_correction_event.Initialize("StandardUserSystemClockCore:AutoCorrectionEvent");
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Service::VI {
|
|||
|
||||
Display::Display(u64 id, std::string name, Core::System& system)
|
||||
: id{id}, name{std::move(name)}, vsync_event{system.Kernel()} {
|
||||
Kernel::KAutoObject::Create(std::addressof(vsync_event));
|
||||
vsync_event.Initialize(fmt::format("Display VSync Event {}", id));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue