syscallHookAdd :: Storable a
               => Engine        -- ^ 'Unicorn' engine handle
               -> SyscallHook a -- ^ SYSCALL instruction callback
               -> a             -- ^ User-defined data. This will be passed to
                                -- the callback function
               -> Word64        -- ^ Start address
               -> Word64        -- ^ End address
               -> Emulator Hook -- ^ The hook handle on success, or an 'Error'
                                -- on failure
syscallHookAdd uc callback userData begin end = do
    result <- lift . alloca $ \userDataPtr -> do
        poke userDataPtr userData
        funPtr <- marshalSyscallHook callback
        getResult $ ucInsnHookAdd uc HookInsn funPtr userDataPtr begin end
                                  X86.Syscall
    hoistEither result

-- | Register a callback for a valid memory access event.
syscallHookAdd :: Storable a
               => Engine        -- ^ 'Unicorn' engine handle
               -> SyscallHook a -- ^ SYSCALL instruction callback
               -> a             -- ^ User-defined data. This will be passed to
                                -- the callback function
               -> Word64        -- ^ Start address
               -> Word64        -- ^ End address
               -> Emulator Hook
syscallHookAdd uc callback userData begin end = do
    result <- lift . alloca $ \userDataPtr -> do
        poke userDataPtr userData
        funPtr <- marshalSyscallHook callback
        getResult $ ucInsnHookAdd uc HookInsn funPtr userDataPtr begin end
                                  X86.Syscall
    hoistEither result

-- | Register a callback for a valid memory access event.
syscallHookAdd uc callback userData begin end = do
    result <- lift . alloca $ \userDataPtr -> do
        poke userDataPtr userData
        funPtr <- marshalSyscallHook callback
        getResult $ ucInsnHookAdd uc HookInsn funPtr userDataPtr begin end
                                  X86.Syscall
    hoistEither result

-- | Register a callback for a valid memory access event.