Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: drow@false.org (Daniel Jacobowitz)
Cc: emi-suzuki@tjsys.co.jp (Emi SUZUKI), gdb-patches@sourceware.org
Subject: Re: [rfc] [2/4] SPU overlay support: The SPU target part
Date: Thu, 10 May 2007 22:20:00 -0000	[thread overview]
Message-ID: <200705102220.l4AMK6Ug007110@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20070510215500.GC3187@caradoc.them.org> from "Daniel Jacobowitz" at May 10, 2007 05:55:00 PM

Daniel Jacobowitz wrote:

> (I'm not sure how this ends up detecting an overlay return stub, but
> I'll take your word for it.)

On the SPU, every register is a 16-byte vector register, and that
includes the "link register" 0.  As addresses are only 32 bit
(actually only 18 bit), only the first of four 32-bit slots in
the link register is used to hold the return address.  However,
the whole 128-bit register is always saved/restored on the stack.

This makes it possible to use the remaining slots to hold additional
information needed to handle return jumps crossing an overlay 
boundary.  In those cases, the slots are set up to hold:
  [0] Return stub entry point in the overlay manager
  [1] Partition number of the overlay section to be returned to
  [2] Actual return address in the (restored) overlay section

Thus, when the normal function return is executed, control will
"return" to the overlay manager, which can examine the remaining
slots to determine which overlay section to swap in, and then
transfer control to the actual return address.

What the PC unwinder code does when it sees an unwound link
register of that form is to set the PC to the value in slot 2
of the link register, instead of slot 0 as usual.

Note that there is no stack frame associated with the return
stub at all.

> This is clever, but kind of sneaky.  We show signal return trampolines
> and dummy call trampolines, so I'm not sure why it's necessary to
> hide overlay return stubs.  Do you think this is more useful than
> confusing?

Both signal return and dummy call trampolines are entities the
user actually knows about and wants to see.  The overlay mechanism
is supposed to be fully transparent to the user; I'd compare the
overlay call and return stubs to things like PLT stubs in ELF
-- we don't show those either.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2007-05-10 22:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-07 22:26 Ulrich Weigand
2007-05-08  8:10 ` Emi SUZUKI
2007-05-08 12:40   ` Ulrich Weigand
2007-05-10 21:55     ` Daniel Jacobowitz
2007-05-10 22:20       ` Ulrich Weigand [this message]
2007-05-11 17:32         ` Daniel Jacobowitz
2007-05-11 19:09           ` Ulrich Weigand
2007-05-11 19:33             ` Daniel Jacobowitz

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=200705102220.l4AMK6Ug007110@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=drow@false.org \
    --cc=emi-suzuki@tjsys.co.jp \
    --cc=gdb-patches@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