2 #include <linux/errno.h>
3 #include <linux/kernel.h>
5 #include <linux/slab.h>
6 #include <linux/types.h>
7 #include <asm/ptrace.h>
8 #include <asm/uaccess.h>
10 #define SAMPLE_BUFFER_SIZE 8192
12 static char *sample_buffer;
13 static char *sample_buffer_pos;
14 static int prof_running = 0;
22 *(
unsigned int*)sample_buffer_pos =
current->pid;
24 *(
unsigned int*)sample_buffer_pos = 0;
27 sample_buffer_pos += 8;
30 sample_buffer_pos = sample_buffer;
34 read_cris_profile(
struct file *
file,
char __user *
buf,
35 size_t count, loff_t *ppos)
37 unsigned long p = *ppos;
45 memset(sample_buffer + p, 0, ret);
51 write_cris_profile(
struct file *file,
const char __user *buf,
52 size_t count, loff_t *ppos)
54 sample_buffer_pos = sample_buffer;
60 .read = read_cris_profile,
61 .write = write_cris_profile,
65 static int __init init_cris_profile(
void)
74 sample_buffer_pos = sample_buffer;
77 &cris_proc_profile_operations);