[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <deee75a2-a4ce-303c-981a-cd5b6e8cecdf@fb.com>
Date: Wed, 28 Jul 2021 17:09:45 -0700
From: Yonghong Song <yhs@...com>
To: Johan Almbladh <johan.almbladh@...finetworks.com>,
<ast@...nel.org>, <daniel@...earbox.net>, <andrii@...nel.org>
CC: <kafai@...com>, <songliubraving@...com>,
<john.fastabend@...il.com>, <kpsingh@...nel.org>,
<Tony.Ambardar@...il.com>, <netdev@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: [PATCH 11/14] bpf/tests: Add test for 32-bit context pointer
argument passing
On 7/28/21 10:04 AM, Johan Almbladh wrote:
> On a 32-bit architecture, the context pointer should occupy the low
> half of R0, and the other half should be zero.
I think this is probably true. The word choice "should" indicates
this doesn't need to be the case if people choose a different
implementation, right?
>
> Signed-off-by: Johan Almbladh <johan.almbladh@...finetworks.com>
> ---
> lib/test_bpf.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
> index 55914b6236aa..314af6eaeb92 100644
> --- a/lib/test_bpf.c
> +++ b/lib/test_bpf.c
> @@ -2084,6 +2084,22 @@ static struct bpf_test tests[] = {
> #undef NUMER
> #undef DENOM
> },
> +#ifdef CONFIG_32BIT
> + {
> + "INT: 32-bit context pointer word order and zero-extension",
> + .u.insns_int = {
> + BPF_ALU32_IMM(BPF_MOV, R0, 0),
> + BPF_JMP32_IMM(BPF_JEQ, R1, 0, 3),
> + BPF_ALU64_IMM(BPF_RSH, R1, 32),
> + BPF_JMP32_IMM(BPF_JNE, R1, 0, 1),
> + BPF_ALU32_IMM(BPF_MOV, R0, 1),
> + BPF_EXIT_INSN(),
> + },
> + INTERNAL,
> + { },
> + { { 0, 1 } }
> + },
> +#endif
> {
> "check: missing ret",
> .u.insns = {
>
Powered by blists - more mailing lists