]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Add x86-specific USDT arg spec parsing logic
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 4 Apr 2022 23:42:00 +0000 (16:42 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 5 Apr 2022 20:16:08 +0000 (13:16 -0700)
commit2d8aaa0b058c0731a0fb28e46898141c3d480061
treee039d83641ae7e9b1f6be18792ea6cbc72028ec9
parent3d83b2deddb692b3294d687a494ffe1269c78213
libbpf: Add x86-specific USDT arg spec parsing logic

Add x86/x86_64-specific USDT argument specification parsing. Each
architecture will require their own logic, as all this is arch-specific
assembly-based notation. Architectures that libbpf doesn't support for
USDTs will pr_warn() with specific error and return -ENOTSUP.

We use sscanf() as a very powerful and easy to use string parser. Those
spaces in sscanf's format string mean "skip any whitespaces", which is
pretty nifty (and somewhat little known) feature.

All this was tested on little-endian architecture, so bit shifts are
probably off on big-endian, which our CI will hopefully prove.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Reviewed-by: Dave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/bpf/20220404234202.331384-6-andrii@kernel.org
tools/lib/bpf/usdt.c