summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-10 01:56:11 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:51 +0200
commitab704acab80d17f9a8e34dcbb753d60de2a86f86 (patch)
tree41b84d29f755f19f2222bef358631f88c6f2152f /src/core
parenthle: kernel: Use unique_ptr for suspend and dummy threads. (diff)
downloadyuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.tar
yuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.tar.gz
yuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.tar.bz2
yuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.tar.lz
yuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.tar.xz
yuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.tar.zst
yuzu-ab704acab80d17f9a8e34dcbb753d60de2a86f86.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp1
-rw-r--r--src/core/hle/kernel/kernel.cpp7
-rw-r--r--src/core/hle/service/am/am.cpp13
-rw-r--r--src/core/hle/service/am/applets/applets.cpp5
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp2
-rw-r--r--src/core/hle/service/audio/audout_u.cpp1
-rw-r--r--src/core/hle/service/audio/audren_u.cpp4
-rw-r--r--src/core/hle/service/bcat/backend/backend.cpp1
-rw-r--r--src/core/hle/service/btdrv/btdrv.cpp1
-rw-r--r--src/core/hle/service/btm/btm.cpp5
-rw-r--r--src/core/hle/service/friend/friend.cpp1
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp1
-rw-r--r--src/core/hle/service/nfp/nfp.cpp4
-rw-r--r--src/core/hle/service/nifm/nifm.cpp3
-rw-r--r--src/core/hle/service/nim/nim.cpp1
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp1
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp1
-rw-r--r--src/core/hle/service/ptm/psm.cpp1
-rw-r--r--src/core/hle/service/time/standard_user_system_clock_core.cpp1
-rw-r--r--src/core/hle/service/vi/display/vi_display.cpp1
20 files changed, 55 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index c048d86a3..09382f7dd 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -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));
}
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 1249a4c96..43bce1863 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -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,
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 3800c65ad..c1982e996 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -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");
}
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp
index 58bff810d..6cceff064 100644
--- a/src/core/hle/service/am/applets/applets.cpp
+++ b/src/core/hle/service/am/applets/applets.cpp
@@ -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");
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 12a025610..7d7a8c0ad 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -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");
}
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 4052c8e60..5a7d73b48 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -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,
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index d573530df..b0a362f52 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -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");
}
diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp
index 932e70bfd..8def52b31 100644
--- a/src/core/hle/service/bcat/backend/backend.cpp
+++ b/src/core/hle/service/bcat/backend/backend.cpp
@@ -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));
}
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index dde276ff4..fd97a822c 100644
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -35,6 +35,7 @@ public:
// clang-format on
RegisterHandlers(functions);
+ Kernel::KAutoObject::Create(std::addressof(register_event));
register_event.Initialize("BT:RegisterEvent");
}
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp
index 403296650..3b5ef69e1 100644
--- a/src/core/hle/service/btm/btm.cpp
+++ b/src/core/hle/service/btm/btm.cpp
@@ -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");
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 526b0f896..91c202952 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -197,6 +197,7 @@ public:
RegisterHandlers(functions);
+ Kernel::KAutoObject::Create(std::addressof(notification_event));
notification_event.Initialize("INotificationService:NotifyEvent");
}
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 7d9debc09..753875d6e 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -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));
}
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp
index 164b8b9cd..d1cf01390 100644
--- a/src/core/hle/service/nfp/nfp.cpp
+++ b/src/core/hle/service/nfp/nfp.cpp
@@ -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");
}
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index fe1c25757..c91427b8b 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -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");
}
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index 6d66ad90b..4a2262562 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -313,6 +313,7 @@ public:
};
RegisterHandlers(functions);
+ Kernel::KAutoObject::Create(std::addressof(finished_event));
finished_event.Initialize("IEnsureNetworkClockAvailabilityService:FinishEvent");
}
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 74399bcdb..64bdb0722 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -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;
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index 8ddb1f908..95e5a5e7f 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -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");
}
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp
index 22e5d9749..2659ab7d5 100644
--- a/src/core/hle/service/ptm/psm.cpp
+++ b/src/core/hle/service/ptm/psm.cpp
@@ -33,6 +33,7 @@ public:
RegisterHandlers(functions);
+ Kernel::KAutoObject::Create(std::addressof(state_change_event));
state_change_event.Initialize("IPsmSession::state_change_event");
}
diff --git a/src/core/hle/service/time/standard_user_system_clock_core.cpp b/src/core/hle/service/time/standard_user_system_clock_core.cpp
index c41bdd48b..7f47b12b8 100644
--- a/src/core/hle/service/time/standard_user_system_clock_core.cpp
+++ b/src/core/hle/service/time/standard_user_system_clock_core.cpp
@@ -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");
}
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp
index ebaacaa6b..7c52b6aa7 100644
--- a/src/core/hle/service/vi/display/vi_display.cpp
+++ b/src/core/hle/service/vi/display/vi_display.cpp
@@ -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));
}