This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] x86-64/setcontext: Pop the pointer into %rdx after syscall
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 2 May 2018 01:03:23 -0400
- Subject: Re: [PATCH 1/2] x86-64/setcontext: Pop the pointer into %rdx after syscall
- Openpgp: preference=signencrypt
- References: <20180426121700.GA30766@intel.com> <8b0e9b44-d231-ef32-05a7-5fad5c7352b1@redhat.com>
On 04/29/2018 05:03 PM, Florian Weimer wrote:
> On 04/26/2018 02:17 PM, H.J. Lu wrote:
>> + /* Pop the pointer into RDX which is preserved by the syscall.
>> */ + popq %rdx
>
> Sorry, the comment is a bit unclear. Why do you need to restore %rdx
> if it is preserved by the system call? Maybe it becomes clearer with
> a future change?
I agree with Florian, there is no reason to mention RDX is preserved.
It doesn't matter here.
The reason you use RDX is because later on you want to call arch_prctl
and need to use RDI + RSI to pass arguments, and so it's simple to
already be using RDX for the register offset loads.
If anything a better comment is:
/* Pop the pointer into RDX. The choice is arbitrary, but leaving
RDI and RSI available for use later can avoid shuffling values. */
Otherwise OK with that comment change.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
--
Cheers,
Carlos.