diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/CMakeLists.txt | 337 | ||||
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 46 |
3 files changed, 200 insertions, 201 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e77261dc4..c05244b7e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,174 +1,171 @@ -set(SRCS - arm/dynarmic/arm_dynarmic.cpp - arm/unicorn/arm_unicorn.cpp - core.cpp - core_timing.cpp - file_sys/archive_backend.cpp - file_sys/disk_archive.cpp - file_sys/ivfc_archive.cpp - file_sys/path_parser.cpp - file_sys/savedata_archive.cpp - file_sys/title_metadata.cpp - frontend/emu_window.cpp - frontend/framebuffer_layout.cpp - gdbstub/gdbstub.cpp - hle/config_mem.cpp - hle/kernel/address_arbiter.cpp - hle/kernel/client_port.cpp - hle/kernel/client_session.cpp - hle/kernel/condition_variable.cpp - hle/kernel/domain.cpp - hle/kernel/event.cpp - hle/kernel/handle_table.cpp - hle/kernel/hle_ipc.cpp - hle/kernel/kernel.cpp - hle/kernel/memory.cpp - hle/kernel/mutex.cpp - hle/kernel/object_address_table.cpp - hle/kernel/process.cpp - hle/kernel/resource_limit.cpp - hle/kernel/server_port.cpp - hle/kernel/server_session.cpp - hle/kernel/shared_memory.cpp - hle/kernel/svc.cpp - hle/kernel/thread.cpp - hle/kernel/timer.cpp - hle/kernel/vm_manager.cpp - hle/kernel/wait_object.cpp - hle/lock.cpp - hle/romfs.cpp - hle/service/acc/acc.cpp - hle/service/acc/acc_u0.cpp - hle/service/am/am.cpp - hle/service/am/applet_oe.cpp - hle/service/aoc/aoc_u.cpp - hle/service/apm/apm.cpp - hle/service/audio/audio.cpp - hle/service/audio/audout_u.cpp - hle/service/hid/hid.cpp - hle/service/lm/lm.cpp - hle/service/nvdrv/devices/nvdisp_disp0.cpp - hle/service/nvdrv/devices/nvhost_as_gpu.cpp - hle/service/nvdrv/devices/nvmap.cpp - hle/service/nvdrv/interface.cpp - hle/service/nvdrv/nvdrv.cpp - hle/service/pctl/pctl.cpp - hle/service/pctl/pctl_a.cpp - hle/service/service.cpp - hle/service/sm/controller.cpp - hle/service/sm/sm.cpp - hle/service/time/time.cpp - hle/service/vi/vi.cpp - hle/service/vi/vi_m.cpp - hle/shared_page.cpp - hw/hw.cpp - hw/lcd.cpp - loader/elf.cpp - loader/linker.cpp - loader/loader.cpp - loader/nro.cpp - loader/nso.cpp - tracer/recorder.cpp - memory.cpp - perf_stats.cpp - settings.cpp - telemetry_session.cpp - ) +add_library(core STATIC + arm/arm_interface.h + arm/dynarmic/arm_dynarmic.cpp + arm/dynarmic/arm_dynarmic.h + arm/unicorn/arm_unicorn.cpp + arm/unicorn/arm_unicorn.h + core.cpp + core.h + core_timing.cpp + core_timing.h + file_sys/archive_backend.cpp + file_sys/archive_backend.h + file_sys/directory_backend.h + file_sys/disk_archive.cpp + file_sys/disk_archive.h + file_sys/errors.h + file_sys/file_backend.h + file_sys/ivfc_archive.cpp + file_sys/ivfc_archive.h + file_sys/path_parser.cpp + file_sys/path_parser.h + file_sys/savedata_archive.cpp + file_sys/savedata_archive.h + file_sys/title_metadata.cpp + file_sys/title_metadata.h + frontend/emu_window.cpp + frontend/emu_window.h + frontend/framebuffer_layout.cpp + frontend/framebuffer_layout.h + frontend/input.h + gdbstub/gdbstub.cpp + gdbstub/gdbstub.h + hle/config_mem.cpp + hle/config_mem.h + hle/ipc.h + hle/ipc_helpers.h + hle/kernel/address_arbiter.cpp + hle/kernel/address_arbiter.h + hle/kernel/client_port.cpp + hle/kernel/client_port.h + hle/kernel/client_session.cpp + hle/kernel/client_session.h + hle/kernel/condition_variable.cpp + hle/kernel/condition_variable.h + hle/kernel/domain.cpp + hle/kernel/domain.h + hle/kernel/errors.h + hle/kernel/event.cpp + hle/kernel/event.h + hle/kernel/handle_table.cpp + hle/kernel/handle_table.h + hle/kernel/hle_ipc.cpp + hle/kernel/hle_ipc.h + hle/kernel/kernel.cpp + hle/kernel/kernel.h + hle/kernel/memory.cpp + hle/kernel/memory.h + hle/kernel/mutex.cpp + hle/kernel/mutex.h + hle/kernel/object_address_table.cpp + hle/kernel/object_address_table.h + hle/kernel/process.cpp + hle/kernel/process.h + hle/kernel/resource_limit.cpp + hle/kernel/resource_limit.h + hle/kernel/server_port.cpp + hle/kernel/server_port.h + hle/kernel/server_session.cpp + hle/kernel/server_session.h + hle/kernel/session.h + hle/kernel/shared_memory.cpp + hle/kernel/shared_memory.h + hle/kernel/svc.cpp + hle/kernel/svc.h + hle/kernel/svc_wrap.h + hle/kernel/sync_object.h + hle/kernel/thread.cpp + hle/kernel/thread.h + hle/kernel/timer.cpp + hle/kernel/timer.h + hle/kernel/vm_manager.cpp + hle/kernel/vm_manager.h + hle/kernel/wait_object.cpp + hle/kernel/wait_object.h + hle/lock.cpp + hle/lock.h + hle/result.h + hle/romfs.cpp + hle/romfs.h + hle/service/acc/acc.cpp + hle/service/acc/acc.h + hle/service/acc/acc_u0.cpp + hle/service/acc/acc_u0.h + hle/service/am/am.cpp + hle/service/am/am.h + hle/service/am/applet_oe.cpp + hle/service/am/applet_oe.h + hle/service/aoc/aoc_u.cpp + hle/service/aoc/aoc_u.h + hle/service/apm/apm.cpp + hle/service/apm/apm.h + hle/service/audio/audio.cpp + hle/service/audio/audio.h + hle/service/audio/audout_u.cpp + hle/service/audio/audout_u.h + hle/service/hid/hid.cpp + hle/service/hid/hid.h + hle/service/lm/lm.cpp + hle/service/lm/lm.h + hle/service/nvdrv/devices/nvdevice.h + hle/service/nvdrv/devices/nvdisp_disp0.cpp + hle/service/nvdrv/devices/nvdisp_disp0.h + hle/service/nvdrv/devices/nvhost_as_gpu.cpp + hle/service/nvdrv/devices/nvhost_as_gpu.h + hle/service/nvdrv/devices/nvmap.cpp + hle/service/nvdrv/devices/nvmap.h + hle/service/nvdrv/interface.cpp + hle/service/nvdrv/interface.h + hle/service/nvdrv/nvdrv.cpp + hle/service/nvdrv/nvdrv.h + hle/service/pctl/pctl.cpp + hle/service/pctl/pctl.h + hle/service/pctl/pctl_a.cpp + hle/service/pctl/pctl_a.h + hle/service/service.cpp + hle/service/service.h + hle/service/sm/controller.cpp + hle/service/sm/controller.h + hle/service/sm/sm.cpp + hle/service/sm/sm.h + hle/service/time/time.cpp + hle/service/time/time.h + hle/service/vi/vi.cpp + hle/service/vi/vi.h + hle/service/vi/vi_m.cpp + hle/service/vi/vi_m.h + hle/shared_page.cpp + hle/shared_page.h + hw/hw.cpp + hw/hw.h + hw/lcd.cpp + hw/lcd.h + loader/elf.cpp + loader/elf.h + loader/linker.cpp + loader/linker.h + loader/loader.cpp + loader/loader.h + loader/nro.cpp + loader/nro.h + loader/nso.cpp + loader/nso.h + memory.cpp + memory.h + memory_setup.h + mmio.h + perf_stats.cpp + perf_stats.h + settings.cpp + settings.h + telemetry_session.cpp + telemetry_session.h + tracer/citrace.h + tracer/recorder.cpp + tracer/recorder.h +) -set(HEADERS - arm/arm_interface.h - arm/dynarmic/arm_dynarmic.h - arm/unicorn/arm_unicorn.h - core.h - core_timing.h - file_sys/archive_backend.h - file_sys/directory_backend.h - file_sys/disk_archive.h - file_sys/errors.h - file_sys/file_backend.h - file_sys/ivfc_archive.h - file_sys/path_parser.h - file_sys/savedata_archive.h - file_sys/title_metadata.h - frontend/emu_window.h - frontend/framebuffer_layout.h - frontend/input.h - gdbstub/gdbstub.h - hle/config_mem.h - hle/ipc.h - hle/ipc_helpers.h - hle/kernel/address_arbiter.h - hle/kernel/client_port.h - hle/kernel/client_session.h - hle/kernel/condition_variable.h - hle/kernel/domain.h - hle/kernel/errors.h - hle/kernel/event.h - hle/kernel/handle_table.h - hle/kernel/hle_ipc.h - hle/kernel/kernel.h - hle/kernel/memory.h - hle/kernel/mutex.h - hle/kernel/object_address_table.h - hle/kernel/process.h - hle/kernel/resource_limit.h - hle/kernel/server_port.h - hle/kernel/server_session.h - hle/kernel/session.h - hle/kernel/shared_memory.h - hle/kernel/sync_object.h - hle/kernel/svc.h - hle/kernel/svc_wrap.h - hle/kernel/thread.h - hle/kernel/timer.h - hle/kernel/vm_manager.h - hle/kernel/wait_object.h - hle/lock.h - hle/result.h - hle/romfs.h - hle/service/acc/acc.h - hle/service/acc/acc_u0.h - hle/service/am/am.h - hle/service/am/applet_oe.h - hle/service/aoc/aoc_u.h - hle/service/apm/apm.h - hle/service/audio/audio.h - hle/service/audio/audout_u.h - hle/service/hid/hid.h - hle/service/lm/lm.h - hle/service/nvdrv/devices/nvdevice.h - hle/service/nvdrv/devices/nvdisp_disp0.h - hle/service/nvdrv/devices/nvhost_as_gpu.h - hle/service/nvdrv/devices/nvmap.h - hle/service/nvdrv/interface.h - hle/service/nvdrv/nvdrv.h - hle/service/pctl/pctl.h - hle/service/pctl/pctl_a.h - hle/service/service.h - hle/service/sm/controller.h - hle/service/sm/sm.h - hle/service/time/time.h - hle/service/vi/vi.h - hle/service/vi/vi_m.h - hle/shared_page.h - hw/hw.h - hw/lcd.h - loader/elf.h - loader/linker.h - loader/loader.h - loader/nro.h - loader/nso.h - tracer/recorder.h - tracer/citrace.h - memory.h - memory_setup.h - mmio.h - perf_stats.h - settings.h - telemetry_session.h - ) +create_target_directory_groups(core) -create_directory_groups(${SRCS} ${HEADERS}) -add_library(core STATIC ${SRCS} ${HEADERS}) target_link_libraries(core PUBLIC common PRIVATE dynarmic video_core) target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static unicorn) diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 6401af35a..45da842ef 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -57,7 +57,7 @@ static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { } /// Connect to an OS service given the port name, returns the handle to the port to out -static ResultCode ConnectToPort(Handle* out_handle, VAddr port_name_address) { +static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address) { if (!Memory::IsValidVirtualAddress(port_name_address)) return ERR_NOT_FOUND; @@ -253,8 +253,8 @@ static ResultCode CancelSynchronization(Handle thread_handle) { } /// Attempts to locks a mutex, creating it if it does not already exist -static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, - Handle requesting_thread_handle) { +static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, + Handle requesting_thread_handle) { LOG_TRACE(Kernel_SVC, "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " "requesting_current_thread_handle=0x%08X", holding_thread_handle, mutex_addr, requesting_thread_handle); @@ -277,7 +277,7 @@ static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, } /// Unlock a mutex -static ResultCode UnlockMutex(VAddr mutex_addr) { +static ResultCode ArbitrateUnlock(VAddr mutex_addr) { LOG_TRACE(Kernel_SVC, "called mutex_addr=0x%llx", mutex_addr); SharedPtr<Mutex> mutex = g_object_address_table.Get<Mutex>(mutex_addr); @@ -774,12 +774,12 @@ static const FunctionDef SVC_Table[] = { {0x17, SvcWrap<ResetSignal>, "ResetSignal"}, {0x18, SvcWrap<WaitSynchronization>, "WaitSynchronization"}, {0x19, SvcWrap<CancelSynchronization>, "CancelSynchronization"}, - {0x1A, SvcWrap<LockMutex>, "LockMutex"}, - {0x1B, SvcWrap<UnlockMutex>, "UnlockMutex"}, + {0x1A, SvcWrap<ArbitrateLock>, "ArbitrateLock"}, + {0x1B, SvcWrap<ArbitrateUnlock>, "ArbitrateUnlock"}, {0x1C, SvcWrap<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"}, {0x1D, SvcWrap<SignalProcessWideKey>, "SignalProcessWideKey"}, {0x1E, SvcWrap<GetSystemTick>, "GetSystemTick"}, - {0x1F, SvcWrap<ConnectToPort>, "ConnectToPort"}, + {0x1F, SvcWrap<ConnectToNamedPort>, "ConnectToNamedPort"}, {0x20, nullptr, "SendSyncRequestLight"}, {0x21, SvcWrap<SendSyncRequest>, "SendSyncRequest"}, {0x22, nullptr, "SendSyncRequestWithUserBuffer"}, @@ -823,8 +823,8 @@ static const FunctionDef SVC_Table[] = { {0x48, nullptr, "Unknown"}, {0x49, nullptr, "Unknown"}, {0x4A, nullptr, "Unknown"}, - {0x4B, nullptr, "Unknown"}, - {0x4C, nullptr, "Unknown"}, + {0x4B, nullptr, "CreateJitMemory"}, + {0x4C, nullptr, "MapJitMemory"}, {0x4D, nullptr, "SleepSystem"}, {0x4E, nullptr, "ReadWriteRegister"}, {0x4F, nullptr, "SetProcessActivity"}, diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index cae2c4466..108a635d7 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -26,7 +26,7 @@ public: // This default size was chosen arbitrarily. static constexpr size_t DefaultBufferSize = 0x40; Parcel() : buffer(DefaultBufferSize) {} - Parcel(std::vector<u8> data) : buffer(std::move(data)) {} + explicit Parcel(std::vector<u8> data) : buffer(std::move(data)) {} virtual ~Parcel() = default; template <typename T> @@ -47,8 +47,9 @@ public: } std::vector<u8> ReadBlock(size_t length) { - std::vector<u8> data(length); - std::memcpy(data.data(), buffer.data() + read_index, length); + const u8* const begin = buffer.data() + read_index; + const u8* const end = begin + length; + std::vector<u8> data(begin, end); read_index += length; read_index = Common::AlignUp(read_index, 4); return data; @@ -101,9 +102,9 @@ public: } protected: - virtual void SerializeData(){}; + virtual void SerializeData() {} - virtual void DeserializeData(){}; + virtual void DeserializeData() {} private: struct Header { @@ -121,7 +122,7 @@ private: class NativeWindow : public Parcel { public: - NativeWindow(u32 id) : Parcel() { + explicit NativeWindow(u32 id) : Parcel() { data.id = id; } ~NativeWindow() override = default; @@ -147,12 +148,12 @@ private: class IGBPConnectRequestParcel : public Parcel { public: - IGBPConnectRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { + explicit IGBPConnectRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { Deserialize(); } ~IGBPConnectRequestParcel() override = default; - void DeserializeData() { + void DeserializeData() override { std::u16string token = ReadInterfaceToken(); data = Read<Data>(); } @@ -168,7 +169,7 @@ public: class IGBPConnectResponseParcel : public Parcel { public: - IGBPConnectResponseParcel(u32 width, u32 height) : Parcel() { + explicit IGBPConnectResponseParcel(u32 width, u32 height) : Parcel() { data.width = width; data.height = height; } @@ -194,12 +195,13 @@ private: class IGBPSetPreallocatedBufferRequestParcel : public Parcel { public: - IGBPSetPreallocatedBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { + explicit IGBPSetPreallocatedBufferRequestParcel(const std::vector<u8>& buffer) + : Parcel(buffer) { Deserialize(); } ~IGBPSetPreallocatedBufferRequestParcel() override = default; - void DeserializeData() { + void DeserializeData() override { std::u16string token = ReadInterfaceToken(); data = Read<Data>(); ASSERT(data.graphic_buffer_length == sizeof(IGBPBuffer)); @@ -231,12 +233,12 @@ protected: class IGBPDequeueBufferRequestParcel : public Parcel { public: - IGBPDequeueBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { + explicit IGBPDequeueBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { Deserialize(); } ~IGBPDequeueBufferRequestParcel() override = default; - void DeserializeData() { + void DeserializeData() override { std::u16string token = ReadInterfaceToken(); data = Read<Data>(); } @@ -254,7 +256,7 @@ public: class IGBPDequeueBufferResponseParcel : public Parcel { public: - IGBPDequeueBufferResponseParcel(u32 slot) : Parcel(), slot(slot) {} + explicit IGBPDequeueBufferResponseParcel(u32 slot) : Parcel(), slot(slot) {} ~IGBPDequeueBufferResponseParcel() override = default; protected: @@ -271,12 +273,12 @@ protected: class IGBPRequestBufferRequestParcel : public Parcel { public: - IGBPRequestBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { + explicit IGBPRequestBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { Deserialize(); } ~IGBPRequestBufferRequestParcel() override = default; - void DeserializeData() { + void DeserializeData() override { std::u16string token = ReadInterfaceToken(); slot = Read<u32_le>(); } @@ -286,7 +288,7 @@ public: class IGBPRequestBufferResponseParcel : public Parcel { public: - IGBPRequestBufferResponseParcel(IGBPBuffer buffer) : Parcel(), buffer(buffer) {} + explicit IGBPRequestBufferResponseParcel(IGBPBuffer buffer) : Parcel(), buffer(buffer) {} ~IGBPRequestBufferResponseParcel() override = default; protected: @@ -307,12 +309,12 @@ protected: class IGBPQueueBufferRequestParcel : public Parcel { public: - IGBPQueueBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { + explicit IGBPQueueBufferRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) { Deserialize(); } ~IGBPQueueBufferRequestParcel() override = default; - void DeserializeData() { + void DeserializeData() override { std::u16string token = ReadInterfaceToken(); data = Read<Data>(); } @@ -330,7 +332,7 @@ public: class IGBPQueueBufferResponseParcel : public Parcel { public: - IGBPQueueBufferResponseParcel(u32 width, u32 height) : Parcel() { + explicit IGBPQueueBufferResponseParcel(u32 width, u32 height) : Parcel() { data.width = width; data.height = height; } @@ -356,7 +358,7 @@ private: class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { public: - IHOSBinderDriver(std::shared_ptr<NVFlinger> nv_flinger) + explicit IHOSBinderDriver(std::shared_ptr<NVFlinger> nv_flinger) : ServiceFramework("IHOSBinderDriver"), nv_flinger(std::move(nv_flinger)) { static const FunctionInfo functions[] = { {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"}, @@ -506,7 +508,7 @@ private: class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { public: - IManagerDisplayService(std::shared_ptr<NVFlinger> nv_flinger) + explicit IManagerDisplayService(std::shared_ptr<NVFlinger> nv_flinger) : ServiceFramework("IManagerDisplayService"), nv_flinger(std::move(nv_flinger)) { static const FunctionInfo functions[] = { {1020, &IManagerDisplayService::CloseDisplay, "CloseDisplay"}, |