Add support for Semihosting v2 support for ARM in libgloss.

Semihosting v2 changes are documented here:
https://developer.arm.com/docs/100863/latest/

The biggest change is the addition of an extensions mechanism
to add more extensions in the future.

Signed-off-by: Tamar Christina <tamar.christina@arm.com>
This commit is contained in:
Tamar Christina
2017-07-05 13:04:07 +01:00
committed by Corinna Vinschen
parent cc142edbe7
commit d7d6ad7b6b
3 changed files with 230 additions and 64 deletions

View File

@ -10,15 +10,36 @@ _kill (int pid, int sig)
(void) pid; (void) sig;
#ifdef ARM_RDI_MONITOR
/* Note: The pid argument is thrown away. */
int block[2];
block[1] = sig;
int insn;
#if SEMIHOST_V2
if (_has_ext_exit_extended ())
{
insn = AngelSWI_Reason_ReportExceptionExtended;
}
else
#endif
{
insn = AngelSWI_Reason_ReportException;
}
switch (sig)
{
case SIGABRT:
return do_AngelSWI (AngelSWI_Reason_ReportException,
(void *) ADP_Stopped_RunTimeError);
{
block[0] = ADP_Stopped_RunTimeError;
break;
}
default:
return do_AngelSWI (AngelSWI_Reason_ReportException,
(void *) ADP_Stopped_ApplicationExit);
{
block[0] = ADP_Stopped_ApplicationExit;
break;
}
}
return do_AngelSWI (insn, block);
#else
asm ("swi %a0" :: "i" (SWI_Exit));
#endif