summaryrefslogtreecommitdiffstats
path: root/runtime/uprobes/uprobes_i386.h
diff options
context:
space:
mode:
authorkenistoj <kenistoj>2007-09-28 23:41:26 +0000
committerkenistoj <kenistoj>2007-09-28 23:41:26 +0000
commit04d476c727a575872b088ec853b4402bd4bf5d83 (patch)
tree63ffee8a824f71660b8c36a331883e640432b40e /runtime/uprobes/uprobes_i386.h
parent9446a6d68e4cea3554ecbbacb673b1be9dc89919 (diff)
downloadsystemtap-steved-04d476c727a575872b088ec853b4402bd4bf5d83.tar.gz
systemtap-steved-04d476c727a575872b088ec853b4402bd4bf5d83.tar.xz
systemtap-steved-04d476c727a575872b088ec853b4402bd4bf5d83.zip
uprobes.c, uprobes.h: architecture-independent code
uprobes_i386.c, uprobes_i386.h: i386 code uprobes_arch.c, uprobes_arch.h: map to architecture-specific files
Diffstat (limited to 'runtime/uprobes/uprobes_i386.h')
-rw-r--r--runtime/uprobes/uprobes_i386.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/runtime/uprobes/uprobes_i386.h b/runtime/uprobes/uprobes_i386.h
new file mode 100644
index 00000000..6e2aae70
--- /dev/null
+++ b/runtime/uprobes/uprobes_i386.h
@@ -0,0 +1,67 @@
+#ifndef _ASM_UPROBES_H
+#define _ASM_UPROBES_H
+/*
+ * Userspace Probes (UProbes)
+ * include/asm-i386/uprobes.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2006
+ */
+#include <linux/types.h>
+#include <linux/ptrace.h>
+#include <linux/signal.h>
+
+/* Normally defined in Kconfig */
+#define CONFIG_URETPROBES 1
+#define CONFIG_UPROBES_SSOL 1
+
+typedef u8 uprobe_opcode_t;
+#define BREAKPOINT_INSTRUCTION 0xcc
+#define BP_INSN_SIZE 1
+#define MAX_UINSN_BYTES 16
+#define SLOT_IP 12 /* instruction pointer slot from include/asm/elf.h */
+
+#define BREAKPOINT_SIGNAL SIGTRAP
+#define SSTEP_SIGNAL SIGTRAP
+
+/* Architecture specific switch for where the IP points after a bp hit */
+#define ARCH_BP_INST_PTR(inst_ptr) (inst_ptr - BP_INSN_SIZE)
+
+struct uprobe_probept;
+struct uprobe_task;
+static int arch_validate_probed_insn(struct uprobe_probept *ppt);
+
+/* On i386, the int3 traps leaves eip pointing past the int3 instruction. */
+static inline unsigned long arch_get_probept(struct pt_regs *regs)
+{
+ return (unsigned long) (regs->eip - BP_INSN_SIZE);
+}
+
+static inline void arch_reset_ip_for_sstep(struct pt_regs *regs)
+{
+ regs->eip -= BP_INSN_SIZE;
+}
+
+static inline void arch_restore_uret_addr(unsigned long ret_addr,
+ struct pt_regs *regs)
+{
+ regs->eip = ret_addr;
+}
+
+static unsigned long arch_hijack_uret_addr(unsigned long trampoline_addr,
+ struct pt_regs *regs, struct uprobe_task *utask);
+
+#endif /* _ASM_UPROBES_H */