arch/arm: Replace the hardcode syscall number with macro
and change SYS_context_[save|restore] to SYS_[save|restore]_context Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
7de43596da
commit
e7dffdf06f
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -33,10 +33,6 @@
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
#include "signal/signal.h"
|
||||
#include "svcall.h"
|
||||
#include "exc_return.h"
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <syscall.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -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
|
||||
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
|
||||
#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:
|
||||
*
|
||||
|
@ -34,10 +34,6 @@
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
#include "signal/signal.h"
|
||||
#include "svcall.h"
|
||||
#include "exc_return.h"
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <syscall.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -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
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
|
||||
#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:
|
||||
*
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -33,10 +33,6 @@
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
#include "signal/signal.h"
|
||||
#include "svcall.h"
|
||||
#include "exc_return.h"
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
Loading…
Reference in New Issue
Block a user