doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/asm_tests/simple.stp
raw| 1 | function foo:long (x:long) %{ /* bpf */ /* pure */ |
| 2 | /* compute 100-x */ |
| 3 | 0xb7, $$, -, -, 100; /* mov $$, 100 */ |
| 4 | 0x1f, $$, $x, -, -; /* sub $$, $x */ |
| 5 | %} |
| 6 | |
| 7 | probe begin { |
| 8 | printf("U foo(1)=%d, should be 99\n", foo(1)) |
| 9 | printf("U foo(15)=%d, should be 85\n", foo(15)) |
| 10 | } |
| 11 | |
| 12 | probe kernel.function("vfs_read") { |
| 13 | printf("K foo(1)=%d, should be 99\n", foo(1)) |
| 14 | printf("K foo(15)=%d, should be 85\n", foo(15)) |
| 15 | exit() |
| 16 | } |