bpf: make test py_test_tools_smoke pass on arm64
Changes include:
. Add PT_REGS_FP to access base(FP) register in x64
. Use macros, intead of directly ctx-><reg_name>
in a few places
. Let userspace fill in the value of PAGE_SIZE.
Otherwise, arm64 needs additional headers to
get this value for kernel.
. In tools/wakeuptime.py, arm64 and x86_64 have
the same stack walker mechanism. But they
have different symbol/macro to represent
kernel start address.
With these changes, the test py_test_tools_smoke
can pass on arm64.
Signed-off-by: Yonghong Song <yhs@fb.com>
diff --git a/tools/lib/ucalls.py b/tools/lib/ucalls.py
index 2798793..04214e8 100755
--- a/tools/lib/ucalls.py
+++ b/tools/lib/ucalls.py
@@ -185,7 +185,7 @@
#ifdef SYSCALLS
int syscall_entry(struct pt_regs *ctx) {
u64 pid = bpf_get_current_pid_tgid();
- u64 *valp, ip = ctx->ip, val = 0;
+ u64 *valp, ip = PT_REGS_IP(ctx), val = 0;
PID_FILTER
#ifdef LATENCY
struct syscall_entry_t data = {};