arm: smh: Fix uninitialized parameters with newer GCCs
Newer versions of GCC won't initialize parts of structures which don't
appear to be used. This results in uninitialized semihosting parameters
passed via R1. Fix this by marking the inline assembly as clobbering
memory.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index dbea2b0..01d652a 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -32,12 +32,12 @@
{
register long result asm("r0");
#if defined(CONFIG_ARM64)
- asm volatile ("hlt #0xf000" : "=r" (result) : "0"(sysnum), "r"(addr));
+ asm volatile ("hlt #0xf000" : "=r" (result) : "0"(sysnum), "r"(addr) : "memory");
#elif defined(CONFIG_CPU_V7M)
- asm volatile ("bkpt #0xAB" : "=r" (result) : "0"(sysnum), "r"(addr));
+ asm volatile ("bkpt #0xAB" : "=r" (result) : "0"(sysnum), "r"(addr) : "memory");
#else
/* Note - untested placeholder */
- asm volatile ("svc #0x123456" : "=r" (result) : "0"(sysnum), "r"(addr));
+ asm volatile ("svc #0x123456" : "=r" (result) : "0"(sysnum), "r"(addr) : "memory");
#endif
return result;
}