From f217d6c66f46b5c4515aa7f699174e181b81a53d Mon Sep 17 00:00:00 2001 From: greggameplayer <33609333+greggameplayer@users.noreply.github.com> Date: Wed, 23 May 2018 12:32:37 +0200 Subject: [PATCH] Add ioctl commands with their params and size check --- .../hle/service/nvdrv/devices/nvhost_ctrl.h | 88 ++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index 76a8b33c2..aa9b5a14b 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h @@ -26,12 +26,64 @@ private: IocSyncptIncrCommand = 0x40040015, IocSyncptWaitCommand = 0xC00C0016, IocModuleMutexCommand = 0x40080017, - IocModuleRegRDWRCommand = 0xC008010E, + IocModuleRegRDWRCommand = 0xC0180018, IocSyncptWaitexCommand = 0xC0100019, IocSyncptReadMaxCommand = 0xC008001A, - IocCtrlEventWaitCommand = 0xC010001D, IocGetConfigCommand = 0xC183001B, + IocCtrlEventSignalCommand = 0xC004001C, + IocCtrlEventWaitCommand = 0xC010001D, + IocCtrlEventWaitAsyncCommand = 0xC010001E, + IocCtrlEventRegisterCommand = 0xC004001F, + IocCtrlEventUnregisterCommand = 0xC0040020, + IocCtrlEventKillCommand = 0x40080021, }; + struct IocSyncptReadParams { + u32_le id; + u32_le value; + }; + static_assert(sizeof(IocSyncptReadParams) == 8, "IocSyncptReadParams is incorrect size"); + + struct IocSyncptIncrParams { + u32_le id; + }; + static_assert(sizeof(IocSyncptIncrParams) == 4, "IocSyncptIncrParams is incorrect size"); + + struct IocSyncptWaitParams { + u32_le id; + u32_le thresh; + s32_le timeout; + }; + static_assert(sizeof(IocSyncptWaitParams) == 12, "IocSyncptWaitParams is incorrect size"); + + struct IocModuleMutexParams { + u32_le id; + u32_le lock; // (0 = unlock and 1 = lock) + }; + static_assert(sizeof(IocModuleMutexParams) == 8, "IocModuleMutexParams is incorrect size"); + + struct IocModuleRegRDWRParams { + u32_le id; + u32_le num_offsets; + u32_le block_size; + u32_le offsets; + u32_le values; + u32_le write; + }; + static_assert(sizeof(IocModuleRegRDWRParams) == 24, "IocModuleRegRDWRParams is incorrect size"); + + struct IocSyncptWaitexParams { + u32_le id; + u32_le thresh; + s32_le timeout; + u32_le value; + }; + static_assert(sizeof(IocSyncptWaitexParams) == 16, "IocSyncptWaitexParams is incorrect size"); + + struct IocSyncptReadMaxParams { + u32_le id; + u32_le value; + }; + static_assert(sizeof(IocSyncptReadMaxParams) == 8, "IocSyncptReadMaxParams is incorrect size"); struct IocGetConfigParams { std::array domain_str; @@ -40,6 +92,12 @@ private: }; static_assert(sizeof(IocGetConfigParams) == 387, "IocGetConfigParams is incorrect size"); + struct IocCtrlEventSignalParams { + u32_le user_event_id; + }; + static_assert(sizeof(IocCtrlEventSignalParams) == 4, + "IocCtrlEventSignalParams is incorrect size"); + struct IocCtrlEventWaitParams { u32_le syncpt_id; u32_le threshold; @@ -48,6 +106,32 @@ private: }; static_assert(sizeof(IocCtrlEventWaitParams) == 16, "IocCtrlEventWaitParams is incorrect size"); + struct IocCtrlEventWaitAsyncParams { + u32_le syncpt_id; + u32_le threshold; + u32_le timeout; + u32_le value; + }; + static_assert(sizeof(IocCtrlEventWaitAsyncParams) == 16, + "IocCtrlEventWaitAsyncParams is incorrect size"); + + struct IocCtrlEventRegisterParams { + u32_le user_event_id; + }; + static_assert(sizeof(IocCtrlEventRegisterParams) == 4, + "IocCtrlEventRegisterParams is incorrect size"); + + struct IocCtrlEventUnregisterParams { + u32_le user_event_id; + }; + static_assert(sizeof(IocCtrlEventUnregisterParams) == 4, + "IocCtrlEventUnregisterParams is incorrect size"); + + struct IocCtrlEventKill { + u64_le user_events; + }; + static_assert(sizeof(IocCtrlEventKill) == 8, "IocCtrlEventKill is incorrect size"); + u32 NvOsGetConfigU32(const std::vector& input, std::vector& output); u32 IocCtrlEventWait(const std::vector& input, std::vector& output);