aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2011-03-16 19:05:48 -0400
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2011-03-16 19:05:48 -0400
commit1f4364f934a6f31c262da2abc1d638ef7b82c808 (patch)
treefa89fcef3f3ed620a542f611e2470b33d68e380e
parent9aacc216a8627fccbf979e1336be3f36ed150ce5 (diff)
lttng-mips-dump-mips-system-call-tables
The 64-bit kernel may support all three ABIs, so we iterate the sys_call_tables of all of enabled ABIs. [Mathieu: Coding style cleanup] Signed-off-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/kernel/scall64-64.S3
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S8
-rw-r--r--arch/mips/kernel/syscall.c65
5 files changed, 74 insertions, 5 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3223020d803..6c1b06ef577 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -18,6 +18,7 @@ config MIPS
select HAVE_KRETPROBES
select RTC_LIB if !MACH_LOONGSON
select GENERIC_ATOMIC64 if !64BIT
+ select HAVE_LTT_DUMP_TABLES
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select HAVE_GENERIC_HARDIRQS
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 8038839b496..c574a1a12f2 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -126,7 +126,8 @@ illegal_syscall:
END(handle_sys64)
.align 3
-sys_call_table:
+ .type sys_call_table,@object
+EXPORT(sys_call_table)
PTR sys_read /* 5000 */
PTR sys_write
PTR sys_open
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 48b8593c8a2..0d312c2d54d 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -121,6 +121,8 @@ not_n32_scall:
END(handle_sysn32)
+ .align 3
+ .type sysn32_call_table,@object
EXPORT(sysn32_call_table)
PTR sys_read /* 6000 */
PTR sys_write
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index aa293006aac..635d0d84344 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -53,7 +53,7 @@ NESTED(handle_sys, PT_SIZE, sp)
sll a3, a3, 0
dsll t0, v0, 3 # offset into table
- ld t2, (sys_call_table - (__NR_O32_Linux * 8))(t0)
+ ld t2, (syso32_call_table - (__NR_O32_Linux * 8))(t0)
sd a3, PT_R26(sp) # save a3 for syscall restarting
@@ -180,7 +180,7 @@ LEAF(sys32_syscall)
beqz t0, einval # do not recurse
dsll t1, t0, 3
beqz v0, einval
- ld t2, sys_call_table(t1) # syscall routine
+ ld t2, syso32_call_table(t1) # syscall routine
move a0, a1 # shift argument registers
move a1, a2
@@ -202,8 +202,8 @@ einval: li v0, -ENOSYS
END(sys32_syscall)
.align 3
- .type sys_call_table,@object
-sys_call_table:
+ .type syso32_call_table,@object
+EXPORT(syso32_call_table)
PTR sys32_syscall /* 4000 */
PTR sys_exit
PTR sys_fork
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index eeec9a1507f..42db7a4eedc 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -32,6 +32,7 @@
#include <linux/random.h>
#include <linux/elf.h>
#include <linux/ipc.h>
+#include <linux/kallsyms.h>
#include <asm/asm.h>
#include <asm/branch.h>
@@ -464,3 +465,67 @@ int kernel_execve(const char *filename,
return -__v0;
}
+
+void ltt_dump_sys_call_table(void *call_data)
+{
+ int i;
+ char namebuf[KSYM_NAME_LEN];
+
+#ifdef CONFIG_32BIT
+ for (i = 0; i < __NR_O32_Linux_syscalls; i++) {
+ extern struct {
+ unsigned long ptr;
+ long j;
+ } sys_call_table[];
+
+ sprint_symbol(namebuf, sys_call_table[i].ptr);
+ __trace_mark(0, syscall_state, sys_call_table, call_data,
+ "id %d address %p symbol %s",
+ i + __NR_O32_Linux, (void *)sys_call_table[i].ptr,
+ namebuf);
+ }
+#endif
+#ifdef CONFIG_64BIT
+# ifdef CONFIG_MIPS32_O32
+ for (i = 0; i < __NR_O32_Linux_syscalls; i++) {
+ extern unsigned long syso32_call_table[];
+
+ sprint_symbol(namebuf, syso32_call_table[i]);
+ __trace_mark(0, syscall_state, sys_call_table, call_data,
+ "id %d address %p symbol %s",
+ i + __NR_O32_Linux, (void *)syso32_call_table[i],
+ namebuf);
+ }
+# endif
+
+ for (i = 0; i < __NR_64_Linux_syscalls; i++) {
+ extern unsigned long sys_call_table[];
+
+ sprint_symbol(namebuf, sys_call_table[i]);
+ __trace_mark(0, syscall_state, sys_call_table, call_data,
+ "id %d address %p symbol %s",
+ i + __NR_64_Linux, (void *)sys_call_table[i],
+ namebuf);
+ }
+
+# ifdef CONFIG_MIPS32_N32
+ for (i = 0; i < __NR_N32_Linux_syscalls; i++) {
+ extern unsigned long sysn32_call_table[];
+
+ sprint_symbol(namebuf, sysn32_call_table[i]);
+ __trace_mark(0, syscall_state, sys_call_table, call_data,
+ "id %d address %p symbol %s",
+ i + __NR_N32_Linux, (void *)sysn32_call_table[i],
+ namebuf);
+ }
+# endif
+#endif
+}
+EXPORT_SYMBOL_GPL(ltt_dump_sys_call_table);
+
+void ltt_dump_idt_table(void *call_data)
+{
+ /* No IDT information yet. */
+ return;
+}
+EXPORT_SYMBOL_GPL(ltt_dump_idt_table);