diff --git a/arch/arm/src/armv6-m/arm_fullcontextrestore.S b/arch/arm/src/armv6-m/arm_fullcontextrestore.S index 7b926ea54ac..6d6aba655c6 100644 --- a/arch/arm/src/armv6-m/arm_fullcontextrestore.S +++ b/arch/arm/src/armv6-m/arm_fullcontextrestore.S @@ -71,7 +71,7 @@ arm_fullcontextrestore: mov r1, r0 /* R1: regs */ mov r0, #SYS_restore_context /* R0: restore context */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* This call should not return */ diff --git a/arch/arm/src/armv6-m/arm_saveusercontext.S b/arch/arm/src/armv6-m/arm_saveusercontext.S index a47e90fe7dd..336ba254979 100644 --- a/arch/arm/src/armv6-m/arm_saveusercontext.S +++ b/arch/arm/src/armv6-m/arm_saveusercontext.S @@ -73,7 +73,7 @@ arm_saveusercontext: mov r1, r0 /* R1: regs */ mov r0, #SYS_save_context /* R0: save context (also return value) */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* There are two return conditions. On the first return, R0 (the * return value will be zero. On the second return we need to diff --git a/arch/arm/src/armv6-m/arm_signal_handler.S b/arch/arm/src/armv6-m/arm_signal_handler.S index 7f2df841417..1cb104920da 100644 --- a/arch/arm/src/armv6-m/arm_signal_handler.S +++ b/arch/arm/src/armv6-m/arm_signal_handler.S @@ -95,7 +95,7 @@ up_signal_handler: /* Execute the SYS_signal_handler_return SVCall (will not return) */ mov r0, #SYS_signal_handler_return - svc 0 + svc #SYS_syscall nop .size up_signal_handler, .-up_signal_handler diff --git a/arch/arm/src/armv6-m/arm_svcall.c b/arch/arm/src/armv6-m/arm_svcall.c index e86f3fe0654..d7b5430c9d8 100644 --- a/arch/arm/src/armv6-m/arm_svcall.c +++ b/arch/arm/src/armv6-m/arm_svcall.c @@ -33,10 +33,6 @@ #include #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif - #include "signal/signal.h" #include "svcall.h" #include "exc_return.h" diff --git a/arch/arm/src/armv6-m/arm_switchcontext.S b/arch/arm/src/armv6-m/arm_switchcontext.S index 651033ca741..5dfc9c09c9e 100644 --- a/arch/arm/src/armv6-m/arm_switchcontext.S +++ b/arch/arm/src/armv6-m/arm_switchcontext.S @@ -73,7 +73,7 @@ arm_switchcontext: mov r2, r1 /* R2: restoreregs */ mov r1, r0 /* R1: saveregs */ mov r0, #SYS_switch_context /* R0: context switch */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* We will get here only after the rerturn from the context switch */ diff --git a/arch/arm/src/armv6-m/svcall.h b/arch/arm/src/armv6-m/svcall.h index 74dff16ed19..7f2f45f5592 100644 --- a/arch/arm/src/armv6-m/svcall.h +++ b/arch/arm/src/armv6-m/svcall.h @@ -27,9 +27,7 @@ #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif +#include /**************************************************************************** * Pre-processor Definitions diff --git a/arch/arm/src/armv7-a/arm_fullcontextrestore.S b/arch/arm/src/armv7-a/arm_fullcontextrestore.S index b80820d38ac..8f5b26486d4 100644 --- a/arch/arm/src/armv7-a/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-a/arm_fullcontextrestore.S @@ -96,11 +96,11 @@ arm_fullcontextrestore: * to either user or kernel mode. */ - /* Perform the System call with R0=SYS_context_restore, R1=restoreregs */ + /* Perform the System call with R0=1 and R1=regs */ - mov r1, r0 /* R1: restoreregs */ - mov r0, #SYS_context_restore /* R0: SYS_context_restore syscall */ - svc #0x900001 /* Perform the system call */ + mov r1, r0 /* R1: regs */ + mov r0, #SYS_restore_context /* R0: restore context */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* This call should not return */ diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c index b7be60b3132..ea6b31ee18d 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -219,19 +218,19 @@ uint32_t *arm_syscall(uint32_t *regs) } break; - /* R0=SYS_context_restore: Restore task context + /* R0=SYS_restore_context: Restore task context * * void arm_fullcontextrestore(uint32_t *restoreregs) * noreturn_function; * * At this point, the following values are saved in context: * - * R0 = SYS_context_restore + * R0 = SYS_restore_context * R1 = restoreregs */ #ifdef CONFIG_BUILD_KERNEL - case SYS_context_restore: + case SYS_restore_context: { /* Replace 'regs' with the pointer to the register set in * regs[REG_R1]. On return from the system call, that register diff --git a/arch/arm/src/armv7-a/crt0.c b/arch/arm/src/armv7-a/crt0.c index d85484151c1..a372868857d 100644 --- a/arch/arm/src/armv7-a/crt0.c +++ b/arch/arm/src/armv7-a/crt0.c @@ -78,7 +78,8 @@ static void sig_trampoline(void) " pop {r2}\n" /* Recover LR in R2 */ " mov lr, r2\n" /* Restore LR */ " mov r0, #5\n" /* SYS_signal_handler_return */ - " svc #0x900001\n" /* Return from the signal handler */ + " svc %0\n" /* Return from the SYSCALL */ + ::"i"(SYS_syscall) ); } diff --git a/arch/arm/src/armv7-a/svcall.h b/arch/arm/src/armv7-a/svcall.h index f0b2017430e..f0bb70013b2 100644 --- a/arch/arm/src/armv7-a/svcall.h +++ b/arch/arm/src/armv7-a/svcall.h @@ -27,9 +27,7 @@ #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif +#include #ifdef CONFIG_LIB_SYSCALL @@ -73,7 +71,7 @@ * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function; */ -#define SYS_context_restore (1) +#define SYS_restore_context (1) /* SYS call 2: * diff --git a/arch/arm/src/armv7-m/arm_svcall.c b/arch/arm/src/armv7-m/arm_svcall.c index e4c749fcb9e..2112ea794a5 100644 --- a/arch/arm/src/armv7-m/arm_svcall.c +++ b/arch/arm/src/armv7-m/arm_svcall.c @@ -34,10 +34,6 @@ #include #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif - #include "signal/signal.h" #include "svcall.h" #include "exc_return.h" diff --git a/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S b/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S index 082ef72890d..697ab1e3a4b 100644 --- a/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S @@ -70,7 +70,7 @@ arm_fullcontextrestore: mov r1, r0 /* R1: regs */ mov r0, #SYS_restore_context /* R0: restore context */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* This call should not return */ diff --git a/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S b/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S index a1c515ddf90..013d5f18f6b 100644 --- a/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S +++ b/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S @@ -72,7 +72,7 @@ arm_saveusercontext: mov r1, r0 /* R1: regs */ mov r0, #SYS_save_context /* R0: save context (also return value) */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* There are two return conditions. On the first return, R0 (the * return value will be zero. On the second return we need to diff --git a/arch/arm/src/armv7-m/gnu/arm_signal_handler.S b/arch/arm/src/armv7-m/gnu/arm_signal_handler.S index 207a1b38928..771a28d5f2b 100644 --- a/arch/arm/src/armv7-m/gnu/arm_signal_handler.S +++ b/arch/arm/src/armv7-m/gnu/arm_signal_handler.S @@ -94,7 +94,7 @@ up_signal_handler: /* Execute the SYS_signal_handler_return SVCall (will not return) */ mov r0, #SYS_signal_handler_return - svc 0 + svc #SYS_syscall nop .size up_signal_handler, .-up_signal_handler diff --git a/arch/arm/src/armv7-m/gnu/arm_switchcontext.S b/arch/arm/src/armv7-m/gnu/arm_switchcontext.S index 46e8150a9a4..083957059ca 100644 --- a/arch/arm/src/armv7-m/gnu/arm_switchcontext.S +++ b/arch/arm/src/armv7-m/gnu/arm_switchcontext.S @@ -72,7 +72,7 @@ arm_switchcontext: mov r2, r1 /* R2: restoreregs */ mov r1, r0 /* R1: saveregs */ mov r0, #SYS_switch_context /* R0: context switch */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* We will get here only after the rerturn from the context switch */ diff --git a/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S b/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S index af6354d0c9a..61063e2726f 100644 --- a/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S @@ -70,7 +70,7 @@ arm_fullcontextrestore: mov r1, r0 /* R1: regs */ mov r0, #SYS_restore_context /* R0: restore context */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* This call should not return */ diff --git a/arch/arm/src/armv7-m/iar/arm_saveusercontext.S b/arch/arm/src/armv7-m/iar/arm_saveusercontext.S index c8128246db1..08817a849b1 100644 --- a/arch/arm/src/armv7-m/iar/arm_saveusercontext.S +++ b/arch/arm/src/armv7-m/iar/arm_saveusercontext.S @@ -71,7 +71,7 @@ arm_saveusercontext: mov r1, r0 /* R1: regs */ mov r0, #SYS_save_context /* R0: save context (also return value) */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* There are two return conditions. On the first return, R0 (the * return value will be zero. On the second return we need to diff --git a/arch/arm/src/armv7-m/iar/arm_switchcontext.S b/arch/arm/src/armv7-m/iar/arm_switchcontext.S index c5322905bc8..d038faf2810 100644 --- a/arch/arm/src/armv7-m/iar/arm_switchcontext.S +++ b/arch/arm/src/armv7-m/iar/arm_switchcontext.S @@ -72,7 +72,7 @@ arm_switchcontext: mov r2, r1 /* R2: restoreregs */ mov r1, r0 /* R1: saveregs */ mov r0, #SYS_switch_context /* R0: context switch */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* We will get here only after the rerturn from the context switch */ diff --git a/arch/arm/src/armv7-m/svcall.h b/arch/arm/src/armv7-m/svcall.h index a5e94972a0e..9f3b9776a4f 100644 --- a/arch/arm/src/armv7-m/svcall.h +++ b/arch/arm/src/armv7-m/svcall.h @@ -27,9 +27,7 @@ #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif +#include /**************************************************************************** * Pre-processor Definitions diff --git a/arch/arm/src/armv7-r/arm_fullcontextrestore.S b/arch/arm/src/armv7-r/arm_fullcontextrestore.S index 93580bf6410..bb4cb15cd9b 100644 --- a/arch/arm/src/armv7-r/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-r/arm_fullcontextrestore.S @@ -100,11 +100,11 @@ arm_fullcontextrestore: * to either user or kernel mode. */ - /* Perform the System call with R0=SYS_context_restore, R1=restoreregs */ + /* Perform the System call with R0=1 and R1=regs */ - mov r1, r0 /* R1: restoreregs */ - mov r0, #SYS_context_restore /* R0: SYS_context_restore syscall */ - svc #0x900001 /* Perform the system call */ + mov r1, r0 /* R1: regs */ + mov r0, #SYS_restore_context /* R0: restore context */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* This call should not return */ diff --git a/arch/arm/src/armv7-r/arm_signal_handler.S b/arch/arm/src/armv7-r/arm_signal_handler.S index 7adebda1f99..c322a692d7e 100644 --- a/arch/arm/src/armv7-r/arm_signal_handler.S +++ b/arch/arm/src/armv7-r/arm_signal_handler.S @@ -95,7 +95,7 @@ up_signal_handler: /* Execute the SYS_signal_handler_return SVCall (will not return) */ mov r0, #SYS_signal_handler_return - svc 0 + svc #SYS_syscall nop .size up_signal_handler, .-up_signal_handler diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c index e9192dd436f..ff49468682d 100644 --- a/arch/arm/src/armv7-r/arm_syscall.c +++ b/arch/arm/src/armv7-r/arm_syscall.c @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -214,19 +213,19 @@ uint32_t *arm_syscall(uint32_t *regs) } break; - /* R0=SYS_context_restore: Restore task context + /* R0=SYS_restore_context: Restore task context * * void arm_fullcontextrestore(uint32_t *restoreregs) * noreturn_function; * * At this point, the following values are saved in context: * - * R0 = SYS_context_restore + * R0 = SYS_restore_context * R1 = restoreregs */ #ifdef CONFIG_BUILD_PROTECTED - case SYS_context_restore: + case SYS_restore_context: { /* Replace 'regs' with the pointer to the register set in * regs[REG_R1]. On return from the system call, that register diff --git a/arch/arm/src/armv7-r/svcall.h b/arch/arm/src/armv7-r/svcall.h index 0b9a0499953..ffd87371341 100644 --- a/arch/arm/src/armv7-r/svcall.h +++ b/arch/arm/src/armv7-r/svcall.h @@ -27,9 +27,7 @@ #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif +#include #ifdef CONFIG_LIB_SYSCALL @@ -74,7 +72,7 @@ * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function; */ -#define SYS_context_restore (1) +#define SYS_restore_context (1) /* SYS call 2: * diff --git a/arch/arm/src/armv8-m/arm_fullcontextrestore.S b/arch/arm/src/armv8-m/arm_fullcontextrestore.S index 09fb92625ea..62e47fac93d 100644 --- a/arch/arm/src/armv8-m/arm_fullcontextrestore.S +++ b/arch/arm/src/armv8-m/arm_fullcontextrestore.S @@ -70,7 +70,7 @@ arm_fullcontextrestore: mov r1, r0 /* R1: regs */ mov r0, #SYS_restore_context /* R0: restore context */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* This call should not return */ diff --git a/arch/arm/src/armv8-m/arm_saveusercontext.S b/arch/arm/src/armv8-m/arm_saveusercontext.S index c473b535053..2620abf1492 100644 --- a/arch/arm/src/armv8-m/arm_saveusercontext.S +++ b/arch/arm/src/armv8-m/arm_saveusercontext.S @@ -72,7 +72,7 @@ arm_saveusercontext: mov r1, r0 /* R1: regs */ mov r0, #SYS_save_context /* R0: save context (also return value) */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* There are two return conditions. On the first return, R0 (the * return value will be zero. On the second return we need to diff --git a/arch/arm/src/armv8-m/arm_signal_handler.S b/arch/arm/src/armv8-m/arm_signal_handler.S index 234ce914859..684b64aa96f 100644 --- a/arch/arm/src/armv8-m/arm_signal_handler.S +++ b/arch/arm/src/armv8-m/arm_signal_handler.S @@ -94,7 +94,7 @@ up_signal_handler: /* Execute the SYS_signal_handler_return SVCall (will not return) */ mov r0, #SYS_signal_handler_return - svc 0 + svc #SYS_syscall nop .size up_signal_handler, .-up_signal_handler diff --git a/arch/arm/src/armv8-m/arm_svcall.c b/arch/arm/src/armv8-m/arm_svcall.c index dd3c9df2c26..ed28937e1b5 100644 --- a/arch/arm/src/armv8-m/arm_svcall.c +++ b/arch/arm/src/armv8-m/arm_svcall.c @@ -33,10 +33,6 @@ #include #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif - #include "signal/signal.h" #include "svcall.h" #include "exc_return.h" diff --git a/arch/arm/src/armv8-m/arm_switchcontext.S b/arch/arm/src/armv8-m/arm_switchcontext.S index 70cd683bc53..ae812f9a48e 100644 --- a/arch/arm/src/armv8-m/arm_switchcontext.S +++ b/arch/arm/src/armv8-m/arm_switchcontext.S @@ -72,7 +72,7 @@ arm_switchcontext: mov r2, r1 /* R2: restoreregs */ mov r1, r0 /* R1: saveregs */ mov r0, #SYS_switch_context /* R0: context switch */ - svc 0 /* Force synchronous SVCall (or Hard Fault) */ + svc #SYS_syscall /* Force synchronous SVCall (or Hard Fault) */ /* We will get here only after the rerturn from the context switch */ diff --git a/arch/arm/src/armv8-m/svcall.h b/arch/arm/src/armv8-m/svcall.h index fe28edb7436..77a1f9257eb 100644 --- a/arch/arm/src/armv8-m/svcall.h +++ b/arch/arm/src/armv8-m/svcall.h @@ -27,9 +27,7 @@ #include -#ifdef CONFIG_LIB_SYSCALL -# include -#endif +#include /**************************************************************************** * Pre-processor Definitions