lkml.org 
[lkml]   [2015]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/6] perf bpf: Add headers for generate bpf bytecode
On 5/5/15 3:10 AM, He Kuang wrote:
> Including bpf instruction macros and register alias.
>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
> tools/perf/util/bpf-loader.h | 188 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 188 insertions(+)
>
> diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h
> index baa4404..840f96d 100644
> --- a/tools/perf/util/bpf-loader.h
> +++ b/tools/perf/util/bpf-loader.h
> @@ -70,4 +70,192 @@ struct bpf_obj {
> } elf;
> };
> #define obj_elf_valid(o) ((o)->elf.fd >= 0)
> +
> +/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
> +
> +#define BPF_ALU64_REG(OP, DST, SRC) \
> + ((struct bpf_insn) { \
> + .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \
> + .dst_reg = DST, \
> + .src_reg = SRC, \
> + .off = 0, \
> + .imm = 0 })

this is massive copy-paste from samples/bpf/libbpf.h
let's create a proper library out of it and place into tools/lib/bpf/



\
 
 \ /
  Last update: 2015-05-06 01:21    [W:0.251 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site