public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Alejandro Saez Morollon <asm@redhat.com>
Subject: Re: [PATCH] backends: Use PTRACE_GETREGSET for ppc_set_initial_registers_tid
Date: Mon, 21 Feb 2022 12:46:21 +0100	[thread overview]
Message-ID: <3919665b2f5c9feca9f3e60fea7c845c2adb39b6.camel@klomp.org> (raw)
In-Reply-To: <20220216140716.26380-1-mark@klomp.org>

Hi,

On Wed, 2022-02-16 at 15:07 +0100, Mark Wielaard wrote:
> The code in ppc_initreg.c used PTRACE_PEEKUSER to fetch all registers
> one by one. Which is slightly inefficient. It did this because it
> wanted
> things to work on linux 2.6.18 which didn't support PTRACE_GETREGSET.
> 
> PTRACE_GETREGSET was only officially since 2.6.34 (but backported
> to some earlier versions). It seems ok to require a linux kernel that
> supports PTRACE_GETREGSET now. This is much more efficient since it
> takes just one ptrace call instead of 44 calls to fetch each register
> individually.
> 
> For some really old versions we need to include <linux/ptrace.h> to
> get PTRACE_GETREGSET defined. And on ppc64 there is no 32bit version
> of struct pt_regs available, so we define that ourselves and check
> how much data is returned to know whether this is a full pt_regs or
> one for a 32bit process. An alternative would be to use the raw
> iov_base bytes with 64bit or 32bit offset constants to get at the
> registers instead of using a struct with names.
> 
> The code works for inspecting a 32bit process from a 64bit build,
> but not the other way around (the previous code also didn't). This
> could work if we also defined and used a 64bit pt_regs struct on
> ppc32. But it seems a use case that is not really used (it was hard
> enough finding ppc32 setups to test this on).
> 
> Tested against ppc and ppc64 on linux 2.6.32 and glibc 2.12 and
> ppc and ppc64 on linux 3.10.0 with glibc 2.17.

Pushed.

Cheers,

Mark

      reply	other threads:[~2022-02-21 11:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 14:07 Mark Wielaard
2022-02-21 11:46 ` Mark Wielaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3919665b2f5c9feca9f3e60fea7c845c2adb39b6.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=asm@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).