Subject: Re: eBPF - little-endian load instructions?

From: Johannes Berg <[email-masked]>
Date: Sat, 15 Apr 2017 09:06:11 +0200

On Fri, 2017-04-14 at 11:42 -0700, Alexei Starovoitov wrote:

> bpf takes endianness of the cpu it runs on.

Ok, so then things are actually not as difficult as I thought.

> if we said that bpf 32-bit load insn is little endian, it would have
> screwed up all big-endian archs and the other way around.

Right.

But then basically we do only need to have builtins for endian
conversion, and #define them appropriately, as done anywhere else.

Perhaps we want to eventually be able to take advantage of "other-
endian" loads the CPU may have through the JIT, but getting it correct
first would be good :)

Either way though, it could be done with something like inline
assembly.

johannes