From: Youling Tang <tangyouling@loongson.cn>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org, Mark@sourceware.org,
Wielaard@sourceware.org, Hengqi Chen <hengqi.chen@gmail.com>,
Liwei Ge <geliwei@openanolis.org>
Subject: Re: [PATCH 2/5] backends: Add set_initial_registers_tid callback for LoongArch
Date: Tue, 9 May 2023 09:38:42 +0800 [thread overview]
Message-ID: <996e8d86-c477-a566-1fb9-3d2acc1b9537@loongson.cn> (raw)
In-Reply-To: <d6110109-f44f-6e2a-e56a-4e76a6c36ebf@loongson.cn>
On 05/09/2023 09:32 AM, Youling Tang wrote:
> Hi, Mark
>
> On 05/09/2023 03:57 AM, Mark Wielaard wrote:
>> Him
>>
>> On Fri, Apr 07, 2023 at 10:59:25AM +0800, Youling Tang wrote:
>>> This patch implements the set_initial_registers_tid hook for LoongArch.
>>
>> Looks good, but one question:
>>
>>> + /* Floating-point registers (only 64bits are used). */
>>> + struct user_fp_struct fregs;
>>> + iovec.iov_base = &fregs;
>>> + iovec.iov_len = sizeof (fregs);
>>> + if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0)
>>> + return false;
>>> +
>>> + Dwarf_Word dwarf_fregs[32];
>>> + for (int r = 0; r < 32; r++)
>>> + dwarf_fregs[r] = fregs.fpr[r] & 0xFFFFFFFF;
>>
>> The comment says 64bits, but the mask is for 32bits.
>> I assume the comment is wrong and the masking is deliberate?
>
> Thanks for pointing out that there is no need to mask the lower 32 bits
> here.
>
> It can be modified as follows,
> --- a/backends/loongarch_initreg.c
> +++ b/backends/loongarch_initreg.c
> @@ -79,11 +79,8 @@ loongarch_set_initial_registers_tid (pid_t tid
> __attribute__ ((unused)),
> if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0)
> return false;
>
> - Dwarf_Word dwarf_fregs[32];
> - for (int r = 0; r < 32; r++)
> - dwarf_fregs[r] = fregs.fpr[r] & 0xFFFFFFFF;
> -
> - if (! setfunc (32, 32, dwarf_fregs, arg))
> + /* $f0-$f31 */
> + if (! setfunc (32, 32, &fregs.fpr[0], arg))
Need to add `(Dwarf_Word *)`,
if (! setfunc (32, 32, (Dwarf_Word *) &fregs. fpr[0], arg))
>
> Do I need to send the v2 patchset again?
>
> Thanks,
> Youling.
>
>>
>> Cheers,
>>
>> Mark
>>
next prev parent reply other threads:[~2023-05-09 1:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 2:59 [PATCH 0/5] Improve LoongArch support Youling Tang
2023-04-07 2:59 ` [PATCH 1/5] backends: Add abi_cfi and register_info callbacks for LoongArch Youling Tang
2023-05-08 19:48 ` Mark Wielaard
2023-04-07 2:59 ` [PATCH 2/5] backends: Add set_initial_registers_tid callback " Youling Tang
2023-05-08 19:57 ` Mark Wielaard
2023-05-09 1:32 ` Youling Tang
2023-05-09 1:38 ` Youling Tang [this message]
2023-05-09 9:57 ` Mark Wielaard
2023-04-07 2:59 ` [PATCH 3/5] backends: Add initial return value location support " Youling Tang
2023-05-08 20:04 ` Mark Wielaard
2023-04-07 2:59 ` [PATCH 4/5] backends: Add frame pointer unwinding " Youling Tang
2023-05-08 20:06 ` Mark Wielaard
2023-04-07 2:59 ` [PATCH 5/5] backends: Add core_note callback " Youling Tang
2023-05-08 20:15 ` Mark Wielaard
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=996e8d86-c477-a566-1fb9-3d2acc1b9537@loongson.cn \
--to=tangyouling@loongson.cn \
--cc=Mark@sourceware.org \
--cc=Wielaard@sourceware.org \
--cc=elfutils-devel@sourceware.org \
--cc=geliwei@openanolis.org \
--cc=hengqi.chen@gmail.com \
--cc=mark@klomp.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).