Commit f1e9abe7 authored by Paul Chaignon's avatar Paul Chaignon

tools: Use architecture-agnostic PT_REGS_RC

parent dad0ad1f
...@@ -22,7 +22,7 @@ int printret(struct pt_regs *ctx) { ...@@ -22,7 +22,7 @@ int printret(struct pt_regs *ctx) {
return 0; return 0;
char str[80] = {}; char str[80] = {};
bpf_probe_read(&str, sizeof(str), (void *)ctx->ax); bpf_probe_read(&str, sizeof(str), (void *)PT_REGS_RC(ctx));
bpf_trace_printk("%s\\n", &str); bpf_trace_printk("%s\\n", &str);
return 0; return 0;
......
...@@ -47,7 +47,7 @@ bpf_text = """ ...@@ -47,7 +47,7 @@ bpf_text = """
int kretprobe__inet_csk_accept(struct pt_regs *ctx) int kretprobe__inet_csk_accept(struct pt_regs *ctx)
{ {
struct sock *newsk = (struct sock *)ctx->ax; struct sock *newsk = (struct sock *)PT_REGS_RC(ctx);
u32 pid = bpf_get_current_pid_tgid(); u32 pid = bpf_get_current_pid_tgid();
if (newsk == NULL) if (newsk == NULL)
......
...@@ -55,7 +55,7 @@ int trace_connect_entry(struct pt_regs *ctx, struct sock *sk) ...@@ -55,7 +55,7 @@ int trace_connect_entry(struct pt_regs *ctx, struct sock *sk)
static int trace_connect_return(struct pt_regs *ctx, short ipver) static int trace_connect_return(struct pt_regs *ctx, short ipver)
{ {
int ret = ctx->ax; int ret = PT_REGS_RC(ctx);
u32 pid = bpf_get_current_pid_tgid(); u32 pid = bpf_get_current_pid_tgid();
struct sock **skpp; struct sock **skpp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment