diff options
| -rw-r--r-- | src/common/logging/backend.cpp | 3 | ||||
| -rw-r--r-- | src/common/logging/log.h | 1 | ||||
| -rw-r--r-- | src/core/gdbstub/gdbstub.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/ipc.h | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/domain.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/interface.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/interface.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 2 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 4 |
12 files changed, 71 insertions, 13 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 13f915a01..ba0acfb72 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -43,6 +43,7 @@ namespace Log { | |||
| 43 | SUB(HW, LCD) \ | 43 | SUB(HW, LCD) \ |
| 44 | SUB(HW, GPU) \ | 44 | SUB(HW, GPU) \ |
| 45 | SUB(HW, AES) \ | 45 | SUB(HW, AES) \ |
| 46 | CLS(IPC) \ | ||
| 46 | CLS(Frontend) \ | 47 | CLS(Frontend) \ |
| 47 | CLS(Render) \ | 48 | CLS(Render) \ |
| 48 | SUB(Render, Software) \ | 49 | SUB(Render, Software) \ |
| @@ -91,8 +92,8 @@ const char* GetLevelName(Level log_level) { | |||
| 91 | 92 | ||
| 92 | Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr, | 93 | Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr, |
| 93 | const char* function, const char* format, va_list args) { | 94 | const char* function, const char* format, va_list args) { |
| 94 | using std::chrono::steady_clock; | ||
| 95 | using std::chrono::duration_cast; | 95 | using std::chrono::duration_cast; |
| 96 | using std::chrono::steady_clock; | ||
| 96 | 97 | ||
| 97 | static steady_clock::time_point time_origin = steady_clock::now(); | 98 | static steady_clock::time_point time_origin = steady_clock::now(); |
| 98 | 99 | ||
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 35b5af3cb..57021037a 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -60,6 +60,7 @@ enum class Class : ClassType { | |||
| 60 | HW_LCD, ///< LCD register emulation | 60 | HW_LCD, ///< LCD register emulation |
| 61 | HW_GPU, ///< GPU control emulation | 61 | HW_GPU, ///< GPU control emulation |
| 62 | HW_AES, ///< AES engine emulation | 62 | HW_AES, ///< AES engine emulation |
| 63 | IPC, ///< IPC interface | ||
| 63 | Frontend, ///< Emulator UI | 64 | Frontend, ///< Emulator UI |
| 64 | Render, ///< Emulator video output and hardware acceleration | 65 | Render, ///< Emulator video output and hardware acceleration |
| 65 | Render_Software, ///< Software renderer backend | 66 | Render_Software, ///< Software renderer backend |
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index dedbd4bdf..05c872d89 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp | |||
| @@ -905,7 +905,7 @@ void ToggleServer(bool status) { | |||
| 905 | server_enabled = status; | 905 | server_enabled = status; |
| 906 | 906 | ||
| 907 | // Start server | 907 | // Start server |
| 908 | if (!IsConnected() && Core::System().GetInstance().IsPoweredOn()) { | 908 | if (!IsConnected() && Core::System::GetInstance().IsPoweredOn()) { |
| 909 | Init(); | 909 | Init(); |
| 910 | } | 910 | } |
| 911 | } else { | 911 | } else { |
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h index 88ba105e5..1840fac12 100644 --- a/src/core/hle/ipc.h +++ b/src/core/hle/ipc.h | |||
| @@ -143,6 +143,11 @@ struct DataPayloadHeader { | |||
| 143 | static_assert(sizeof(DataPayloadHeader) == 8, "DataPayloadRequest size is incorrect"); | 143 | static_assert(sizeof(DataPayloadHeader) == 8, "DataPayloadRequest size is incorrect"); |
| 144 | 144 | ||
| 145 | struct DomainMessageHeader { | 145 | struct DomainMessageHeader { |
| 146 | enum class CommandType : u32_le { | ||
| 147 | SendMessage = 1, | ||
| 148 | CloseVirtualHandle = 2, | ||
| 149 | }; | ||
| 150 | |||
| 146 | union { | 151 | union { |
| 147 | // Used when responding to an IPC request, Server -> Client. | 152 | // Used when responding to an IPC request, Server -> Client. |
| 148 | struct { | 153 | struct { |
| @@ -153,7 +158,7 @@ struct DomainMessageHeader { | |||
| 153 | // Used when performing an IPC request, Client -> Server. | 158 | // Used when performing an IPC request, Client -> Server. |
| 154 | struct { | 159 | struct { |
| 155 | union { | 160 | union { |
| 156 | BitField<0, 8, u32_le> command; | 161 | BitField<0, 8, CommandType> command; |
| 157 | BitField<16, 16, u32_le> size; | 162 | BitField<16, 16, u32_le> size; |
| 158 | }; | 163 | }; |
| 159 | u32_le object_id; | 164 | u32_le object_id; |
diff --git a/src/core/hle/kernel/domain.cpp b/src/core/hle/kernel/domain.cpp index 7ebb4b9c7..5035e9c08 100644 --- a/src/core/hle/kernel/domain.cpp +++ b/src/core/hle/kernel/domain.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/hle/ipc_helpers.h" | ||
| 5 | #include "core/hle/kernel/client_port.h" | 7 | #include "core/hle/kernel/client_port.h" |
| 6 | #include "core/hle/kernel/domain.h" | 8 | #include "core/hle/kernel/domain.h" |
| 7 | #include "core/hle/kernel/handle_table.h" | 9 | #include "core/hle/kernel/handle_table.h" |
| @@ -36,7 +38,24 @@ ResultCode Domain::SendSyncRequest(SharedPtr<Thread> thread) { | |||
| 36 | if (domain_message_header) { | 38 | if (domain_message_header) { |
| 37 | // If there is a DomainMessageHeader, then this is CommandType "Request" | 39 | // If there is a DomainMessageHeader, then this is CommandType "Request" |
| 38 | const u32 object_id{context.GetDomainMessageHeader()->object_id}; | 40 | const u32 object_id{context.GetDomainMessageHeader()->object_id}; |
| 39 | return request_handlers[object_id - 1]->HandleSyncRequest(context); | 41 | switch (domain_message_header->command) { |
| 42 | case IPC::DomainMessageHeader::CommandType::SendMessage: | ||
| 43 | return request_handlers[object_id - 1]->HandleSyncRequest(context); | ||
| 44 | |||
| 45 | case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { | ||
| 46 | LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x%08X", object_id); | ||
| 47 | |||
| 48 | request_handlers[object_id - 1] = nullptr; | ||
| 49 | |||
| 50 | IPC::RequestBuilder rb{context, 2}; | ||
| 51 | rb.Push(RESULT_SUCCESS); | ||
| 52 | |||
| 53 | return RESULT_SUCCESS; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | LOG_CRITICAL(IPC, "Unknown domain command=%d", domain_message_header->command.Value()); | ||
| 58 | UNIMPLEMENTED(); | ||
| 40 | } | 59 | } |
| 41 | return request_handlers.front()->HandleSyncRequest(context); | 60 | return request_handlers.front()->HandleSyncRequest(context); |
| 42 | } | 61 | } |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index afa09b404..ac62a0d5a 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -102,13 +102,21 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) { | |||
| 102 | data_payload_header = | 102 | data_payload_header = |
| 103 | std::make_unique<IPC::DataPayloadHeader>(rp.PopRaw<IPC::DataPayloadHeader>()); | 103 | std::make_unique<IPC::DataPayloadHeader>(rp.PopRaw<IPC::DataPayloadHeader>()); |
| 104 | 104 | ||
| 105 | data_payload_offset = rp.GetCurrentOffset(); | ||
| 106 | |||
| 107 | if (domain_message_header && | ||
| 108 | domain_message_header->command == | ||
| 109 | IPC::DomainMessageHeader::CommandType::CloseVirtualHandle) { | ||
| 110 | // CloseVirtualHandle command does not have SFC* or any data | ||
| 111 | return; | ||
| 112 | } | ||
| 113 | |||
| 105 | if (incoming) { | 114 | if (incoming) { |
| 106 | ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'I')); | 115 | ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'I')); |
| 107 | } else { | 116 | } else { |
| 108 | ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O')); | 117 | ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O')); |
| 109 | } | 118 | } |
| 110 | 119 | ||
| 111 | data_payload_offset = rp.GetCurrentOffset(); | ||
| 112 | command = rp.Pop<u32_le>(); | 120 | command = rp.Pop<u32_le>(); |
| 113 | rp.Skip(1, false); // The command is actually an u64, but we don't use the high part. | 121 | rp.Skip(1, false); // The command is actually an u64, but we don't use the high part. |
| 114 | } | 122 | } |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 088058ebc..6401af35a 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -255,9 +255,8 @@ static ResultCode CancelSynchronization(Handle thread_handle) { | |||
| 255 | /// Attempts to locks a mutex, creating it if it does not already exist | 255 | /// Attempts to locks a mutex, creating it if it does not already exist |
| 256 | static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, | 256 | static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, |
| 257 | Handle requesting_thread_handle) { | 257 | Handle requesting_thread_handle) { |
| 258 | LOG_TRACE(Kernel_SVC, | 258 | LOG_TRACE(Kernel_SVC, "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " |
| 259 | "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " | 259 | "requesting_current_thread_handle=0x%08X", |
| 260 | "requesting_current_thread_handle=0x%08X", | ||
| 261 | holding_thread_handle, mutex_addr, requesting_thread_handle); | 260 | holding_thread_handle, mutex_addr, requesting_thread_handle); |
| 262 | 261 | ||
| 263 | SharedPtr<Thread> holding_thread = g_handle_table.Get<Thread>(holding_thread_handle); | 262 | SharedPtr<Thread> holding_thread = g_handle_table.Get<Thread>(holding_thread_handle); |
| @@ -547,9 +546,8 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 547 | 546 | ||
| 548 | Core::System::GetInstance().PrepareReschedule(); | 547 | Core::System::GetInstance().PrepareReschedule(); |
| 549 | 548 | ||
| 550 | LOG_TRACE(Kernel_SVC, | 549 | LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " |
| 551 | "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " | 550 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", |
| 552 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", | ||
| 553 | entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); | 551 | entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); |
| 554 | 552 | ||
| 555 | return RESULT_SUCCESS; | 553 | return RESULT_SUCCESS; |
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 0670ca155..848615fa7 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp | |||
| @@ -48,6 +48,18 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { | |||
| 48 | rb.Push(nv_result); | 48 | rb.Push(nv_result); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | void NVDRV::Close(Kernel::HLERequestContext& ctx) { | ||
| 52 | LOG_WARNING(Service, "(STUBBED) called"); | ||
| 53 | |||
| 54 | IPC::RequestParser rp{ctx}; | ||
| 55 | u32 fd = rp.Pop<u32>(); | ||
| 56 | |||
| 57 | auto result = nvdrv->Close(fd); | ||
| 58 | |||
| 59 | IPC::RequestBuilder rb{ctx, 2}; | ||
| 60 | rb.Push(result); | ||
| 61 | } | ||
| 62 | |||
| 51 | void NVDRV::Initialize(Kernel::HLERequestContext& ctx) { | 63 | void NVDRV::Initialize(Kernel::HLERequestContext& ctx) { |
| 52 | LOG_WARNING(Service, "(STUBBED) called"); | 64 | LOG_WARNING(Service, "(STUBBED) called"); |
| 53 | IPC::RequestBuilder rb{ctx, 3}; | 65 | IPC::RequestBuilder rb{ctx, 3}; |
| @@ -60,6 +72,7 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name) | |||
| 60 | static const FunctionInfo functions[] = { | 72 | static const FunctionInfo functions[] = { |
| 61 | {0, &NVDRV::Open, "Open"}, | 73 | {0, &NVDRV::Open, "Open"}, |
| 62 | {1, &NVDRV::Ioctl, "Ioctl"}, | 74 | {1, &NVDRV::Ioctl, "Ioctl"}, |
| 75 | {2, &NVDRV::Close, "Close"}, | ||
| 63 | {3, &NVDRV::Initialize, "Initialize"}, | 76 | {3, &NVDRV::Initialize, "Initialize"}, |
| 64 | }; | 77 | }; |
| 65 | RegisterHandlers(functions); | 78 | RegisterHandlers(functions); |
diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h index 8c95b7217..1b9aa9938 100644 --- a/src/core/hle/service/nvdrv/interface.h +++ b/src/core/hle/service/nvdrv/interface.h | |||
| @@ -20,6 +20,7 @@ public: | |||
| 20 | private: | 20 | private: |
| 21 | void Open(Kernel::HLERequestContext& ctx); | 21 | void Open(Kernel::HLERequestContext& ctx); |
| 22 | void Ioctl(Kernel::HLERequestContext& ctx); | 22 | void Ioctl(Kernel::HLERequestContext& ctx); |
| 23 | void Close(Kernel::HLERequestContext& ctx); | ||
| 23 | void Initialize(Kernel::HLERequestContext& ctx); | 24 | void Initialize(Kernel::HLERequestContext& ctx); |
| 24 | 25 | ||
| 25 | std::shared_ptr<Module> nvdrv; | 26 | std::shared_ptr<Module> nvdrv; |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index cf525a875..9b73886bb 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -49,5 +49,15 @@ u32 Module::Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector | |||
| 49 | return device->ioctl(command, input, output); | 49 | return device->ioctl(command, input, output); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | ResultCode Module::Close(u32 fd) { | ||
| 53 | auto itr = open_files.find(fd); | ||
| 54 | ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); | ||
| 55 | |||
| 56 | open_files.erase(itr); | ||
| 57 | |||
| 58 | // TODO(flerovium): return correct result code if operation failed. | ||
| 59 | return RESULT_SUCCESS; | ||
| 60 | } | ||
| 61 | |||
| 52 | } // namespace Nvidia | 62 | } // namespace Nvidia |
| 53 | } // namespace Service | 63 | } // namespace Service |
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 1940ced99..e44644624 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -35,6 +35,8 @@ public: | |||
| 35 | u32 Open(std::string device_name); | 35 | u32 Open(std::string device_name); |
| 36 | /// Sends an ioctl command to the specified file descriptor. | 36 | /// Sends an ioctl command to the specified file descriptor. |
| 37 | u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output); | 37 | u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output); |
| 38 | /// Closes a device file descriptor and returns operation success. | ||
| 39 | ResultCode Close(u32 fd); | ||
| 38 | 40 | ||
| 39 | private: | 41 | private: |
| 40 | /// Id to use for the next open file descriptor. | 42 | /// Id to use for the next open file descriptor. |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 5a2f539b1..156f7a1a4 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -124,8 +124,8 @@ custom_bottom_top = | |||
| 124 | custom_bottom_right = | 124 | custom_bottom_right = |
| 125 | custom_bottom_bottom = | 125 | custom_bottom_bottom = |
| 126 | 126 | ||
| 127 | #Whether to toggle frame limiter on or off. | 127 | # Whether to toggle frame limiter on or off. |
| 128 | # 0: Off , 1 (default): On | 128 | # 0: Off, 1 (default): On |
| 129 | toggle_framelimit = | 129 | toggle_framelimit = |
| 130 | 130 | ||
| 131 | # Swaps the prominent screen with the other screen. | 131 | # Swaps the prominent screen with the other screen. |