From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Date: Mon, 17 Apr 2017 20:55:01 +0000 Subject: Re: [PATCH RFC] sparc64: eBPF JIT Message-Id: <58F52BA5.1090808@iogearbox.net> List-Id: References: <20170416.233825.1748421481008153466.davem@davemloft.net> <58F50D13.3090001@iogearbox.net> <20170417.150326.345314944044934203.davem@davemloft.net> In-Reply-To: <20170417.150326.345314944044934203.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Miller Cc: sparclinux@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org On 04/17/2017 09:03 PM, David Miller wrote: > From: Daniel Borkmann > Date: Mon, 17 Apr 2017 20:44:35 +0200 > >> On 04/17/2017 05:38 AM, David Miller wrote: >>> +/* Map BPF registers to SPARC registers */ >>> +static const int bpf2sparc[] = { >>> + /* return value from in-kernel function, and exit value from eBPF */ >>> + [BPF_REG_0] = I5, >>> + >>> + /* arguments from eBPF program to in-kernel function */ >>> + [BPF_REG_1] = I0, >>> + [BPF_REG_2] = I1, >>> + [BPF_REG_3] = I2, >>> + [BPF_REG_4] = I3, >>> + [BPF_REG_5] = I4, >>> + >>> + /* callee saved registers that in-kernel function will preserve */ >>> + [BPF_REG_6] = L0, >>> + [BPF_REG_7] = L1, >>> + [BPF_REG_8] = L2, >>> + [BPF_REG_9] = L3, >>> + >>> + /* read-only frame pointer to access stack */ >>> + [BPF_REG_FP] = FP, >> >> On a quick initial glance, you also need to map BPF_REG_AX. If >> I understand the convention correctly, you could use L7 for that. >> >> You can test for it through tools/testing/selftests/bpf/test_kmod.sh >> which exercises the test_bpf.ko under various sysctl combinations as >> part of the BPF selftest suite. > > Oh I see, it's used for constant blinding. I can use a global register > for that since it's only used as a temporary right? Yeah, correct. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH RFC] sparc64: eBPF JIT Date: Mon, 17 Apr 2017 22:55:01 +0200 Message-ID: <58F52BA5.1090808@iogearbox.net> References: <20170416.233825.1748421481008153466.davem@davemloft.net> <58F50D13.3090001@iogearbox.net> <20170417.150326.345314944044934203.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: sparclinux@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org To: David Miller Return-path: In-Reply-To: <20170417.150326.345314944044934203.davem@davemloft.net> Sender: sparclinux-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 04/17/2017 09:03 PM, David Miller wrote: > From: Daniel Borkmann > Date: Mon, 17 Apr 2017 20:44:35 +0200 > >> On 04/17/2017 05:38 AM, David Miller wrote: >>> +/* Map BPF registers to SPARC registers */ >>> +static const int bpf2sparc[] = { >>> + /* return value from in-kernel function, and exit value from eBPF */ >>> + [BPF_REG_0] = I5, >>> + >>> + /* arguments from eBPF program to in-kernel function */ >>> + [BPF_REG_1] = I0, >>> + [BPF_REG_2] = I1, >>> + [BPF_REG_3] = I2, >>> + [BPF_REG_4] = I3, >>> + [BPF_REG_5] = I4, >>> + >>> + /* callee saved registers that in-kernel function will preserve */ >>> + [BPF_REG_6] = L0, >>> + [BPF_REG_7] = L1, >>> + [BPF_REG_8] = L2, >>> + [BPF_REG_9] = L3, >>> + >>> + /* read-only frame pointer to access stack */ >>> + [BPF_REG_FP] = FP, >> >> On a quick initial glance, you also need to map BPF_REG_AX. If >> I understand the convention correctly, you could use L7 for that. >> >> You can test for it through tools/testing/selftests/bpf/test_kmod.sh >> which exercises the test_bpf.ko under various sysctl combinations as >> part of the BPF selftest suite. > > Oh I see, it's used for constant blinding. I can use a global register > for that since it's only used as a temporary right? Yeah, correct.