diff --git a/arch/arm/include/arm/syscall.h b/arch/arm/include/arm/syscall.h index 5b011dbe38..d3321cbd42 100644 --- a/arch/arm/include/arm/syscall.h +++ b/arch/arm/include/arm/syscall.h @@ -56,6 +56,12 @@ #define SYS_syscall 0x900001 +#if defined(__thumb__) || defined(__thumb2__) +# define SYS_smhcall 0xab +#else +# define SYS_smhcall 0x123456 +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -226,16 +232,12 @@ static inline long smh_call(unsigned int nbr, void *parm) register long reg1 __asm__("r1") = (long)(parm); __asm__ __volatile__ - ( -#if defined(__thumb__) || defined(__thumb2__) - "svc #0xab" -#else - "svc #0x123456" -#endif + ( + "svc %1" : "=r"(reg0) - : "r"(reg0), "r"(reg1) - : "memory" - ); + : "i"(SYS_smhcall), "r"(reg0), "r"(reg1) + : "memory", "r14" + ); return reg0; } diff --git a/arch/arm/include/armv6-m/syscall.h b/arch/arm/include/armv6-m/syscall.h index d16ab9da6e..9c5eca2b9a 100644 --- a/arch/arm/include/armv6-m/syscall.h +++ b/arch/arm/include/armv6-m/syscall.h @@ -59,6 +59,7 @@ */ #define SYS_syscall 0x00 +#define SYS_smhcall 0xab /* The SYS_signal_handler_return is executed here... its value is not always * available in this context and so is assumed to be 7. @@ -250,9 +251,9 @@ static inline long smh_call(unsigned int nbr, void *parm) __asm__ __volatile__ ( - "bkpt #0xab" + "bkpt %1" : "=r"(reg0) - : "r"(reg0), "r"(reg1) + : "i"(SYS_smhcall), "r"(reg0), "r"(reg1) : "memory" ); diff --git a/arch/arm/include/armv7-a/syscall.h b/arch/arm/include/armv7-a/syscall.h index 5682fc4a4f..69538f4e81 100644 --- a/arch/arm/include/armv7-a/syscall.h +++ b/arch/arm/include/armv7-a/syscall.h @@ -56,6 +56,12 @@ #define SYS_syscall 0x900001 +#if defined(__thumb__) || defined(__thumb2__) +# define SYS_smhcall 0xab +#else +# define SYS_smhcall 0x123456 +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -227,14 +233,10 @@ static inline long smh_call(unsigned int nbr, void *parm) __asm__ __volatile__ ( -#if defined(__thumb__) || defined(__thumb2__) - "svc #0xab" -#else - "svc #0x123456" -#endif + "svc %1" : "=r"(reg0) - : "r"(reg0), "r"(reg1) - : "memory" + : "i"(SYS_smhcall), "r"(reg0), "r"(reg1) + : "memory", "r14" ); return reg0; diff --git a/arch/arm/include/armv7-m/syscall.h b/arch/arm/include/armv7-m/syscall.h index 09981fc4ea..41b2bb001c 100644 --- a/arch/arm/include/armv7-m/syscall.h +++ b/arch/arm/include/armv7-m/syscall.h @@ -59,6 +59,7 @@ */ #define SYS_syscall 0x00 +#define SYS_smhcall 0xab /* The SYS_signal_handler_return is executed here... its value is not always * available in this context and so is assumed to be 7. @@ -250,9 +251,9 @@ static inline long smh_call(unsigned int nbr, void *parm) __asm__ __volatile__ ( - "bkpt #0xab" + "bkpt %1" : "=r"(reg0) - : "r"(reg0), "r"(reg1) + : "i"(SYS_smhcall), "r"(reg0), "r"(reg1) : "memory" ); diff --git a/arch/arm/include/armv7-r/syscall.h b/arch/arm/include/armv7-r/syscall.h index ba9378ce82..3d8990fa03 100644 --- a/arch/arm/include/armv7-r/syscall.h +++ b/arch/arm/include/armv7-r/syscall.h @@ -56,6 +56,12 @@ #define SYS_syscall 0x900001 +#if defined(__thumb__) || defined(__thumb2__) +# define SYS_smhcall 0xab +#else +# define SYS_smhcall 0x123456 +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -227,14 +233,10 @@ static inline long smh_call(unsigned int nbr, void *parm) __asm__ __volatile__ ( -#if defined(__thumb__) || defined(__thumb2__) - "svc #0xab" -#else - "svc #0x123456" -#endif + "svc %1" : "=r"(reg0) - : "r"(reg0), "r"(reg1) - : "memory" + : "i"(SYS_smhcall), "r"(reg0), "r"(reg1) + : "memory", "r14" ); return reg0;