Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933022AbbEEWir (ORCPT ); Tue, 5 May 2015 18:38:47 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:34868 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751258AbbEEWio (ORCPT ); Tue, 5 May 2015 18:38:44 -0400 Message-ID: <55494672.30007@plumgrid.com> Date: Tue, 05 May 2015 15:38:42 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: He Kuang , davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org CC: wangnan0@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH 1/6] perf bpf: Add headers for generate bpf bytecode References: <1430820612-84443-1-git-send-email-hekuang@huawei.com> <1430820612-84443-2-git-send-email-hekuang@huawei.com> In-Reply-To: <1430820612-84443-2-git-send-email-hekuang@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1219 Lines: 35 On 5/5/15 3:10 AM, He Kuang wrote: > Including bpf instruction macros and register alias. > > Signed-off-by: He Kuang > --- > 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/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/