This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mis-handling of arm semihosting in libgloss/arm/crt0.S


Hi Can,

Sorry for the long delay in replying - I was sidetracked by paying customers....

#define AngelSWI_ARM 			0x123456
#ifdef __thumb__
#define AngelSWI 			0xAB
#else
#define AngelSWI 			AngelSWI_ARM
#endif

So, your patch
+	AngelSWIAsm	AngelSWI
  	ldr	r0, .LC0	/*  point at values read */

will use 0xAB for all thumb state, which is only correct for thumb2
and armv6-m here. Considering thumb state on architecture pre armv6,
as the comment, we are always in ARM mode for startup for these
architectures, and should use 0x123456 for these archs here.

Good point. Presumably this version would work:


  #if defined __thumb__ && ! defined __thumb2__
	/* When in thumb mode, but not supporting thumb2 insns, we will
	   always start execution in ARM mode, so use the ARM mode SWI.  */
	AngelSWIAsm	AngelSWI_ARM
  #else
	AngelSWIAsm	AngelSWI
  #endif

actually found this problem during my work on supporting
armv7-m/armv6-m in libgloss/arm and have already worked out a patch.
Hoping I could pass internal review and send it to newlib list ASAP.
Please help me review it then. :(

Certainly. If you cc me on the posting I will be sure to review it.


Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]