diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/core.cpp | 26 | ||||
| -rw-r--r-- | src/core/core.h | 28 | ||||
| -rw-r--r-- | src/core/file_sys/archive_extsavedata.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/archive_ncch.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/archive_source_sd_savedata.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/archive_systemsavedata.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/function_wrappers.h | 16 | ||||
| -rw-r--r-- | src/core/hle/hle.h | 23 | ||||
| -rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/csnd_snd.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/fs/archive.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/fs/archive.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/mic_u.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 70 |
19 files changed, 94 insertions, 107 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d547b0746..5d74e4546 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -31,7 +31,6 @@ set(SRCS | |||
| 31 | file_sys/savedata_archive.cpp | 31 | file_sys/savedata_archive.cpp |
| 32 | gdbstub/gdbstub.cpp | 32 | gdbstub/gdbstub.cpp |
| 33 | hle/config_mem.cpp | 33 | hle/config_mem.cpp |
| 34 | hle/hle.cpp | ||
| 35 | hle/applets/applet.cpp | 34 | hle/applets/applet.cpp |
| 36 | hle/applets/erreula.cpp | 35 | hle/applets/erreula.cpp |
| 37 | hle/applets/mii_selector.cpp | 36 | hle/applets/mii_selector.cpp |
| @@ -195,7 +194,6 @@ set(HEADERS | |||
| 195 | gdbstub/gdbstub.h | 194 | gdbstub/gdbstub.h |
| 196 | hle/config_mem.h | 195 | hle/config_mem.h |
| 197 | hle/function_wrappers.h | 196 | hle/function_wrappers.h |
| 198 | hle/hle.h | ||
| 199 | hle/ipc.h | 197 | hle/ipc.h |
| 200 | hle/applets/applet.h | 198 | hle/applets/applet.h |
| 201 | hle/applets/erreula.h | 199 | hle/applets/erreula.h |
diff --git a/src/core/core.cpp b/src/core/core.cpp index b4df90efd..67d7cf7b2 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -12,10 +12,10 @@ | |||
| 12 | #include "core/core.h" | 12 | #include "core/core.h" |
| 13 | #include "core/core_timing.h" | 13 | #include "core/core_timing.h" |
| 14 | #include "core/gdbstub/gdbstub.h" | 14 | #include "core/gdbstub/gdbstub.h" |
| 15 | #include "core/hle/hle.h" | ||
| 16 | #include "core/hle/kernel/kernel.h" | 15 | #include "core/hle/kernel/kernel.h" |
| 17 | #include "core/hle/kernel/memory.h" | 16 | #include "core/hle/kernel/memory.h" |
| 18 | #include "core/hle/kernel/thread.h" | 17 | #include "core/hle/kernel/thread.h" |
| 18 | #include "core/hle/service/service.h" | ||
| 19 | #include "core/hw/hw.h" | 19 | #include "core/hw/hw.h" |
| 20 | #include "core/loader/loader.h" | 20 | #include "core/loader/loader.h" |
| 21 | #include "core/settings.h" | 21 | #include "core/settings.h" |
| @@ -51,15 +51,13 @@ System::ResultStatus System::RunLoop(int tight_loop) { | |||
| 51 | LOG_TRACE(Core_ARM11, "Idling"); | 51 | LOG_TRACE(Core_ARM11, "Idling"); |
| 52 | CoreTiming::Idle(); | 52 | CoreTiming::Idle(); |
| 53 | CoreTiming::Advance(); | 53 | CoreTiming::Advance(); |
| 54 | HLE::Reschedule(__func__); | 54 | PrepareReschedule(); |
| 55 | } else { | 55 | } else { |
| 56 | app_core->Run(tight_loop); | 56 | app_core->Run(tight_loop); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | HW::Update(); | 59 | HW::Update(); |
| 60 | if (HLE::IsReschedulePending()) { | 60 | Reschedule(); |
| 61 | Kernel::Reschedule(); | ||
| 62 | } | ||
| 63 | 61 | ||
| 64 | return ResultStatus::Success; | 62 | return ResultStatus::Success; |
| 65 | } | 63 | } |
| @@ -110,6 +108,20 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file | |||
| 110 | return ResultStatus::Success; | 108 | return ResultStatus::Success; |
| 111 | } | 109 | } |
| 112 | 110 | ||
| 111 | void System::PrepareReschedule() { | ||
| 112 | app_core->PrepareReschedule(); | ||
| 113 | reschedule_pending = true; | ||
| 114 | } | ||
| 115 | |||
| 116 | void System::Reschedule() { | ||
| 117 | if (!reschedule_pending) { | ||
| 118 | return; | ||
| 119 | } | ||
| 120 | |||
| 121 | reschedule_pending = false; | ||
| 122 | Kernel::Reschedule(); | ||
| 123 | } | ||
| 124 | |||
| 113 | System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | 125 | System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { |
| 114 | if (app_core) { | 126 | if (app_core) { |
| 115 | app_core.reset(); | 127 | app_core.reset(); |
| @@ -126,7 +138,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | |||
| 126 | CoreTiming::Init(); | 138 | CoreTiming::Init(); |
| 127 | HW::Init(); | 139 | HW::Init(); |
| 128 | Kernel::Init(system_mode); | 140 | Kernel::Init(system_mode); |
| 129 | HLE::Init(); | 141 | Service::Init(); |
| 130 | AudioCore::Init(); | 142 | AudioCore::Init(); |
| 131 | GDBStub::Init(); | 143 | GDBStub::Init(); |
| 132 | 144 | ||
| @@ -143,7 +155,7 @@ void System::Shutdown() { | |||
| 143 | GDBStub::Shutdown(); | 155 | GDBStub::Shutdown(); |
| 144 | AudioCore::Shutdown(); | 156 | AudioCore::Shutdown(); |
| 145 | VideoCore::Shutdown(); | 157 | VideoCore::Shutdown(); |
| 146 | HLE::Shutdown(); | 158 | Service::Shutdown(); |
| 147 | Kernel::Shutdown(); | 159 | Kernel::Shutdown(); |
| 148 | HW::Shutdown(); | 160 | HW::Shutdown(); |
| 149 | CoreTiming::Shutdown(); | 161 | CoreTiming::Shutdown(); |
diff --git a/src/core/core.h b/src/core/core.h index f4326161d..8194db6a2 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -53,17 +53,6 @@ public: | |||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * Initialize the emulated system. | ||
| 57 | * @param emu_window Pointer to the host-system window used for video output and keyboard input. | ||
| 58 | * @param system_mode The system mode. | ||
| 59 | * @return ResultStatus code, indicating if the operation succeeded. | ||
| 60 | */ | ||
| 61 | ResultStatus Init(EmuWindow* emu_window, u32 system_mode); | ||
| 62 | |||
| 63 | /// Start the core | ||
| 64 | void Start(); | ||
| 65 | |||
| 66 | /** | ||
| 67 | * Run the core CPU loop | 56 | * Run the core CPU loop |
| 68 | * This function runs the core for the specified number of CPU instructions before trying to update | 57 | * This function runs the core for the specified number of CPU instructions before trying to update |
| 69 | * hardware. This is much faster than SingleStep (and should be equivalent), as the CPU is not | 58 | * hardware. This is much faster than SingleStep (and should be equivalent), as the CPU is not |
| @@ -101,6 +90,9 @@ public: | |||
| 101 | return app_core != nullptr; | 90 | return app_core != nullptr; |
| 102 | } | 91 | } |
| 103 | 92 | ||
| 93 | /// Prepare the core emulation for a reschedule | ||
| 94 | void PrepareReschedule(); | ||
| 95 | |||
| 104 | /** | 96 | /** |
| 105 | * Gets a reference to the emulated AppCore CPU. | 97 | * Gets a reference to the emulated AppCore CPU. |
| 106 | * @returns A reference to the emulated AppCore CPU. | 98 | * @returns A reference to the emulated AppCore CPU. |
| @@ -110,12 +102,26 @@ public: | |||
| 110 | } | 102 | } |
| 111 | 103 | ||
| 112 | private: | 104 | private: |
| 105 | /** | ||
| 106 | * Initialize the emulated system. | ||
| 107 | * @param emu_window Pointer to the host-system window used for video output and keyboard input. | ||
| 108 | * @param system_mode The system mode. | ||
| 109 | * @return ResultStatus code, indicating if the operation succeeded. | ||
| 110 | */ | ||
| 111 | ResultStatus Init(EmuWindow* emu_window, u32 system_mode); | ||
| 112 | |||
| 113 | /// Reschedule the core emulation | ||
| 114 | void Reschedule(); | ||
| 115 | |||
| 113 | /// AppLoader used to load the current executing application | 116 | /// AppLoader used to load the current executing application |
| 114 | std::unique_ptr<Loader::AppLoader> app_loader; | 117 | std::unique_ptr<Loader::AppLoader> app_loader; |
| 115 | 118 | ||
| 116 | ///< ARM11 application core | 119 | ///< ARM11 application core |
| 117 | std::unique_ptr<ARM_Interface> app_core; | 120 | std::unique_ptr<ARM_Interface> app_core; |
| 118 | 121 | ||
| 122 | /// When true, signals that a reschedule should happen | ||
| 123 | bool reschedule_pending{}; | ||
| 124 | |||
| 119 | static System s_instance; | 125 | static System s_instance; |
| 120 | }; | 126 | }; |
| 121 | 127 | ||
diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp index 5b172df4a..b9fc77e34 100644 --- a/src/core/file_sys/archive_extsavedata.cpp +++ b/src/core/file_sys/archive_extsavedata.cpp | |||
| @@ -142,10 +142,10 @@ std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path) | |||
| 142 | std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) { | 142 | std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) { |
| 143 | if (shared) | 143 | if (shared) |
| 144 | return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), | 144 | return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), |
| 145 | SYSTEM_ID.c_str()); | 145 | SYSTEM_ID); |
| 146 | 146 | ||
| 147 | return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(), | 147 | return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(), |
| 148 | SYSTEM_ID.c_str(), SDCARD_ID.c_str()); | 148 | SYSTEM_ID, SDCARD_ID); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) { | 151 | Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) { |
diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index 6f1aadfc3..89455e39c 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | namespace FileSys { | 19 | namespace FileSys { |
| 20 | 20 | ||
| 21 | static std::string GetNCCHContainerPath(const std::string& nand_directory) { | 21 | static std::string GetNCCHContainerPath(const std::string& nand_directory) { |
| 22 | return Common::StringFromFormat("%s%s/title/", nand_directory.c_str(), SYSTEM_ID.c_str()); | 22 | return Common::StringFromFormat("%s%s/title/", nand_directory.c_str(), SYSTEM_ID); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | static std::string GetNCCHPath(const std::string& mount_point, u32 high, u32 low) { | 25 | static std::string GetNCCHPath(const std::string& mount_point, u32 high, u32 low) { |
diff --git a/src/core/file_sys/archive_source_sd_savedata.cpp b/src/core/file_sys/archive_source_sd_savedata.cpp index 287322d3e..e01357891 100644 --- a/src/core/file_sys/archive_source_sd_savedata.cpp +++ b/src/core/file_sys/archive_source_sd_savedata.cpp | |||
| @@ -18,7 +18,7 @@ namespace { | |||
| 18 | 18 | ||
| 19 | std::string GetSaveDataContainerPath(const std::string& sdmc_directory) { | 19 | std::string GetSaveDataContainerPath(const std::string& sdmc_directory) { |
| 20 | return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(), | 20 | return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(), |
| 21 | SYSTEM_ID.c_str(), SDCARD_ID.c_str()); | 21 | SYSTEM_ID, SDCARD_ID); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) { | 24 | std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) { |
diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index 54e7793e0..8986b5c0e 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp | |||
| @@ -26,7 +26,7 @@ std::string GetSystemSaveDataPath(const std::string& mount_point, const Path& pa | |||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | std::string GetSystemSaveDataContainerPath(const std::string& mount_point) { | 28 | std::string GetSystemSaveDataContainerPath(const std::string& mount_point) { |
| 29 | return Common::StringFromFormat("%sdata/%s/sysdata/", mount_point.c_str(), SYSTEM_ID.c_str()); | 29 | return Common::StringFromFormat("%sdata/%s/sysdata/", mount_point.c_str(), SYSTEM_ID); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) { | 32 | Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) { |
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 0f2a04e30..cafc7fe62 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/arm/arm_interface.h" | 8 | #include "core/arm/arm_interface.h" |
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/hle/hle.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 11 | #include "core/hle/result.h" | 11 | #include "core/hle/result.h" |
| 12 | #include "core/hle/svc.h" | 12 | #include "core/hle/svc.h" |
| 13 | #include "core/memory.h" | 13 | #include "core/memory.h" |
| @@ -64,7 +64,7 @@ void Wrap() { | |||
| 64 | template <ResultCode func(s32*, u32*, s32, bool, s64)> | 64 | template <ResultCode func(s32*, u32*, s32, bool, s64)> |
| 65 | void Wrap() { | 65 | void Wrap() { |
| 66 | s32 param_1 = 0; | 66 | s32 param_1 = 0; |
| 67 | s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), | 67 | s32 retval = func(¶m_1, (Kernel::Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), |
| 68 | (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))) | 68 | (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))) |
| 69 | .raw; | 69 | .raw; |
| 70 | 70 | ||
| @@ -110,7 +110,7 @@ void Wrap() { | |||
| 110 | FuncReturn(retval); | 110 | FuncReturn(retval); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | template <ResultCode func(MemoryInfo*, PageInfo*, Handle, u32)> | 113 | template <ResultCode func(MemoryInfo*, PageInfo*, Kernel::Handle, u32)> |
| 114 | void Wrap() { | 114 | void Wrap() { |
| 115 | MemoryInfo memory_info = {}; | 115 | MemoryInfo memory_info = {}; |
| 116 | PageInfo page_info = {}; | 116 | PageInfo page_info = {}; |
| @@ -205,7 +205,7 @@ void Wrap() { | |||
| 205 | FuncReturn(func(PARAM(0), param1, param2).raw); | 205 | FuncReturn(func(PARAM(0), param1, param2).raw); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | template <ResultCode func(s64*, Handle, u32)> | 208 | template <ResultCode func(s64*, Kernel::Handle, u32)> |
| 209 | void Wrap() { | 209 | void Wrap() { |
| 210 | s64 param_1 = 0; | 210 | s64 param_1 = 0; |
| 211 | u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw; | 211 | u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw; |
| @@ -214,15 +214,15 @@ void Wrap() { | |||
| 214 | FuncReturn(retval); | 214 | FuncReturn(retval); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | template <ResultCode func(Handle, u32)> | 217 | template <ResultCode func(Kernel::Handle, u32)> |
| 218 | void Wrap() { | 218 | void Wrap() { |
| 219 | FuncReturn(func(PARAM(0), PARAM(1)).raw); | 219 | FuncReturn(func(PARAM(0), PARAM(1)).raw); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | template <ResultCode func(Handle*, Handle*, const char*, u32)> | 222 | template <ResultCode func(Kernel::Handle*, Kernel::Handle*, const char*, u32)> |
| 223 | void Wrap() { | 223 | void Wrap() { |
| 224 | Handle param_1 = 0; | 224 | Kernel::Handle param_1 = 0; |
| 225 | Handle param_2 = 0; | 225 | Kernel::Handle param_2 = 0; |
| 226 | u32 retval = func(¶m_1, ¶m_2, | 226 | u32 retval = func(¶m_1, ¶m_2, |
| 227 | reinterpret_cast<const char*>(Memory::GetPointer(PARAM(2))), PARAM(3)) | 227 | reinterpret_cast<const char*>(Memory::GetPointer(PARAM(2))), PARAM(3)) |
| 228 | .raw; | 228 | .raw; |
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h deleted file mode 100644 index 23859e129..000000000 --- a/src/core/hle/hle.h +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | typedef u32 Handle; | ||
| 10 | typedef s32 Result; | ||
| 11 | |||
| 12 | const Handle INVALID_HANDLE = 0; | ||
| 13 | |||
| 14 | namespace HLE { | ||
| 15 | |||
| 16 | void Reschedule(const char* reason); | ||
| 17 | bool IsReschedulePending(); | ||
| 18 | void DoneRescheduling(); | ||
| 19 | |||
| 20 | void Init(); | ||
| 21 | void Shutdown(); | ||
| 22 | |||
| 23 | } // namespace | ||
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index b5a0cc3a3..01fab123e 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/common_types.h" | 5 | #include "common/common_types.h" |
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | #include "core/hle/hle.h" | ||
| 8 | #include "core/hle/kernel/address_arbiter.h" | 7 | #include "core/hle/kernel/address_arbiter.h" |
| 9 | #include "core/hle/kernel/thread.h" | 8 | #include "core/hle/kernel/thread.h" |
| 10 | #include "core/memory.h" | 9 | #include "core/memory.h" |
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 1adcf6c71..9503e7d04 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -11,11 +11,12 @@ | |||
| 11 | #include <vector> | 11 | #include <vector> |
| 12 | #include <boost/smart_ptr/intrusive_ptr.hpp> | 12 | #include <boost/smart_ptr/intrusive_ptr.hpp> |
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 14 | #include "core/hle/hle.h" | ||
| 15 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 16 | 15 | ||
| 17 | namespace Kernel { | 16 | namespace Kernel { |
| 18 | 17 | ||
| 18 | using Handle = u32; | ||
| 19 | |||
| 19 | class Thread; | 20 | class Thread; |
| 20 | 21 | ||
| 21 | // TODO: Verify code | 22 | // TODO: Verify code |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 91c05fc42..c964b35d4 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include "core/arm/skyeye_common/armstate.h" | 14 | #include "core/arm/skyeye_common/armstate.h" |
| 15 | #include "core/core.h" | 15 | #include "core/core.h" |
| 16 | #include "core/core_timing.h" | 16 | #include "core/core_timing.h" |
| 17 | #include "core/hle/hle.h" | ||
| 18 | #include "core/hle/kernel/kernel.h" | 17 | #include "core/hle/kernel/kernel.h" |
| 19 | #include "core/hle/kernel/memory.h" | 18 | #include "core/hle/kernel/memory.h" |
| 20 | #include "core/hle/kernel/mutex.h" | 19 | #include "core/hle/kernel/mutex.h" |
| @@ -330,7 +329,7 @@ void Thread::ResumeFromWait() { | |||
| 330 | 329 | ||
| 331 | ready_queue.push_back(current_priority, this); | 330 | ready_queue.push_back(current_priority, this); |
| 332 | status = THREADSTATUS_READY; | 331 | status = THREADSTATUS_READY; |
| 333 | HLE::Reschedule(__func__); | 332 | Core::System::GetInstance().PrepareReschedule(); |
| 334 | } | 333 | } |
| 335 | 334 | ||
| 336 | /** | 335 | /** |
| @@ -545,8 +544,6 @@ void Reschedule() { | |||
| 545 | Thread* cur = GetCurrentThread(); | 544 | Thread* cur = GetCurrentThread(); |
| 546 | Thread* next = PopNextReadyThread(); | 545 | Thread* next = PopNextReadyThread(); |
| 547 | 546 | ||
| 548 | HLE::DoneRescheduling(); | ||
| 549 | |||
| 550 | if (cur && next) { | 547 | if (cur && next) { |
| 551 | LOG_TRACE(Kernel, "context switch %u -> %u", cur->GetObjectId(), next->GetObjectId()); | 548 | LOG_TRACE(Kernel, "context switch %u -> %u", cur->GetObjectId(), next->GetObjectId()); |
| 552 | } else if (cur) { | 549 | } else if (cur) { |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index d4fefc573..89acc12c1 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include <boost/container/flat_set.hpp> | 11 | #include <boost/container/flat_set.hpp> |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "core/core.h" | 13 | #include "core/core.h" |
| 14 | #include "core/hle/hle.h" | ||
| 15 | #include "core/hle/kernel/kernel.h" | 14 | #include "core/hle/kernel/kernel.h" |
| 16 | #include "core/hle/result.h" | 15 | #include "core/hle/result.h" |
| 17 | 16 | ||
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp index 6544e89a2..25392f3cf 100644 --- a/src/core/hle/service/csnd_snd.cpp +++ b/src/core/hle/service/csnd_snd.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include "common/alignment.h" | 6 | #include "common/alignment.h" |
| 7 | #include "core/hle/hle.h" | ||
| 8 | #include "core/hle/kernel/mutex.h" | 7 | #include "core/hle/kernel/mutex.h" |
| 9 | #include "core/hle/kernel/shared_memory.h" | 8 | #include "core/hle/kernel/shared_memory.h" |
| 10 | #include "core/hle/service/csnd_snd.h" | 9 | #include "core/hle/service/csnd_snd.h" |
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 09205e4b2..6cddc1fdb 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include "core/file_sys/archive_systemsavedata.h" | 23 | #include "core/file_sys/archive_systemsavedata.h" |
| 24 | #include "core/file_sys/directory_backend.h" | 24 | #include "core/file_sys/directory_backend.h" |
| 25 | #include "core/file_sys/file_backend.h" | 25 | #include "core/file_sys/file_backend.h" |
| 26 | #include "core/hle/hle.h" | ||
| 27 | #include "core/hle/kernel/client_session.h" | 26 | #include "core/hle/kernel/client_session.h" |
| 28 | #include "core/hle/result.h" | 27 | #include "core/hle/result.h" |
| 29 | #include "core/hle/service/fs/archive.h" | 28 | #include "core/hle/service/fs/archive.h" |
| @@ -46,9 +45,7 @@ struct hash<Service::FS::ArchiveIdCode> { | |||
| 46 | }; | 45 | }; |
| 47 | } | 46 | } |
| 48 | 47 | ||
| 49 | /// TODO(Subv): Confirm length of these strings | 48 | static constexpr Kernel::Handle INVALID_HANDLE{}; |
| 50 | const std::string SYSTEM_ID = "00000000000000000000000000000000"; | ||
| 51 | const std::string SDCARD_ID = "00000000000000000000000000000000"; | ||
| 52 | 49 | ||
| 53 | namespace Service { | 50 | namespace Service { |
| 54 | namespace FS { | 51 | namespace FS { |
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 7ba62ede0..0aa373f40 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h | |||
| @@ -17,9 +17,9 @@ class FileBackend; | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | /// The unique system identifier hash, also known as ID0 | 19 | /// The unique system identifier hash, also known as ID0 |
| 20 | extern const std::string SYSTEM_ID; | 20 | static constexpr char SYSTEM_ID[]{ "00000000000000000000000000000000" }; |
| 21 | /// The scrambled SD card CID, also known as ID1 | 21 | /// The scrambled SD card CID, also known as ID1 |
| 22 | extern const std::string SDCARD_ID; | 22 | static constexpr char SDCARD_ID[]{ "00000000000000000000000000000000" }; |
| 23 | 23 | ||
| 24 | namespace Service { | 24 | namespace Service { |
| 25 | namespace FS { | 25 | namespace FS { |
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp index 4d6639ded..7f1731a50 100644 --- a/src/core/hle/service/ir/ir.cpp +++ b/src/core/hle/service/ir/ir.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/kernel/event.h" | 5 | #include "core/hle/kernel/event.h" |
| 6 | #include "core/hle/kernel/kernel.h" | ||
| 6 | #include "core/hle/kernel/shared_memory.h" | 7 | #include "core/hle/kernel/shared_memory.h" |
| 7 | #include "core/hle/service/ir/ir.h" | 8 | #include "core/hle/service/ir/ir.h" |
| 8 | #include "core/hle/service/ir/ir_rst.h" | 9 | #include "core/hle/service/ir/ir_rst.h" |
| @@ -36,7 +37,7 @@ void InitializeIrNopShared(Interface* self) { | |||
| 36 | u32 send_buff_size = cmd_buff[4]; | 37 | u32 send_buff_size = cmd_buff[4]; |
| 37 | u32 unk2 = cmd_buff[5]; | 38 | u32 unk2 = cmd_buff[5]; |
| 38 | u8 baud_rate = cmd_buff[6] & 0xFF; | 39 | u8 baud_rate = cmd_buff[6] & 0xFF; |
| 39 | Handle handle = cmd_buff[8]; | 40 | Kernel::Handle handle = cmd_buff[8]; |
| 40 | 41 | ||
| 41 | if (Kernel::g_handle_table.IsValid(handle)) { | 42 | if (Kernel::g_handle_table.IsValid(handle)) { |
| 42 | transfer_shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(handle); | 43 | transfer_shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(handle); |
diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index 7ced36439..4f1dd2fce 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/hle/kernel/event.h" | 6 | #include "core/hle/kernel/event.h" |
| 7 | #include "core/hle/kernel/kernel.h" | ||
| 7 | #include "core/hle/kernel/shared_memory.h" | 8 | #include "core/hle/kernel/shared_memory.h" |
| 8 | #include "core/hle/service/mic_u.h" | 9 | #include "core/hle/service/mic_u.h" |
| 9 | 10 | ||
| @@ -50,7 +51,7 @@ static bool audio_buffer_loop; | |||
| 50 | static void MapSharedMem(Interface* self) { | 51 | static void MapSharedMem(Interface* self) { |
| 51 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 52 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 52 | u32 size = cmd_buff[1]; | 53 | u32 size = cmd_buff[1]; |
| 53 | Handle mem_handle = cmd_buff[3]; | 54 | Kernel::Handle mem_handle = cmd_buff[3]; |
| 54 | shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(mem_handle); | 55 | shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(mem_handle); |
| 55 | if (shared_memory) { | 56 | if (shared_memory) { |
| 56 | shared_memory->name = "MIC_U:shared_memory"; | 57 | shared_memory->name = "MIC_U:shared_memory"; |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index b20f2aaa4..5a52525c6 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -166,7 +166,7 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add | |||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /// Maps a memory block to specified address | 168 | /// Maps a memory block to specified address |
| 169 | static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { | 169 | static ResultCode MapMemoryBlock(Kernel::Handle handle, u32 addr, u32 permissions, u32 other_permissions) { |
| 170 | using Kernel::SharedMemory; | 170 | using Kernel::SharedMemory; |
| 171 | using Kernel::MemoryPermission; | 171 | using Kernel::MemoryPermission; |
| 172 | 172 | ||
| @@ -198,7 +198,7 @@ static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 o | |||
| 198 | ErrorSummary::InvalidArgument, ErrorLevel::Usage); | 198 | ErrorSummary::InvalidArgument, ErrorLevel::Usage); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) { | 201 | static ResultCode UnmapMemoryBlock(Kernel::Handle handle, u32 addr) { |
| 202 | using Kernel::SharedMemory; | 202 | using Kernel::SharedMemory; |
| 203 | 203 | ||
| 204 | LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X", handle, addr); | 204 | LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X", handle, addr); |
| @@ -213,7 +213,7 @@ static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) { | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | /// Connect to an OS service given the port name, returns the handle to the port to out | 215 | /// Connect to an OS service given the port name, returns the handle to the port to out |
| 216 | static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { | 216 | static ResultCode ConnectToPort(Kernel::Handle* out_handle, const char* port_name) { |
| 217 | if (port_name == nullptr) | 217 | if (port_name == nullptr) |
| 218 | return ERR_NOT_FOUND; | 218 | return ERR_NOT_FOUND; |
| 219 | if (std::strlen(port_name) > 11) | 219 | if (std::strlen(port_name) > 11) |
| @@ -238,7 +238,7 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { | |||
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | /// Makes a blocking IPC call to an OS service. | 240 | /// Makes a blocking IPC call to an OS service. |
| 241 | static ResultCode SendSyncRequest(Handle handle) { | 241 | static ResultCode SendSyncRequest(Kernel::Handle handle) { |
| 242 | SharedPtr<Kernel::ClientSession> session = | 242 | SharedPtr<Kernel::ClientSession> session = |
| 243 | Kernel::g_handle_table.Get<Kernel::ClientSession>(handle); | 243 | Kernel::g_handle_table.Get<Kernel::ClientSession>(handle); |
| 244 | if (session == nullptr) { | 244 | if (session == nullptr) { |
| @@ -253,13 +253,13 @@ static ResultCode SendSyncRequest(Handle handle) { | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /// Close a handle | 255 | /// Close a handle |
| 256 | static ResultCode CloseHandle(Handle handle) { | 256 | static ResultCode CloseHandle(Kernel::Handle handle) { |
| 257 | LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle); | 257 | LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle); |
| 258 | return Kernel::g_handle_table.Close(handle); | 258 | return Kernel::g_handle_table.Close(handle); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | /// Wait for a handle to synchronize, timeout after the specified nanoseconds | 261 | /// Wait for a handle to synchronize, timeout after the specified nanoseconds |
| 262 | static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) { | 262 | static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds) { |
| 263 | auto object = Kernel::g_handle_table.GetWaitObject(handle); | 263 | auto object = Kernel::g_handle_table.GetWaitObject(handle); |
| 264 | Kernel::Thread* thread = Kernel::GetCurrentThread(); | 264 | Kernel::Thread* thread = Kernel::GetCurrentThread(); |
| 265 | 265 | ||
| @@ -295,7 +295,7 @@ static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) { | |||
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | 297 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds |
| 298 | static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, | 298 | static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 handle_count, bool wait_all, |
| 299 | s64 nano_seconds) { | 299 | s64 nano_seconds) { |
| 300 | Kernel::Thread* thread = Kernel::GetCurrentThread(); | 300 | Kernel::Thread* thread = Kernel::GetCurrentThread(); |
| 301 | 301 | ||
| @@ -423,7 +423,7 @@ static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_cou | |||
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | /// Create an address arbiter (to allocate access to shared resources) | 425 | /// Create an address arbiter (to allocate access to shared resources) |
| 426 | static ResultCode CreateAddressArbiter(Handle* out_handle) { | 426 | static ResultCode CreateAddressArbiter(Kernel::Handle* out_handle) { |
| 427 | using Kernel::AddressArbiter; | 427 | using Kernel::AddressArbiter; |
| 428 | 428 | ||
| 429 | SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create(); | 429 | SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create(); |
| @@ -433,7 +433,7 @@ static ResultCode CreateAddressArbiter(Handle* out_handle) { | |||
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | /// Arbitrate address | 435 | /// Arbitrate address |
| 436 | static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, | 436 | static ResultCode ArbitrateAddress(Kernel::Handle handle, u32 address, u32 type, u32 value, |
| 437 | s64 nanoseconds) { | 437 | s64 nanoseconds) { |
| 438 | using Kernel::AddressArbiter; | 438 | using Kernel::AddressArbiter; |
| 439 | 439 | ||
| @@ -476,7 +476,7 @@ static void OutputDebugString(const char* string) { | |||
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | /// Get resource limit | 478 | /// Get resource limit |
| 479 | static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle) { | 479 | static ResultCode GetResourceLimit(Kernel::Handle* resource_limit, Kernel::Handle process_handle) { |
| 480 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); | 480 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); |
| 481 | 481 | ||
| 482 | SharedPtr<Kernel::Process> process = | 482 | SharedPtr<Kernel::Process> process = |
| @@ -490,7 +490,7 @@ static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle | |||
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | /// Get resource limit current values | 492 | /// Get resource limit current values |
| 493 | static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_limit_handle, | 493 | static ResultCode GetResourceLimitCurrentValues(s64* values, Kernel::Handle resource_limit_handle, |
| 494 | u32* names, u32 name_count) { | 494 | u32* names, u32 name_count) { |
| 495 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", | 495 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", |
| 496 | resource_limit_handle, names, name_count); | 496 | resource_limit_handle, names, name_count); |
| @@ -507,7 +507,7 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_lim | |||
| 507 | } | 507 | } |
| 508 | 508 | ||
| 509 | /// Get resource limit max values | 509 | /// Get resource limit max values |
| 510 | static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit_handle, u32* names, | 510 | static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resource_limit_handle, u32* names, |
| 511 | u32 name_count) { | 511 | u32 name_count) { |
| 512 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", | 512 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", |
| 513 | resource_limit_handle, names, name_count); | 513 | resource_limit_handle, names, name_count); |
| @@ -524,7 +524,7 @@ static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit | |||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | /// Creates a new thread | 526 | /// Creates a new thread |
| 527 | static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point, u32 arg, | 527 | static ResultCode CreateThread(Kernel::Handle* out_handle, s32 priority, u32 entry_point, u32 arg, |
| 528 | u32 stack_top, s32 processor_id) { | 528 | u32 stack_top, s32 processor_id) { |
| 529 | using Kernel::Thread; | 529 | using Kernel::Thread; |
| 530 | 530 | ||
| @@ -588,7 +588,7 @@ static void ExitThread() { | |||
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | /// Gets the priority for the specified thread | 590 | /// Gets the priority for the specified thread |
| 591 | static ResultCode GetThreadPriority(s32* priority, Handle handle) { | 591 | static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) { |
| 592 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 592 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); |
| 593 | if (thread == nullptr) | 593 | if (thread == nullptr) |
| 594 | return ERR_INVALID_HANDLE; | 594 | return ERR_INVALID_HANDLE; |
| @@ -598,7 +598,7 @@ static ResultCode GetThreadPriority(s32* priority, Handle handle) { | |||
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | /// Sets the priority for the specified thread | 600 | /// Sets the priority for the specified thread |
| 601 | static ResultCode SetThreadPriority(Handle handle, s32 priority) { | 601 | static ResultCode SetThreadPriority(Kernel::Handle handle, s32 priority) { |
| 602 | SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 602 | SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); |
| 603 | if (thread == nullptr) | 603 | if (thread == nullptr) |
| 604 | return ERR_INVALID_HANDLE; | 604 | return ERR_INVALID_HANDLE; |
| @@ -608,7 +608,7 @@ static ResultCode SetThreadPriority(Handle handle, s32 priority) { | |||
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | /// Create a mutex | 610 | /// Create a mutex |
| 611 | static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { | 611 | static ResultCode CreateMutex(Kernel::Handle* out_handle, u32 initial_locked) { |
| 612 | using Kernel::Mutex; | 612 | using Kernel::Mutex; |
| 613 | 613 | ||
| 614 | SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0); | 614 | SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0); |
| @@ -622,7 +622,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { | |||
| 622 | } | 622 | } |
| 623 | 623 | ||
| 624 | /// Release a mutex | 624 | /// Release a mutex |
| 625 | static ResultCode ReleaseMutex(Handle handle) { | 625 | static ResultCode ReleaseMutex(Kernel::Handle handle) { |
| 626 | using Kernel::Mutex; | 626 | using Kernel::Mutex; |
| 627 | 627 | ||
| 628 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle); | 628 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle); |
| @@ -637,7 +637,7 @@ static ResultCode ReleaseMutex(Handle handle) { | |||
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | /// Get the ID of the specified process | 639 | /// Get the ID of the specified process |
| 640 | static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | 640 | static ResultCode GetProcessId(u32* process_id, Kernel::Handle process_handle) { |
| 641 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); | 641 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); |
| 642 | 642 | ||
| 643 | const SharedPtr<Kernel::Process> process = | 643 | const SharedPtr<Kernel::Process> process = |
| @@ -650,7 +650,7 @@ static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | |||
| 650 | } | 650 | } |
| 651 | 651 | ||
| 652 | /// Get the ID of the process that owns the specified thread | 652 | /// Get the ID of the process that owns the specified thread |
| 653 | static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) { | 653 | static ResultCode GetProcessIdOfThread(u32* process_id, Kernel::Handle thread_handle) { |
| 654 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); | 654 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); |
| 655 | 655 | ||
| 656 | const SharedPtr<Kernel::Thread> thread = | 656 | const SharedPtr<Kernel::Thread> thread = |
| @@ -667,7 +667,7 @@ static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) { | |||
| 667 | } | 667 | } |
| 668 | 668 | ||
| 669 | /// Get the ID for the specified thread. | 669 | /// Get the ID for the specified thread. |
| 670 | static ResultCode GetThreadId(u32* thread_id, Handle handle) { | 670 | static ResultCode GetThreadId(u32* thread_id, Kernel::Handle handle) { |
| 671 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); | 671 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); |
| 672 | 672 | ||
| 673 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 673 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); |
| @@ -679,7 +679,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle handle) { | |||
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | /// Creates a semaphore | 681 | /// Creates a semaphore |
| 682 | static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) { | 682 | static ResultCode CreateSemaphore(Kernel::Handle* out_handle, s32 initial_count, s32 max_count) { |
| 683 | using Kernel::Semaphore; | 683 | using Kernel::Semaphore; |
| 684 | 684 | ||
| 685 | CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count)); | 685 | CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count)); |
| @@ -692,7 +692,7 @@ static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max | |||
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | /// Releases a certain number of slots in a semaphore | 694 | /// Releases a certain number of slots in a semaphore |
| 695 | static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) { | 695 | static ResultCode ReleaseSemaphore(s32* count, Kernel::Handle handle, s32 release_count) { |
| 696 | using Kernel::Semaphore; | 696 | using Kernel::Semaphore; |
| 697 | 697 | ||
| 698 | LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, handle); | 698 | LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, handle); |
| @@ -708,7 +708,7 @@ static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) | |||
| 708 | 708 | ||
| 709 | /// Query process memory | 709 | /// Query process memory |
| 710 | static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, | 710 | static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, |
| 711 | Handle process_handle, u32 addr) { | 711 | Kernel::Handle process_handle, u32 addr) { |
| 712 | using Kernel::Process; | 712 | using Kernel::Process; |
| 713 | Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle); | 713 | Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle); |
| 714 | if (process == nullptr) | 714 | if (process == nullptr) |
| @@ -736,7 +736,7 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 | |||
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | /// Create an event | 738 | /// Create an event |
| 739 | static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { | 739 | static ResultCode CreateEvent(Kernel::Handle* out_handle, u32 reset_type) { |
| 740 | using Kernel::Event; | 740 | using Kernel::Event; |
| 741 | 741 | ||
| 742 | SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type)); | 742 | SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type)); |
| @@ -749,14 +749,14 @@ static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { | |||
| 749 | } | 749 | } |
| 750 | 750 | ||
| 751 | /// Duplicates a kernel handle | 751 | /// Duplicates a kernel handle |
| 752 | static ResultCode DuplicateHandle(Handle* out, Handle handle) { | 752 | static ResultCode DuplicateHandle(Kernel::Handle* out, Kernel::Handle handle) { |
| 753 | CASCADE_RESULT(*out, Kernel::g_handle_table.Duplicate(handle)); | 753 | CASCADE_RESULT(*out, Kernel::g_handle_table.Duplicate(handle)); |
| 754 | LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out); | 754 | LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out); |
| 755 | return RESULT_SUCCESS; | 755 | return RESULT_SUCCESS; |
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | /// Signals an event | 758 | /// Signals an event |
| 759 | static ResultCode SignalEvent(Handle handle) { | 759 | static ResultCode SignalEvent(Kernel::Handle handle) { |
| 760 | using Kernel::Event; | 760 | using Kernel::Event; |
| 761 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); | 761 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); |
| 762 | 762 | ||
| @@ -770,7 +770,7 @@ static ResultCode SignalEvent(Handle handle) { | |||
| 770 | } | 770 | } |
| 771 | 771 | ||
| 772 | /// Clears an event | 772 | /// Clears an event |
| 773 | static ResultCode ClearEvent(Handle handle) { | 773 | static ResultCode ClearEvent(Kernel::Handle handle) { |
| 774 | using Kernel::Event; | 774 | using Kernel::Event; |
| 775 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); | 775 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); |
| 776 | 776 | ||
| @@ -783,7 +783,7 @@ static ResultCode ClearEvent(Handle handle) { | |||
| 783 | } | 783 | } |
| 784 | 784 | ||
| 785 | /// Creates a timer | 785 | /// Creates a timer |
| 786 | static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { | 786 | static ResultCode CreateTimer(Kernel::Handle* out_handle, u32 reset_type) { |
| 787 | using Kernel::Timer; | 787 | using Kernel::Timer; |
| 788 | 788 | ||
| 789 | SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type)); | 789 | SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type)); |
| @@ -796,7 +796,7 @@ static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { | |||
| 796 | } | 796 | } |
| 797 | 797 | ||
| 798 | /// Clears a timer | 798 | /// Clears a timer |
| 799 | static ResultCode ClearTimer(Handle handle) { | 799 | static ResultCode ClearTimer(Kernel::Handle handle) { |
| 800 | using Kernel::Timer; | 800 | using Kernel::Timer; |
| 801 | 801 | ||
| 802 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); | 802 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); |
| @@ -810,7 +810,7 @@ static ResultCode ClearTimer(Handle handle) { | |||
| 810 | } | 810 | } |
| 811 | 811 | ||
| 812 | /// Starts a timer | 812 | /// Starts a timer |
| 813 | static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) { | 813 | static ResultCode SetTimer(Kernel::Handle handle, s64 initial, s64 interval) { |
| 814 | using Kernel::Timer; | 814 | using Kernel::Timer; |
| 815 | 815 | ||
| 816 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); | 816 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); |
| @@ -825,7 +825,7 @@ static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) { | |||
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | /// Cancels a timer | 827 | /// Cancels a timer |
| 828 | static ResultCode CancelTimer(Handle handle) { | 828 | static ResultCode CancelTimer(Kernel::Handle handle) { |
| 829 | using Kernel::Timer; | 829 | using Kernel::Timer; |
| 830 | 830 | ||
| 831 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); | 831 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); |
| @@ -860,7 +860,7 @@ static s64 GetSystemTick() { | |||
| 860 | } | 860 | } |
| 861 | 861 | ||
| 862 | /// Creates a memory block at the specified address with the specified permissions and size | 862 | /// Creates a memory block at the specified address with the specified permissions and size |
| 863 | static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission, | 863 | static ResultCode CreateMemoryBlock(Kernel::Handle* out_handle, u32 addr, u32 size, u32 my_permission, |
| 864 | u32 other_permission) { | 864 | u32 other_permission) { |
| 865 | using Kernel::SharedMemory; | 865 | using Kernel::SharedMemory; |
| 866 | 866 | ||
| @@ -912,7 +912,7 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 | |||
| 912 | return RESULT_SUCCESS; | 912 | return RESULT_SUCCESS; |
| 913 | } | 913 | } |
| 914 | 914 | ||
| 915 | static ResultCode CreatePort(Handle* server_port, Handle* client_port, const char* name, | 915 | static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client_port, const char* name, |
| 916 | u32 max_sessions) { | 916 | u32 max_sessions) { |
| 917 | // TODO(Subv): Implement named ports. | 917 | // TODO(Subv): Implement named ports. |
| 918 | ASSERT_MSG(name == nullptr, "Named ports are currently unimplemented"); | 918 | ASSERT_MSG(name == nullptr, "Named ports are currently unimplemented"); |
| @@ -978,7 +978,7 @@ static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) { | |||
| 978 | return RESULT_SUCCESS; | 978 | return RESULT_SUCCESS; |
| 979 | } | 979 | } |
| 980 | 980 | ||
| 981 | static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) { | 981 | static ResultCode GetProcessInfo(s64* out, Kernel::Handle process_handle, u32 type) { |
| 982 | LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type); | 982 | LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type); |
| 983 | 983 | ||
| 984 | using Kernel::Process; | 984 | using Kernel::Process; |
| @@ -1185,7 +1185,7 @@ void CallSVC(u32 immediate) { | |||
| 1185 | if (info->func) { | 1185 | if (info->func) { |
| 1186 | info->func(); | 1186 | info->func(); |
| 1187 | // TODO(Subv): Not all service functions should cause a reschedule in all cases. | 1187 | // TODO(Subv): Not all service functions should cause a reschedule in all cases. |
| 1188 | HLE::Reschedule(__func__); | 1188 | Core::System::GetInstance().PrepareReschedule(); |
| 1189 | } else { | 1189 | } else { |
| 1190 | LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name); | 1190 | LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name); |
| 1191 | } | 1191 | } |