From: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
To: <gdb-patches@sourceware.org>
Subject: Re: [RFC PATCH 1/5] gdb/arm: Introduce control_s and control_ns registers
Date: Tue, 8 Nov 2022 17:48:45 +0100 [thread overview]
Message-ID: <ee275b95-4b97-66bb-540e-d901239a3343@foss.st.com> (raw)
In-Reply-To: <3d6331d0-d1b3-03f7-0b2c-97b0784fa31e@fbl.cz>
On 2022-11-08 16:52, Tomas Vanek wrote:
> Hi Luis,
>
> On 08/11/2022 12:23, Luis Machado wrote:
>> Hi Tomas,
>>
>> On 11/5/22 09:44, Tomas Vanek wrote:
>>> The M-profile security extension registers will be used for stack
>>> selection in FNC_RETURN and return from secure to non-secure state.
>>>
>>> The presence of the registers is optional.
>>> If one or both are missing the security extension profile is accepted.
>>> The code using the registers must check m_profile_control_[n]?s_regnum
>>> for -1.
>>>
>>> Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
>>> ---
>>> gdb/arm-tdep.c | 20 ++++++++++++++++++++
>>> gdb/arm-tdep.h | 2 ++
>>> 2 files changed, 22 insertions(+)
>>>
>>> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
>>> index 3105543..564ee43 100644
>>> --- a/gdb/arm-tdep.c
>>> +++ b/gdb/arm-tdep.c
>>> @@ -9996,6 +9996,8 @@ enum arm_vfp_cprc_base_type
>>> int m_profile_psp_ns_regnum = -1;
>>> int m_profile_msp_s_regnum = -1;
>>> int m_profile_psp_s_regnum = -1;
>>> + int m_profile_control_s_regnum = -1;
>>> + int m_profile_control_ns_regnum = -1;
>>> int tls_regnum = 0;
>>> /* If we have an object to base this architecture on, try to
>>> determine
>>> @@ -10473,6 +10475,22 @@ enum arm_vfp_cprc_base_type
>>> }
>>> m_profile_psp_s_regnum = register_count++;
>>> + /* Regard the control_s and control_ns registers optional,
>>> + * accept the security extension feature even without them */
>>> + valid_p = tdesc_numbered_register (feature, tdesc_data.get
>>> (),
>>> + register_count, "control_s");
>>
>> What tools are advertising control_s and control_ns? We need to
>> document those properly if we're planning on using them
>> as part of decision-making in GDB.
>
> Good question.
>
> OpenOCD exposes them, like other M-profile security extension registers
> they have the feature name "v8-m.sp".
> There is a pending patch to change the feature name to
> "org.gnu.gdb.arm.secext"
> 7265: target/armv7m: fix feature name of ARMv8M security extension regs
> | https://review.openocd.org/c/openocd/+/7265
>
> PyOCD exposes them, like other M-profile security extension registers
> they have the feature name "v8-m.sp".
>
> ST-LINK GDB server. Version 5.6.0 (I assume not the latest version)
> exposes them (and other M-profile security extension registers too)
> in the feature "org.gnu.gdb.arm.vfp"?? Obviously a bug!
This was fixed in 5.9.0 and the latest released version i 7.0.0.
IIRC, SEGGER JLink exposes both CONTROL registers too, but I can't
confirm that right now.
Kind regards,
Torbjörn
prev parent reply other threads:[~2022-11-08 16:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 9:44 Tomas Vanek
2022-11-05 9:44 ` [RFC PATCH 2/5] gdb/arm: PR 29716 Fix FNC_RETURN stack selection in exception unwinder Tomas Vanek
2022-11-11 9:23 ` Luis Machado
2022-11-05 9:44 ` [RFC PATCH 3/5] gdb/dwarf2: Add dwarf2_frame_reg_rule for GDB register number Tomas Vanek
2022-11-05 9:44 ` [RFC PATCH 4/5] gdb/arm: Unwinding of secure procedure with cmse_nonsecure_entry attribute Tomas Vanek
2022-11-05 9:44 ` [RFC PATCH 5/5] HACK frame inner than comparison for Arm M-profile sec ext Tomas Vanek
2022-11-08 11:23 ` [RFC PATCH 1/5] gdb/arm: Introduce control_s and control_ns registers Luis Machado
2022-11-08 15:52 ` Tomas Vanek
2022-11-08 15:58 ` Tomas Vanek
2022-11-09 15:27 ` Luis Machado
2022-11-08 16:48 ` Torbjorn SVENSSON [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=ee275b95-4b97-66bb-540e-d901239a3343@foss.st.com \
--to=torbjorn.svensson@foss.st.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).