Re: Arm semihosting v2 implementation isn't complete

Alexander Fedotov <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAN8C2Co=xOnHH_9FvnvNZVkUjLor4BKJu93QT2M2nNnjpq8N7g@mail.gmail.com>
I suggest following patch:

On Tue, Dec 18, 2018 at 5:12 PM Alexander Fedotov <[email protected]> wrote:
>
> Hi Tamar
>
> I see HLT only in comments, not in defines:
>
> #ifdef THUMB_VXM
>   #define AngelSWIInsn            "bkpt"
>   #define AngelSWIAsm            bkpt
> #else
>   #define AngelSWIInsn            "swi"
>   #define AngelSWIAsm            swi
> #endif
>
>
> On Tue, Dec 18, 2018 at 4:50 PM Tamar Christina <[email protected]> wrote:
> >
> > Hi Alex
> >
> > > -----Original Message-----
> > > From: [email protected] <[email protected]> On
> > > Behalf Of Alexander Fedotov
> > > Sent: Tuesday, December 18, 2018 13:08
> > > To: Newlib <[email protected]>
> > > Subject: Arm semihosting v2 implementation isn't complete
> > >
> > > Hi all
> > >
> > > I see that number of commits were dedicated to changes for Arm
> > > Semihosting v2 specification that states:
> > > ARM encourages semihosting callers to implement support for trapping using
> > > HLT on A32 and T32 as a configurable option. ARM strongly discourages
> > > semihosting callers from mixing the HLT and SVC mechanisms within the
> > > same executable.
> > >
> > > At the moment there is no HLT instruction used in libgloss/arm.
> >
> > There is, see swi.h, we don't support mixing of HLT and SVC (as mentioned in the specification bit you quoted) so they are in different libraries.
> > HLT is used when you used the MIXED_MODE spec files. E.g. aprofile-validation-v2m.specs will use HLT and aprofile-validation.specs uses SVC.
> >
> > Regards,
> > Tamar
> >
> > >
> > > So the question is: is there any reason to not have HLT right now ?
> > >
> > > Alex
>
>
>
> --
> Best regards,
> AF



-- 
Best regards,
AF
0001-Use-HLT-instruction-for-ARMv8-according-to-Arm-Semih.patch (application/octet-stream, 744 B)
From 2b3cce5b1bf23a45a0efd33122cadd6ce18260b9 Mon Sep 17 00:00:00 2001
From: Alexander Fedotov <[email protected]>
Date: Tue, 18 Dec 2018 09:06:55 -0600
Subject: [PATCH] Use HLT instruction for ARMv8 according to Arm Semihosting v2
 specification.

---
 libgloss/arm/swi.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libgloss/arm/swi.h b/libgloss/arm/swi.h
index 67eb36b3f..ac3295c8b 100644
--- a/libgloss/arm/swi.h
+++ b/libgloss/arm/swi.h
@@ -50,6 +50,9 @@
 #ifdef THUMB_VXM
   #define AngelSWIInsn			"bkpt"
   #define AngelSWIAsm			bkpt
+#elif defined (SEMIHOST_V2) && (__ARM_ARCH == 8)
+  #define AngelSWIInsn			"hlt"
+  #define AngelSWIAsm			hlt
 #else
   #define AngelSWIInsn			"swi"
   #define AngelSWIAsm			swi
-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.