From: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
To: iNvEr7 <iNvEr7@protonmail.com>,
"newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: [PATCH] Semihosting ctr0 typo (adr/ldr)?
Date: Wed, 17 Feb 2021 11:22:53 +0000 [thread overview]
Message-ID: <28425b94-60e9-b6b5-7f95-613937995044@foss.arm.com> (raw)
In-Reply-To: <YCzphQJPQ1zuLXA3@calimero.vinschen.de>
On 17/02/2021 10:01, Corinna Vinschen wrote:
> On Feb 16 22:56, iNvEr7 via Newlib wrote:
>>
>> ---
>> libgloss/arm/crt0.S | 2 +-
>> newlib/libc/sys/arm/crt0.S | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
>> index 8490bde2f..b8bbcee18 100644
>> --- a/libgloss/arm/crt0.S
>> +++ b/libgloss/arm/crt0.S
>> @@ -283,7 +283,7 @@
>> #ifdef ARM_RDI_MONITOR
>> /* Issue Angel SWI to read stack info. */
>> movs r0, #AngelSWI_Reason_HeapInfo
>> - adr r1, .LC0 /* Point at ptr to 4 words to receive data. */
>> + ldr r1, .LC0 /* Point at ptr to 4 words to receive data. */
>> #ifdef THUMB_VXM
>> bkpt AngelSWI
>> #elif defined(__thumb2__)
>> diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S
>> index 5e677a23c..3c5771229 100644
>> --- a/newlib/libc/sys/arm/crt0.S
>> +++ b/newlib/libc/sys/arm/crt0.S
>> @@ -270,7 +270,7 @@
>> #ifdef ARM_RDI_MONITOR
>> /* Issue Angel SWI to read stack info. */
>> movs r0, #AngelSWI_Reason_HeapInfo
>> - adr r1, .LC0 /* Point at ptr to 4 words to receive data. */
>> + ldr r1, .LC0 /* Point at ptr to 4 words to receive data. */
>> #ifdef THUMB_VXM
>> bkpt AngelSWI
>> #elif defined(__thumb2__)
>> --
>> 2.29.2
>
> I'm a bit suprised that this problem hasn't been noticed for the
> last 10 years. I'm not familiar with the ARM stuff at all, so maybe
> somebody from ARM can chime in here?
>
>
> Thanks,
> Corinna
>
No, I don't think that is right, but it took some digging to be sure.
The specification for the HeapInfo syscall is here:
https://developer.arm.com/documentation/100863/0300/Semihosting-operations/SYS-HEAPINFO--0x16-?lang=en
and it says that the parameter is the /address of a pointer/ to the
4-word block. In other words, it is not the address of the block itself.
It's odd that it is defined this way, but I think the code is doing what
the specification says. Certainly the comments in the code seem to
reflect this.
R.
next prev parent reply other threads:[~2021-02-17 11:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-16 22:56 iNvEr7
2021-02-17 10:01 ` Corinna Vinschen
2021-02-17 11:22 ` Richard Earnshaw [this message]
2021-02-17 12:02 ` iNvEr7
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=28425b94-60e9-b6b5-7f95-613937995044@foss.arm.com \
--to=richard.earnshaw@foss.arm.com \
--cc=iNvEr7@protonmail.com \
--cc=newlib@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).