x86: support hooking SYSCALL/SYSENTER instructions. we no longer share the SYSCALL callback with interrupt instructions

This commit is contained in:
Nguyen Anh Quynh
2015-08-23 01:19:40 +08:00
parent 3eeda8c8eb
commit e1baf2f36b
7 changed files with 41 additions and 15 deletions

View File

@ -945,15 +945,15 @@ void helper_syscall(CPUX86State *env, int next_eip_addend)
#else
void helper_syscall(CPUX86State *env, int next_eip_addend)
{
// Unicorn: call interrupt callback if registered
struct uc_struct *uc = env->uc;
if (uc->hook_intr_idx) {
((uc_cb_hookintr_t)uc->hook_callbacks[uc->hook_intr_idx].callback)(
(uch)uc, 80,
uc->hook_callbacks[uc->hook_intr_idx].user_data);
env->eip += next_eip_addend;
return;
}
// Unicorn: call interrupt callback if registered
struct uc_struct *uc = env->uc;
if (uc->hook_syscall_idx) {
((uc_cb_insn_syscall_t)uc->hook_callbacks[uc->hook_syscall_idx].callback)(
(uch)uc, uc->hook_callbacks[uc->hook_syscall_idx].user_data);
env->eip += next_eip_addend;
}
return;
int selector;