2 * arch/blackfin/kernel/kgdb_test.c - Blackfin kgdb tests
4 * Copyright 2005-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/proc_fs.h>
14 #include <asm/current.h>
15 #include <asm/uaccess.h>
16 #include <asm/system.h>
18 #include <asm/blackfin.h>
20 static char cmdline
[256];
21 static unsigned long len
;
24 static int num1
__attribute__((l1_data
));
26 void kgdb_l1_test(void) __attribute__((l1_text
));
28 void kgdb_l1_test(void)
30 printk(KERN_ALERT
"L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1
, num1
);
31 printk(KERN_ALERT
"L1 : code function addr = 0x%p\n", kgdb_l1_test
);
33 printk(KERN_ALERT
"L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1
, num1
);
40 static int num2
__attribute__((l2
));
41 void kgdb_l2_test(void) __attribute__((l2
));
43 void kgdb_l2_test(void)
45 printk(KERN_ALERT
"L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2
, num2
);
46 printk(KERN_ALERT
"L2 : code function addr = 0x%p\n", kgdb_l2_test
);
48 printk(KERN_ALERT
"L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2
, num2
);
55 int kgdb_test(char *name
, int len
, int count
, int z
)
57 printk(KERN_DEBUG
"kgdb name(%d): %s, %d, %d\n", len
, name
, count
, z
);
62 static int test_proc_output(char *buf
)
64 kgdb_test("hello world!", 12, 0x55, 0x10);
75 static int test_read_proc(char *page
, char **start
, off_t off
,
76 int count
, int *eof
, void *data
)
80 len
= test_proc_output(page
);
92 static int test_write_proc(struct file
*file
, const char *buffer
,
93 unsigned long count
, void *data
)
100 memcpy(cmdline
, buffer
, count
);
106 static int __init
kgdbtest_init(void)
108 struct proc_dir_entry
*entry
;
110 entry
= create_proc_entry("kgdbtest", 0, NULL
);
114 entry
->read_proc
= test_read_proc
;
115 entry
->write_proc
= test_write_proc
;
121 static void __exit
kgdbtest_exit(void)
123 remove_proc_entry("kgdbtest", NULL
);
126 module_init(kgdbtest_init
);
127 module_exit(kgdbtest_exit
);
128 MODULE_LICENSE("GPL");