arch/risc-v: use STACK_FRAME_SIZE for in S-mode syscall asm
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
e88a357fa7
commit
9b7f9867aa
@ -65,6 +65,11 @@
|
||||
# define REGSTORE __STR(sd)
|
||||
#endif
|
||||
|
||||
/* RISC-V requires a 16-byte stack alignment. */
|
||||
|
||||
#define STACK_ALIGNMENT 16
|
||||
#define STACK_FRAME_SIZE __XSTR(STACK_ALIGNMENT)
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
@ -126,11 +126,11 @@
|
||||
|
||||
#if defined (CONFIG_ARCH_USE_S_MODE) && defined (__KERNEL__)
|
||||
# define ASM_SYS_CALL \
|
||||
" addi sp, sp, -16\n" /* Make room */ \
|
||||
REGSTORE " ra, 0(sp)\n" /* Save ra */ \
|
||||
" jal ra, riscv_dispatch_syscall\n" /* Dispatch (modifies ra) */ \
|
||||
REGLOAD " ra, 0(sp)\n" /* Restore ra */ \
|
||||
" addi sp, sp, 16\n" /* Restore sp */
|
||||
" addi sp, sp, -" STACK_FRAME_SIZE "\n" /* Make room */ \
|
||||
REGSTORE " ra, 0(sp)\n" /* Save ra */ \
|
||||
" jal ra, riscv_dispatch_syscall\n" /* Dispatch (modifies ra) */ \
|
||||
REGLOAD " ra, 0(sp)\n" /* Restore ra */ \
|
||||
" addi sp, sp, " STACK_FRAME_SIZE "\n" /* Restore sp */
|
||||
#else
|
||||
# define ASM_SYS_CALL \
|
||||
"ecall"
|
||||
|
@ -33,6 +33,8 @@
|
||||
# include <sys/types.h>
|
||||
# include <stdint.h>
|
||||
# include <syscall.h>
|
||||
#else
|
||||
# include <arch/arch.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -47,11 +49,6 @@
|
||||
#define INTSTACK_COLOR 0xdeadbeef
|
||||
#define HEAP_COLOR 'h'
|
||||
|
||||
/* RISC-V requires a 16-byte stack alignment. */
|
||||
|
||||
#define STACK_ALIGNMENT 16
|
||||
#define STACK_FRAME_SIZE __XSTR(STACK_ALIGNMENT)
|
||||
|
||||
/* Stack alignment macros */
|
||||
|
||||
#define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user