[patch 1/3] S390-HWBKPT: Prepare s390 for hardware breakpoint infrastructure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prepare the s390 code for HW Breakpoint infrastructure patches by including
relevant constant definitions and function declarations.

Signed-off-by: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxxxxxxx>
---
 arch/s390/include/asm/hw_breakpoint.h |   65 ++++++++++++++++++++++++++++++++++
 arch/s390/include/asm/processor.h     |    6 +++
 kernel/hw_breakpoint.c                |    3 +
 3 files changed, 74 insertions(+)

Index: linux-2.6-tip/arch/s390/include/asm/hw_breakpoint.h
===================================================================
--- /dev/null
+++ linux-2.6-tip/arch/s390/include/asm/hw_breakpoint.h
@@ -0,0 +1,65 @@
+/*
+ * 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) 2009 IBM Corporation
+ * Author: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxxxxxxx>
+ */
+#ifndef	_S390_HW_BREAKPOINT_H
+#define	_S390_HW_BREAKPOINT_H
+
+#ifdef	__KERNEL__
+#define	__ARCH_HW_BREAKPOINT_H
+
+#include <linux/kdebug.h>
+#include <linux/percpu.h>
+#include <linux/list.h>
+#include <asm/processor.h>
+
+struct arch_hw_breakpoint {
+	char		*name; /* Contains name of the symbol to set bkpt */
+	unsigned long	address;
+	unsigned long	len;
+	u8		type;
+};
+
+/* Available HW breakpoint type encodings */
+
+/* trigger on instruction execute */
+#define S390_BREAKPOINT_EXECUTE	0x01
+/* trigger on memory write */
+#define S390_BREAKPOINT_WRITE	0x02
+/* trigger on memory read/write */
+#define S390_BREAKPOINT_RW	0x04
+
+struct perf_event;
+struct pmu;
+
+extern int arch_check_va_in_userspace(unsigned long va, unsigned long hbp_len);
+extern int arch_validate_hwbkpt_settings(struct perf_event *bp,
+						struct task_struct *tsk);
+extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
+				     unsigned long val, void *data);
+
+int arch_install_hw_breakpoint(struct perf_event *bp);
+void arch_uninstall_hw_breakpoint(struct perf_event *bp);
+void hw_breakpoint_pmu_read(struct perf_event *bp);
+void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
+
+extern void arch_fill_perf_breakpoint(struct perf_event *bp);
+
+extern struct pmu perf_ops_bp;
+#endif	/* __KERNEL__ */
+#endif	/* _S390_HW_BREAKPOINT_H */
+
Index: linux-2.6-tip/arch/s390/include/asm/processor.h
===================================================================
--- linux-2.6-tip.orig/arch/s390/include/asm/processor.h
+++ linux-2.6-tip/arch/s390/include/asm/processor.h
@@ -25,6 +25,8 @@
  * instruction pointer ("program counter").
  */
 #define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; })
+/* Total number of available HW breakpoint registers */
+#define HBP_NUM	1
 
 static inline void get_cpu_id(struct cpuid *ptr)
 {
@@ -71,6 +73,8 @@ typedef struct {
         __u32 ar4;
 } mm_segment_t;
 
+struct perf_event;
+
 /*
  * Thread structure
  */
@@ -86,6 +90,8 @@ struct thread_struct {
 	unsigned long ieee_instruction_pointer; 
         /* pfault_wait is used to block the process on a pfault event */
 	unsigned long pfault_wait;
+	/* Save middle states of ptrace breakpoints */
+	struct perf_event *ptrace_bps[HBP_NUM];
 };
 
 typedef struct thread_struct thread_struct;
Index: linux-2.6-tip/kernel/hw_breakpoint.c
===================================================================
--- linux-2.6-tip.orig/kernel/hw_breakpoint.c
+++ linux-2.6-tip/kernel/hw_breakpoint.c
@@ -30,6 +30,9 @@
  * This file contains the arch-independent routines.
  */
 
+#ifdef CONFIG_S390
+#include <asm/bitsperlong.h>
+#endif
 #include <linux/irqflags.h>
 #include <linux/kallsyms.h>
 #include <linux/notifier.h>

--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux