public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Hanson, Jonathan M" <jonathan.m.hanson@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: RBP save and restore on x86-64 system calls
Date: 28 Aug 2006 21:16:53 +0200	[thread overview]
Message-ID: <p733bbg7jru.fsf@verdi.suse.de> (raw)
In-Reply-To: <3B326087ABEA7940953BF629CAA40E17035BE455@azsmsx402>

"Hanson, Jonathan M" <jonathan.m.hanson@intel.com> writes:

> 	This may not be a kernel question per se but I was hoping someone on
> this list might be able to shed some light into where RBP is saved to on an
> x86-64 system when a non-tracing system call is made.

It might not be saved at all. The entry code relies on the C ABI
of the kernel code to save it somewhere or just not clobber it.

> 	An ioctl() triggers my kernel module and I need to have a way to
> reliably retrieve what RBP was immediately before the system call. RBP is
> not saved on the process' stack on kernel entry. The code in entry.S says
> that it's up to the C code (which I'm taking to mean glibc)

No, it's the kernel C code. RBP isn't callee clobbered register
so it's not saved.

What you can do is to use the new dwarf2 unwinder that will be in 2.6.18.
It can figure out all the register contents for you if you unwind until
it hits user space. This will require a kernel built with CONFIG_STACK_UNWIND.

There are also still some quirks with it, but for ioctls it should
work.

-Andi

      reply	other threads:[~2006-08-28 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-28 17:37 RBP save and restore on x86-64 system calls Hanson, Jonathan M
2006-08-28 19:16 ` Andi Kleen [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=p733bbg7jru.fsf@verdi.suse.de \
    --to=ak@suse.de \
    --cc=jonathan.m.hanson@intel.com \
    --cc=linux-kernel@vger.kernel.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