fixes issue 902

Move displaced app code from the trampoline to the landing pad, which is
required to handle rip-rel displaced code.

Places the displaced app code in the intercept map along with further
intercept map generalization to cover the landing pad too:
+ use intercept map for jmp back too to avoid special-case in
  instr_set_translation() and dr_fragment_app_pc()
+ add is_part_of_interception() to combine landing pad and
  interception buffer checks

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1629 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#565 win8 support

Another syscall param change issue: switch to using TEB for per-thread
stack since no edx for os_terminate and app termination for both processes
and threads.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1630 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 901

Switches native_exec syscall trampolines to use landing pads.  Because they
displace their app code up front rather than after, I kept the displaced
code in the interception buffer and bailed on supporting rip-rel in the
wrapper itself (don't expect to see it).  This minimizes the changes
required.  I still had to update various syscall trampoline handling code
to handle the landing pads.

Split a helper function syscall_wrapper_ilist() out of
intercept_syscall_wrapper() as the function is pretty long and this adds
more to it.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1631 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 926

Made the alternate_after hook target in emit_intercept_code() use an
indirect jump when it can't reach for x64.  Changed the returned cti
pointer to be a target pointer, and updated the hotpatch code to patch the
pointer-sized target.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1632 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#774, i#901: we do not need to be near ntdll.dll anymore for 64-bit
reachability

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1633 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 930
+ xchg with initstack_mutex properly in x64 hooks

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1634 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#877: Add module import iterator

This adds an imported module iterator and an imported symbol iterator.

The imported module iterator is not available on Linux, since ELF
doesn't import from specific modules.

On Windows, the symbol iterator can iterate over symbols being imported
from a specific module by passing a 'from_module' pointer from the
imported module iterator to the symbol iterator.

To iterator over all imported symbols regardless of which module they
come from, pass NULL for the from_module.  On Linux, this parameter must
always be NULL.

The API usage looks like this:

  dr_symbol_import_iterator *sym_iter =
      dr_symbol_import_iterator_start(mod->handle, NULL);
  while (dr_symbol_import_iterator_hasnext(sym_iter)) {
      dr_symbol_import_t *sym_import =
          dr_symbol_import_iterator_next(sym_iter)
      dr_printf("imported %s!%s\n",
                sym_import->modname, sym_import->name);
  }
  dr_symbol_import_iterator_stop(sym_iter);

Fixes issue 877.

Review URL: https://codereview.appspot.com/6540044

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1635 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6