arch/arm/src/include/xxx/syscall.h: Align semi-hosting call style with other syscalls

This commit is contained in:
Xiang Xiao 2019-01-26 07:40:47 -06:00 committed by Gregory Nutt
parent 5a6108c172
commit 9f408e9937
5 changed files with 35 additions and 27 deletions

View File

@ -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;
}

View File

@ -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"
);

View File

@ -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;

View File

@ -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"
);

View File

@ -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;