xtensa: abstract 'entry' and 'retw' in assembly code
Provide abi_entry, abi_entry_default, abi_ret and abi_ret_default macros that allocate aligned stack frame in windowed and call0 ABIs. Provide XTENSA_SPILL_STACK_RESERVE macro that specifies required stack frame size when register spilling is involved. Replace all uses of 'entry' and 'retw' with the above macros. This makes most of the xtensa assembly code ready for XEA3 and call0 ABI. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
@@ -121,7 +121,9 @@
|
||||
|
||||
ENTRY(coprocessor_flush)
|
||||
|
||||
entry a1, 32
|
||||
/* reserve 4 bytes on stack to save a0 */
|
||||
abi_entry(4)
|
||||
|
||||
s32i a0, a1, 0
|
||||
movi a0, .Lsave_cp_regs_jump_table
|
||||
addx8 a3, a3, a0
|
||||
@@ -131,7 +133,8 @@ ENTRY(coprocessor_flush)
|
||||
beqz a3, 1f
|
||||
callx0 a3
|
||||
1: l32i a0, a1, 0
|
||||
retw
|
||||
|
||||
abi_ret(4)
|
||||
|
||||
ENDPROC(coprocessor_flush)
|
||||
|
||||
|
@@ -1842,7 +1842,8 @@ ENDPROC(fast_store_prohibited)
|
||||
|
||||
ENTRY(system_call)
|
||||
|
||||
entry a1, 32
|
||||
/* reserve 4 bytes on stack for function parameter */
|
||||
abi_entry(4)
|
||||
|
||||
/* regs->syscall = regs->areg[2] */
|
||||
|
||||
@@ -1892,7 +1893,7 @@ ENTRY(system_call)
|
||||
|
||||
s32i a6, a2, PT_AREG2
|
||||
bnez a3, 1f
|
||||
retw
|
||||
abi_ret(4)
|
||||
|
||||
1:
|
||||
l32i a4, a1, 4
|
||||
@@ -1901,7 +1902,7 @@ ENTRY(system_call)
|
||||
mov a6, a2
|
||||
call4 do_syscall_trace_leave
|
||||
s32i a3, a2, PT_SYSCALL
|
||||
retw
|
||||
abi_ret(4)
|
||||
|
||||
ENDPROC(system_call)
|
||||
|
||||
@@ -1952,7 +1953,7 @@ ENDPROC(system_call)
|
||||
|
||||
ENTRY(_switch_to)
|
||||
|
||||
entry a1, 48
|
||||
abi_entry(XTENSA_SPILL_STACK_RESERVE)
|
||||
|
||||
mov a11, a3 # and 'next' (a3)
|
||||
|
||||
@@ -2013,7 +2014,7 @@ ENTRY(_switch_to)
|
||||
wsr a14, ps
|
||||
rsync
|
||||
|
||||
retw
|
||||
abi_ret(XTENSA_SPILL_STACK_RESERVE)
|
||||
|
||||
ENDPROC(_switch_to)
|
||||
|
||||
|
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/asmmacro.h>
|
||||
#include <asm/ftrace.h>
|
||||
|
||||
/*
|
||||
@@ -21,13 +22,13 @@
|
||||
|
||||
ENTRY(_mcount)
|
||||
|
||||
entry a1, 16
|
||||
abi_entry_default
|
||||
|
||||
movi a4, ftrace_trace_function
|
||||
l32i a4, a4, 0
|
||||
movi a3, ftrace_stub
|
||||
bne a3, a4, 1f
|
||||
retw
|
||||
abi_ret_default
|
||||
|
||||
1: xor a7, a2, a1
|
||||
movi a3, 0x3fffffff
|
||||
@@ -40,11 +41,11 @@ ENTRY(_mcount)
|
||||
addi a6, a6, -MCOUNT_INSN_SIZE
|
||||
callx4 a4
|
||||
|
||||
retw
|
||||
abi_ret_default
|
||||
|
||||
ENDPROC(_mcount)
|
||||
|
||||
ENTRY(ftrace_stub)
|
||||
entry a1, 16
|
||||
retw
|
||||
abi_entry_default
|
||||
abi_ret_default
|
||||
ENDPROC(ftrace_stub)
|
||||
|
Reference in New Issue
Block a user