mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 00:25:02 +07:00
b08ac66b40
Due to name collision in ftrace safe_load and safe_store macros,
these macros cannot take expressions as operands.
For example, compiler will complain for a macro call like the following:
safe_store_code(new_code2, ip + 4, faulted);
arch/mips/include/asm/ftrace.h:61:6: note: in definition of macro 'safe_store'
: [dst] "r" (dst), [src] "r" (src)\
^
arch/mips/kernel/ftrace.c:118:2: note: in expansion of macro 'safe_store_code'
safe_store_code(new_code2, ip + 4, faulted);
^
arch/mips/kernel/ftrace.c:118:32: error: undefined named operand 'ip + 4'
safe_store_code(new_code2, ip + 4, faulted);
^
arch/mips/include/asm/ftrace.h:61:6: note: in definition of macro 'safe_store'
: [dst] "r" (dst), [src] "r" (src)\
^
arch/mips/kernel/ftrace.c:118:2: note: in expansion of macro 'safe_store_code'
safe_store_code(new_code2, ip + 4, faulted);
^
This build error is triggered by a4671094
[MIPS: ftrace: Fix icache flush
range error]. Tweak variable naming in those macros to allow flexible
operands.
Signed-off-by: Viller Hsiao <villerhsiao@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: rostedt@goodmis.org
Cc: fweisbec@gmail.com
Cc: mingo@redhat.com
Cc: Qais.Yousef@imgtec.com
Patchwork: https://patchwork.linux-mips.org/patch/6622/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
91 lines
2.1 KiB
C
91 lines
2.1 KiB
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive for
|
|
* more details.
|
|
*
|
|
* Copyright (C) 2009 DSLab, Lanzhou University, China
|
|
* Author: Wu Zhangjin <wuzhangjin@gmail.com>
|
|
*/
|
|
|
|
#ifndef _ASM_MIPS_FTRACE_H
|
|
#define _ASM_MIPS_FTRACE_H
|
|
|
|
#ifdef CONFIG_FUNCTION_TRACER
|
|
|
|
#define MCOUNT_ADDR ((unsigned long)(_mcount))
|
|
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
|
|
|
|
#ifndef __ASSEMBLY__
|
|
extern void _mcount(void);
|
|
#define mcount _mcount
|
|
|
|
#define safe_load(load, src, dst, error) \
|
|
do { \
|
|
asm volatile ( \
|
|
"1: " load " %[tmp_dst], 0(%[tmp_src])\n" \
|
|
" li %[tmp_err], 0\n" \
|
|
"2:\n" \
|
|
\
|
|
".section .fixup, \"ax\"\n" \
|
|
"3: li %[tmp_err], 1\n" \
|
|
" j 2b\n" \
|
|
".previous\n" \
|
|
\
|
|
".section\t__ex_table,\"a\"\n\t" \
|
|
STR(PTR) "\t1b, 3b\n\t" \
|
|
".previous\n" \
|
|
\
|
|
: [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
|
|
: [tmp_src] "r" (src) \
|
|
: "memory" \
|
|
); \
|
|
} while (0)
|
|
|
|
#define safe_store(store, src, dst, error) \
|
|
do { \
|
|
asm volatile ( \
|
|
"1: " store " %[tmp_src], 0(%[tmp_dst])\n"\
|
|
" li %[tmp_err], 0\n" \
|
|
"2:\n" \
|
|
\
|
|
".section .fixup, \"ax\"\n" \
|
|
"3: li %[tmp_err], 1\n" \
|
|
" j 2b\n" \
|
|
".previous\n" \
|
|
\
|
|
".section\t__ex_table,\"a\"\n\t"\
|
|
STR(PTR) "\t1b, 3b\n\t" \
|
|
".previous\n" \
|
|
\
|
|
: [tmp_err] "=r" (error) \
|
|
: [tmp_dst] "r" (dst), [tmp_src] "r" (src)\
|
|
: "memory" \
|
|
); \
|
|
} while (0)
|
|
|
|
#define safe_load_code(dst, src, error) \
|
|
safe_load(STR(lw), src, dst, error)
|
|
#define safe_store_code(src, dst, error) \
|
|
safe_store(STR(sw), src, dst, error)
|
|
|
|
#define safe_load_stack(dst, src, error) \
|
|
safe_load(STR(PTR_L), src, dst, error)
|
|
|
|
#define safe_store_stack(src, dst, error) \
|
|
safe_store(STR(PTR_S), src, dst, error)
|
|
|
|
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
|
static inline unsigned long ftrace_call_adjust(unsigned long addr)
|
|
{
|
|
return addr;
|
|
}
|
|
|
|
struct dyn_arch_ftrace {
|
|
};
|
|
|
|
#endif /* CONFIG_DYNAMIC_FTRACE */
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* CONFIG_FUNCTION_TRACER */
|
|
#endif /* _ASM_MIPS_FTRACE_H */
|