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;
23 static int num1 __attribute__((l1_data));
25 void kgdb_l1_test(void) __attribute__((l1_text));
27 void kgdb_l1_test(void)
29 printk(KERN_ALERT "L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
30 printk(KERN_ALERT "L1 : code function addr = 0x%p\n", kgdb_l1_test);
32 printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
37 static int num2 __attribute__((l2));
38 void kgdb_l2_test(void) __attribute__((l2));
40 void kgdb_l2_test(void)
42 printk(KERN_ALERT "L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
43 printk(KERN_ALERT "L2 : code function addr = 0x%p\n", kgdb_l2_test);
45 printk(KERN_ALERT "L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
52 int kgdb_test(char *name, int len, int count, int z)
54 printk(KERN_DEBUG "kgdb name(%d): %s, %d, %d\n", len, name, count, z);
59 static int test_proc_output(char *buf)
61 kgdb_test("hello world!", 12, 0x55, 0x10);
70 static int test_read_proc(char *page, char **start, off_t off,
71 int count, int *eof, void *data)
75 len = test_proc_output(page);
87 static int test_write_proc(struct file *file, const char *buffer,
88 unsigned long count, void *data)
95 memcpy(cmdline, buffer, count);
101 static int __init kgdbtest_init(void)
103 struct proc_dir_entry *entry;
105 entry = create_proc_entry("kgdbtest", 0, NULL);
109 entry->read_proc = test_read_proc;
110 entry->write_proc = test_write_proc;
116 static void __exit kgdbtest_exit(void)
118 remove_proc_entry("kgdbtest", NULL);
121 module_init(kgdbtest_init);
122 module_exit(kgdbtest_exit);
123 MODULE_LICENSE("GPL");