From: Yao Qi <qiyaoltc@gmail.com>
To: Steve Ellcey <sellcey@caviumnetworks.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [Patch v2 1/2] Enable ILP32 mode in gdb on aarch64
Date: Thu, 09 Mar 2017 13:24:00 -0000 [thread overview]
Message-ID: <CAH=s-PM6+sjn5MN=qV-z64s0pv1=K=5dX2DR-X4vSgkwgHr+xQ@mail.gmail.com> (raw)
In-Reply-To: <1488916527.22552.8.camel@caviumnetworks.com>
On Tue, Mar 7, 2017 at 7:55 PM, Steve Ellcey <sellcey@caviumnetworks.com> wrote:
> I have been looking at the code and offsets used in aarch64_linux_sigframe_init
> but I haven't had much luck in understanding the layout of the frames or the
> changes needed between the 32 and 64 bit ABIs.
>
> The code has these magic numbers:
> /* These magic numbers need to reflect the layout of the kernel
> defined struct rt_sigframe and ucontext. */
> #define AARCH64_SIGCONTEXT_REG_SIZE 8
> #define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET 128
> #define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET 176
> #define AARCH64_SIGCONTEXT_XO_OFFSET 8
>
> I think AARCH64_SIGCONTEXT_REG_SIZE is OK, registers are still 8 bytes long
> in ILP32 mode.
>
> I am not sure what AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET is supposed to
> represent. Is it the size of the rt_sigframe structure? Or the
> offset from rt_sigframe to the sigframe structure inside of rt_sigframe?
> (i.e. the size of sigframe). I have the same problem with the other
probably because they are magic, :) the comments above these
macros are
The handler then needs to recover the saved register set from
ucontext.uc_mcontext.
to your question, they are about offsets. That is how I get the
offsets (I am not the author of this piece of code), load vmlinux
into gdb, and examine the offsets,
(gdb) ptype struct ucontext
type = struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
sigset_t uc_sigmask;
__u8 __unused[120];
struct sigcontext uc_mcontext;
}
(gdb) p/d &((struct rt_sigframe *) 0)->uc
$8 = 128
it is AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET.
(gdb) p/d &((struct rt_sigframe *) 0)->uc->uc_mcontext
$9 = 304
it is AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
+ AARCH64_UCONTEXT_SIGCONTEXT_OFFSET,
> magic numbers, I am just not sure what they represent. I am also not
> sure if just changing the offset numbers is all that is needed or if
> there is some copying that needs to be done to massage the ILP32 formats
> into the expected layout. I have never done any kernel work and was not
> around when the original aarch64 ILP32 work was done so I am not very
> familiar with the history of all this.
>
Assuming ILP32 kernel patches is correct, you can get these
magic number by loading ILP32 kernel vmlinux, and doing these
steps I do above.
--
Yao (齐尧)
next prev parent reply other threads:[~2017-03-09 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 22:03 Steve Ellcey
2017-03-07 10:20 ` Yao Qi
2017-03-07 19:55 ` Steve Ellcey
2017-03-09 13:24 ` Yao Qi [this message]
2017-03-09 17:33 ` Steve Ellcey
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='CAH=s-PM6+sjn5MN=qV-z64s0pv1=K=5dX2DR-X4vSgkwgHr+xQ@mail.gmail.com' \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=sellcey@caviumnetworks.com \
/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