| 1 |
/* -*- linux-c -*- |
| 2 |
* Systemtap Test Module 2 |
| 3 |
* Copyright (C) 2007 Red Hat Inc. |
| 4 |
* |
| 5 |
* This file is part of systemtap, and is free software. You can |
| 6 |
* redistribute it and/or modify it under the terms of the GNU General |
| 7 |
* Public License (GPL); either version 2, or (at your option) any |
| 8 |
* later version. |
| 9 |
*/ |
| 10 |
|
| 11 |
#include <linux/kernel.h> |
| 12 |
#include <linux/module.h> |
| 13 |
#include <linux/compiler.h> |
| 14 |
|
| 15 |
/* The purpose of this module is to provide a bunch of functions that */ |
| 16 |
/* do nothing important, and then call them in different contexts. */ |
| 17 |
/* We use a /proc file to trigger function calls from user context. */ |
| 18 |
/* Then systemtap scripts set probes on the functions and run tests */ |
| 19 |
/* to see if the expected output is received. */ |
| 20 |
|
| 21 |
/** Here are all the functions we will probe **/ |
| 22 |
|
| 23 |
/* some nested functions to test backtraces */ |
| 24 |
int noinline yyy_func4 (int foo) { |
| 25 |
asm (""); |
| 26 |
return foo + 1; |
| 27 |
} |
| 28 |
int noinline yyy_func3 (int foo) { |
| 29 |
foo = yyy_func4(foo); |
| 30 |
asm (""); |
| 31 |
return foo + 1; |
| 32 |
} |
| 33 |
int noinline yyy_func2 (int foo) { |
| 34 |
foo = yyy_func3(foo); |
| 35 |
asm (""); |
| 36 |
return foo + 1; |
| 37 |
} |
| 38 |
|
| 39 |
int noinline yyy_func1 (int foo) { |
| 40 |
foo = yyy_func2(foo); |
| 41 |
asm (""); |
| 42 |
return foo + 1; |
| 43 |
} |
| 44 |
EXPORT_SYMBOL(yyy_func1); |
| 45 |
|
| 46 |
/* 1. int argument testing */ |
| 47 |
int noinline yyy_int(int a, int b, int c) |
| 48 |
{ |
| 49 |
asm (""); |
| 50 |
return a+b+c; |
| 51 |
} |
| 52 |
/* 2. uint argument testing */ |
| 53 |
unsigned noinline yyy_uint(unsigned a, unsigned b, unsigned c) |
| 54 |
{ |
| 55 |
asm (""); |
| 56 |
return a+b+c; |
| 57 |
} |
| 58 |
/* 3. long argument testing */ |
| 59 |
long noinline yyy_long(long a, long b, long c) |
| 60 |
{ |
| 61 |
asm (""); |
| 62 |
return a+b+c; |
| 63 |
} |
| 64 |
/* 4. int64_t argument testing */ |
| 65 |
int noinline yyy_int64(int64_t a, int64_t b, int64_t c) |
| 66 |
{ |
| 67 |
asm (""); |
| 68 |
return a+b+c; |
| 69 |
} |
| 70 |
/* 5. char argument testing */ |
| 71 |
char noinline yyy_char(char a, char b, char c) |
| 72 |
{ |
| 73 |
asm (""); |
| 74 |
return 'Q'; |
| 75 |
} |
| 76 |
/* 5. string argument testing */ |
| 77 |
char * noinline yyy_str(char *a, char *b, char *c) |
| 78 |
{ |
| 79 |
asm (""); |
| 80 |
return "XYZZY"; |
| 81 |
} |
| 82 |
|
| 83 |
EXPORT_SYMBOL(yyy_int); |
| 84 |
EXPORT_SYMBOL(yyy_uint); |
| 85 |
EXPORT_SYMBOL(yyy_long); |
| 86 |
EXPORT_SYMBOL(yyy_int64); |
| 87 |
EXPORT_SYMBOL(yyy_char); |
| 88 |
EXPORT_SYMBOL(yyy_str); |
| 89 |
|
| 90 |
MODULE_DESCRIPTION("systemtap backtrace test module2"); |
| 91 |
MODULE_LICENSE("GPL"); |