Re: [PATCH 11/13] perf bpf: Add helper header files

From: Jiri Olsa
Date: Mon Mar 12 2018 - 18:32:44 EST


On Mon, Mar 12, 2018 at 04:25:51PM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> >
> > right, I kept this way, because it was already there for kernel,
> > so it was fast to write ;-)
> >
> > but it's true we could leave it symbol based and have some sort of
> > dynamic loader behaviour.. but we'd need to sort out passing the
> > arguments in some generic form.. I'll check on that
>
> Does this answer it or am I missing something?
>
> Documentation/bpf/bpf_design_QA.txt
>
> Q: Is BPF a generic virtual machine ?
> A: NO.
>
> BPF is generic instruction set _with_ C calling convention.
>
> Q: Why C calling convention was chosen?
> A: Because BPF programs are designed to run in the linux kernel
> which is written in C, hence BPF defines instruction set compatible
> with two most used architectures x64 and arm64 (and takes into
> consideration important quirks of other architectures) and
> defines calling convention that is compatible with C calling
> convention of the linux kernel on those architectures.

hm right, but still we interpret the calls.. so we have to call
the function at the end

jirka