This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] Fast tracepoint for powerpc64le

On 2015/3/18 äå 02:29, Ulrich Weigand wrote:
Power8, we might be able to use a bctar, but we may not be able to rely
on the TAR register being available.)

If I clobbered TAR register, won't it affect the user code?

As a first implementation, I guess I'd be fine with those) restriction,
but we should be thinking of how we could lift (some of) them.  We might
want to, for example,
  - determine the actual mapping base of the main executable and place
    the jump pad close even if it is not at the default address

How about this?  AT_PHDR should be at the very beginning of the first
loadable segment of the executable.  This should work for PIE.

jump_pad_area_hint (void)
  /* Use AT_PHDR address to guess where the main executable is mapped,
     and try to map the jump pad before it.  The jump pad should be
     closed enough to the executable for unconditional branch (+/- 32MB). */

  uintptr_t base = getauxval (AT_PHDR);
  uintptr_t pagesz = sysconf (_SC_PAGE_SIZE);
  uintptr_t hint = (base & ~(pagesz - 1)) - 1 * 1024 * 1024;

  /* Is wrap around?  */
  if (hint > base)
    hint = pagesz;

  return hint;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]