fastcall void __kprobes do_page_fault(struct pt_regs *regs,
unsigned long error_code)
{
---- linux-2.6.22-590/block/ll_rw_blk.c 2009-03-16 20:49:07.000000000 -0400
-+++ linux-2.6.22-591/block/ll_rw_blk.c 2009-03-16 20:58:59.000000000 -0400
-@@ -30,6 +30,7 @@
- #include <linux/cpu.h>
- #include <linux/blktrace_api.h>
- #include <linux/fault-inject.h>
-+#include <linux/arrays.h>
-
- /*
- * for max sense size
-@@ -3102,6 +3103,13 @@
-
- #endif /* CONFIG_FAIL_MAKE_REQUEST */
-
-+extern void (*rec_event)(void *,unsigned int);
-+struct event_spec {
-+ unsigned long pc;
-+ unsigned long dcookie;
-+ unsigned count;
-+ unsigned char reason;
-+};
- /**
- * generic_make_request: hand a buffer to its device driver for I/O
- * @bio: The bio describing the location in memory and on the device.
-@@ -3220,7 +3228,23 @@
- goto end_io;
- }
- }
--
-+#ifdef CONFIG_CHOPSTIX
-+ if (rec_event) {
-+ struct event event;
-+ struct event_spec espec;
-+ unsigned long eip;
-+
-+ espec.reason = 0;/*request */
-+
-+ eip = bio->bi_end_io;
-+ event.event_data=&espec;
-+ espec.pc=eip;
-+ event.event_type=3;
-+ /* index in the event array currently set up */
-+ /* make sure the counters are loaded in the order we want them to show up*/
-+ (*rec_event)(&event, bio->bi_size);
-+ }
-+#endif
- ret = q->make_request_fn(q, bio);
- } while (ret);
- }
--- linux-2.6.22-590/drivers/oprofile/cpu_buffer.c 2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.22-591/drivers/oprofile/cpu_buffer.c 2009-03-16 20:58:59.000000000 -0400
@@ -21,6 +21,7 @@
+ struct task_struct *task;
+};
+#endif
---- linux-2.6.22-590/include/linux/mutex.h 2007-07-08 19:32:17.000000000 -0400
-+++ linux-2.6.22-591/include/linux/mutex.h 2009-03-16 20:58:59.000000000 -0400
-@@ -53,6 +53,10 @@
- struct thread_info *owner;
- const char *name;
- void *magic;
-+#else
-+#ifdef CONFIG_CHOPSTIX
-+ struct thread_info *owner;
-+#endif
- #endif
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map dep_map;
--- linux-2.6.22-590/include/linux/sched.h 2009-03-16 20:49:42.000000000 -0400
+++ linux-2.6.22-591/include/linux/sched.h 2009-03-16 20:58:59.000000000 -0400
@@ -850,6 +850,10 @@
unsigned long long sched_time; /* sched_clock time spent running */
enum sleep_type sleep_type;
---- linux-2.6.22-590/kernel/mutex.c 2007-07-08 19:32:17.000000000 -0400
-+++ linux-2.6.22-591/kernel/mutex.c 2009-03-16 20:58:59.000000000 -0400
-@@ -18,6 +18,17 @@
- #include <linux/spinlock.h>
- #include <linux/interrupt.h>
- #include <linux/debug_locks.h>
-+#include <linux/arrays.h>
-+
-+#undef CONFIG_CHOPSTIX
-+#ifdef CONFIG_CHOPSTIX
-+struct event_spec {
-+ unsigned long pc;
-+ unsigned long dcookie;
-+ unsigned count;
-+ unsigned char reason;
-+};
-+#endif
-
- /*
- * In the DEBUG case we are using the "NULL fastpath" for mutexes,
-@@ -43,6 +54,9 @@
- __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)
- {
- atomic_set(&lock->count, 1);
-+#ifdef CONFIG_CHOPSTIX
-+ lock->owner=NULL;
-+#endif
- spin_lock_init(&lock->wait_lock);
- INIT_LIST_HEAD(&lock->wait_list);
-
-@@ -88,6 +102,7 @@
- * The locking fastpath is the 1->0 transition from
- * 'unlocked' into 'locked' state.
- */
-+
- __mutex_fastpath_lock(&lock->count, __mutex_lock_slowpath);
- }
-
-@@ -168,6 +183,27 @@
- }
- __set_task_state(task, state);
-
-+#ifdef CONFIG_CHOPSTIX
-+ if (rec_event) {
-+ if (lock->owner) {
-+ struct event event;
-+ struct event_spec espec;
-+ struct task_struct *p = lock->owner->task;
-+ /*spin_lock(&p->alloc_lock);*/
-+ espec.reason = 0; /* lock */
-+ event.event_data=&espec;
-+ event.task = p;
-+ espec.pc=lock;
-+ event.event_type=5;
-+ (*rec_event)(&event, 1);
-+ /*spin_unlock(&p->alloc_lock);*/
-+
-+ }
-+ else
-+ BUG();
-+ }
-+#endif
-+
- /* didnt get the lock, go to sleep: */
- spin_unlock_mutex(&lock->wait_lock, flags);
- schedule();
-@@ -177,6 +213,9 @@
- /* got the lock - rejoice! */
- mutex_remove_waiter(lock, &waiter, task_thread_info(task));
- debug_mutex_set_owner(lock, task_thread_info(task));
-+#ifdef CONFIG_CHOPSTIX
-+ lock->owner = task_thread_info(task);
-+#endif
-
- /* set it to 0 if there are no waiters left: */
- if (likely(list_empty(&lock->wait_list)))
-@@ -202,6 +241,7 @@
- mutex_lock_nested(struct mutex *lock, unsigned int subclass)
- {
- might_sleep();
-+
- __mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, subclass);
- }
-
-@@ -211,6 +251,7 @@
- mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass)
- {
- might_sleep();
-+
- return __mutex_lock_common(lock, TASK_INTERRUPTIBLE, subclass);
- }
-
-@@ -246,6 +287,23 @@
-
- debug_mutex_wake_waiter(lock, waiter);
-
-+#ifdef CONFIG_CHOPSTIX
-+ if (rec_event) {
-+ if (lock->owner) {
-+ struct event event;
-+ struct event_spec espec;
-+
-+ espec.reason = 1; /* unlock */
-+ event.event_data=&espec;
-+ event.task = lock->owner->task;
-+ espec.pc=lock;
-+ event.event_type=5;
-+ (*rec_event)(&event, 1);
-+ }
-+ else
-+ BUG();
-+ }
-+#endif
- wake_up_process(waiter->task);
- }
-
--- linux-2.6.22-590/kernel/sched.c 2009-03-16 20:49:42.000000000 -0400
+++ linux-2.6.22-591/kernel/sched.c 2009-03-16 20:58:59.000000000 -0400
@@ -10,7 +10,7 @@