Debian Codegraph @

testsuite/systemtap.context/num_args.stp

raw
1 %( arch == "i386" %? global ir = "eax", lr = "eax" %)
2 %( arch == "x86_64" %? global ir = "eax", lr = "rax" %)
3 %( arch == "powerpc" %? global ir = "r3", lr = "r3" %)
4 %( arch == "s390" %? global ir = "r2", lr = "r2" %)
5 %( arch == "arm" %? global ir = "r0", lr = "r0" %)
6 %( arch == "arm64" %? global ir = "x0", lr = "x0" %)
7 %( arch == "mips" %? global ir = "v0", lr = "v0" %)
8
9 # On s390/s390x, when in a syscall, the 1st argument is in the
10 # orig_gpr2 register. If you aren't in a syscall, the 1st argument is
11 # in r2. The s390 *_arg() function assumes we're in a syscall. Since
12 # we aren't in the testcase, it returns the wrong value. So instead,
13 # grab the value from r2.
14
15 probe module("systemtap-test-module2").function("yyy_int") {
16 printf("yyy_int %d %d %d\n",
17 %( arch == "s390" %? register("r2") %: int_arg(1) %),
18 int_arg(2), int_arg(3))
19 }
20 probe module("systemtap-test-module2").function("yyy_int").return {
21 printf("yyy_int returns %d\n", register(ir))
22 }
23 probe module("systemtap-test-module2").function("yyy_uint") {
24 printf("yyy_uint %d %d %d\n",
25 %( arch == "s390" %? u_register("r2") %: uint_arg(1) %),
26 uint_arg(2), uint_arg(3))
27 }
28 probe module("systemtap-test-module2").function("yyy_uint").return {
29 printf("yyy_uint returns %d\n", u_register(ir))
30 }
31 probe module("systemtap-test-module2").function("yyy_long") {
32 printf("yyy_long %d %d %d\n",
33 %( arch == "s390" %? register("r2") %: long_arg(1) %),
34 long_arg(2), long_arg(3))
35 }
36 probe module("systemtap_test-module2").function("yyy_long").return {
37 printf("yyy_long returns %d\n", register(lr))
38 }
39 probe module("systemtap-test_module2").function("yyy_int64") {
40 # On i386, kernel is built with -mregparm=3. The first arg occupies the
41 # first two registers. The 2nd arg is not split between the 3rd register
42 # and the stack, but rather passed entirely on the stack.
43 printf("yyy_int64 %d %d %d\n",
44 %( arch == "i386" %?
45 s64_arg(1), s64_arg(4), s64_arg(6)
46 %:
47 %( arch == "s390" %? register("r2") %: s64_arg(1) %),
48 s64_arg(2), s64_arg(3)
49 %)
50 )
51 }
52 probe module("systemtap_test_module2").function("yyy_int64").return {
53 printf("yyy_int64 returns %d\n", register(ir))
54 }
55 probe module("systemtap_test_module2").function("yyy_char") {
56 printf("yyy_char %1b %1b %1b\n",
57 %( arch == "s390" %? register("r2") %: int_arg(1) %),
58 int_arg(2), int_arg(3))
59 }
60 probe module("systemtap_test_module2").function("yyy_char").return {
61 printf("yyy_char returns %1b\n", register(ir))
62 }
63 probe module("systemtap_test_module2").function("yyy_str") {
64 printf("yyy_str %s-%s-%s\n",
65 kernel_string(%( arch == "s390" %? u_register("r2")
66 %: pointer_arg(1) %)),
67 kernel_string(pointer_arg(2)), kernel_string(pointer_arg(3)))
68 }
69 probe module("systemtap_test_module2").function("yyy_str").return {
70 printf("yyy_str returns %s\n", kernel_string(register(lr)))
71 }
72 probe begin {
73 printf("READY\n")
74 }