AArch32: Add support for HLT to Mixed Mode models

The Semihosting v2 protocol requires us to output the Armv8-a HLT instruction
when in mixed mode (SEMIHOST_V2_MIXED_MODE), however it also requires this to
be done for Armv7-a and earlier architectures.

The HLT instruction is defined in the undefined encoding space for older
architectures but simulators such as QEMU already trap on it [1] for all
architectures and is a requirement for semihosting v2 [2].

Unfortunately the GAS restricts the use of HLT to Armv8-a which requires us to
use the instruction encodings we want directly in crt0.

This patch does this, I have not updated newlib/libc/* as that is quite out of
date already.  A proper sync is needed in order to get things back in sync.

A different patch for this would be best.

[1] 19a6e31c9d
[2] https://developer.arm.com/docs/100863/latest/the-semihosting-interface
This commit is contained in:
Tamar Christina
2019-02-06 11:27:12 +00:00
committed by Corinna Vinschen
parent 3956ddd9bf
commit 6d6a623e7d
2 changed files with 13 additions and 7 deletions

View File

@@ -116,10 +116,10 @@
bkpt AngelSWI
#elif defined(__thumb2__)
/* We are in thumb mode for startup on armv7 architectures. */
AngelSWIAsm AngelSWI
AngelSWIAsm (AngelSWI)
#else
/* We are always in ARM mode for startup on pre armv7 archs. */
AngelSWIAsm AngelSWI_ARM
AngelSWIAsm (AngelSWI_ARM)
#endif
ldr r0, .LC0 /* point at values read */
@@ -297,7 +297,7 @@ __change_mode:
#else
movs r0, #AngelSWI_Reason_GetCmdLine
ldr r1, .LC30 /* Space for command line */
AngelSWIAsm AngelSWI
AngelSWIAsm (AngelSWI)
ldr r1, .LC30
ldr r1, [r1]
#endif