Skip to content

Commit

Permalink
i#58 MacOS: handle post-sysenter continuation on a skipped syscall
Browse files Browse the repository at this point in the history
SVN-Revision: 2617
  • Loading branch information
derekbruening committed Mar 30, 2014
1 parent 16d33e4 commit 677730e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions core/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,19 @@ handle_system_call(dcontext_t *dcontext)
}
#endif

#ifdef MACOS
if (get_syscall_method() == SYSCALL_METHOD_SYSENTER && !dcontext->sys_was_int) {
/* The kernel returns control to whatever user-mode places in edx.
* We want to put this in even if we skip the syscall as we'll still call
* adjust_syscall_continuation for a skip.
*/
byte *post_sysenter = after_do_syscall_addr(dcontext);
priv_mcontext_t *mc = get_mcontext(dcontext);
dcontext->app_xdx = mc->xdx;
mc->xdx = (reg_t) post_sysenter;
}
#endif

/* first do the pre-system-call */
if (IF_CLIENT_INTERFACE(execute_syscall &&) pre_system_call(dcontext)) {
/* now do the actual syscall instruction */
Expand Down Expand Up @@ -1868,16 +1881,6 @@ handle_system_call(dcontext_t *dcontext)
}
#endif

#ifdef MACOS
if (get_syscall_method() == SYSCALL_METHOD_SYSENTER && !dcontext->sys_was_int) {
/* The kernel returns control to whatever user-mode places in edx */
byte *post_sysenter = after_do_syscall_addr(dcontext);
priv_mcontext_t *mc = get_mcontext(dcontext);
dcontext->app_xdx = mc->xdx;
mc->xdx = (reg_t) post_sysenter;
}
#endif

SELF_PROTECT_LOCAL(dcontext, READONLY);

set_at_syscall(dcontext, true);
Expand Down

0 comments on commit 677730e

Please sign in to comment.