summaryrefslogtreecommitdiff
path: root/arch/csky/abiv2
diff options
context:
space:
mode:
authorGuo Ren <ren_guo@c-sky.com>2018-12-09 14:29:59 +0800
committerGuo Ren <ren_guo@c-sky.com>2018-12-31 23:16:46 +0800
commit230c77a5e92a29bf21e98ee35e22b0537f61c55b (patch)
tree78aa6ee2843c765edd87b1a9a824f50558c0888a /arch/csky/abiv2
parent17a68777bc883c8044c8b2d40aa112ff4e8a4fb1 (diff)
downloadlinux-sh-230c77a5e92a29bf21e98ee35e22b0537f61c55b.tar.gz
csky: basic ftrace supported
When gcc with -pg, it'll add _mcount stub in every function. We need implement the _mcount in kernel and ftrace depends on stackstrace. To do: call-graph, dynamic ftrace Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Diffstat (limited to 'arch/csky/abiv2')
-rw-r--r--arch/csky/abiv2/Makefile1
-rw-r--r--arch/csky/abiv2/mcount.S24
2 files changed, 25 insertions, 0 deletions
diff --git a/arch/csky/abiv2/Makefile b/arch/csky/abiv2/Makefile
index 069ca7276b99..b1d44f6fbcbd 100644
--- a/arch/csky/abiv2/Makefile
+++ b/arch/csky/abiv2/Makefile
@@ -8,3 +8,4 @@ obj-y += strcmp.o
obj-y += strcpy.o
obj-y += strlen.o
obj-y += strksyms.o
+obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
diff --git a/arch/csky/abiv2/mcount.S b/arch/csky/abiv2/mcount.S
new file mode 100644
index 000000000000..73377d5ddd18
--- /dev/null
+++ b/arch/csky/abiv2/mcount.S
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
+
+#include <linux/linkage.h>
+
+ENTRY (_mcount)
+ subi sp, 20
+ stw a0, (sp, 0)
+ stw a1, (sp, 4)
+ stw a2, (sp, 8)
+ stw a3, (sp, 12)
+ stw lr, (sp, 16)
+ mov a1, lr
+ ldw a0, (sp, 20)
+ jsri csky_mcount
+ ldw a0, (sp, 0)
+ ldw a1, (sp, 4)
+ ldw a2, (sp, 8)
+ ldw a3, (sp, 12)
+ ldw t1, (sp, 16)
+ ldw lr, (sp, 20)
+ addi sp, 24
+ jmp t1
+END (_mcount)