mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 20:56:52 +00:00
Makes SYSENTER hookable again on x86
Adds SYSENTER to the whitelist of supported hookable instructions in unicorn as well as fixes up the existing sysenter_hook_x86 regression test which was previously failing Fixes unicorn-engine/unicorn#995 Backports commit 0f14c473445661a633ca5bda3a91ba1a87c35c64 from unicorn
This commit is contained in:
parent
e87df070d9
commit
b4bb7edfe8
|
@ -1338,10 +1338,11 @@ static bool x86_stop_interrupt(int intno)
|
||||||
|
|
||||||
static bool x86_insn_hook_validate(uint32_t insn_enum)
|
static bool x86_insn_hook_validate(uint32_t insn_enum)
|
||||||
{
|
{
|
||||||
//for x86 we can only hook IN, OUT, and SYSCALL
|
//for x86 we can only hook IN, OUT, SYSCALL, and SYSENTER
|
||||||
if (insn_enum != UC_X86_INS_IN
|
if (insn_enum != UC_X86_INS_IN
|
||||||
&& insn_enum != UC_X86_INS_OUT
|
&& insn_enum != UC_X86_INS_OUT
|
||||||
&& insn_enum != UC_X86_INS_SYSCALL) {
|
&& insn_enum != UC_X86_INS_SYSCALL
|
||||||
|
&& insn_enum != UC_X86_INS_SYSENTER) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -36,7 +36,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook the SYSENTER instructions
|
// Hook the SYSENTER instructions
|
||||||
if (uc_hook_add (uc, &sysenterHook, UC_HOOK_INSN, sysenter, NULL, UC_X86_INS_SYSENTER, 1, 0) != UC_ERR_OK) {
|
if (uc_hook_add (uc, &sysenterHook, UC_HOOK_INSN, sysenter, NULL, 1, 0, UC_X86_INS_SYSENTER) != UC_ERR_OK) {
|
||||||
printf ("Cannot hook SYSENTER instruction\n.");
|
printf ("Cannot hook SYSENTER instruction\n.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue