unicorn
unicorn copied to clipboard
Add UC_HOOK_INSN support for UC_X86_INS_RDTSC and UC_X86_INS_RDRAND
The current version of the Unicorn Engine does not provide hook support for the UC_X86_INS_RDTSC and UC_X86_INS_RDRAND instructions. These instructions are crucial for applications requiring precise time measurement or random number generation. This proposal suggests adding hook support for these instructions, allowing users to have more flexible control over code execution.
uc_hook_add(uc, &hook, UC_HOOK_INSN, hook_rdtsc, nullptr, 1, 0, UC_X86_INS_RDTSC); // Return: UC_ERR_HOOK
uc_hook_add(uc, &hook, UC_HOOK_INSN, hook_rdrand, nullptr, 1, 0, UC_X86_INS_RDRAND); // Return: UC_ERR_HOOK