On Mon, Jul 10, 2023 at 11:24 PM Will Hawkins <hawkinsw@xxxxxx> wrote: > > On Mon, Jul 10, 2023 at 11:19 PM Will Hawkins <hawkinsw@xxxxxx> wrote: > > > > On Mon, Jul 10, 2023 at 11:00 PM Alexei Starovoitov > > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > > > On Mon, Jul 10, 2023 at 2:58 PM Will Hawkins <hawkinsw@xxxxxx> wrote: > > > > > > > > In the documentation of the eBPF ISA it is unspecified how integers are > > > > represented. Specify that twos complement is used. > > > > > > > > Signed-off-by: Will Hawkins <hawkinsw@xxxxxx> > > > > --- > > > > Documentation/bpf/instruction-set.rst | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/Documentation/bpf/instruction-set.rst b/Documentation/bpf/instruction-set.rst > > > > index 751e657973f0..63dfcba5eb9a 100644 > > > > --- a/Documentation/bpf/instruction-set.rst > > > > +++ b/Documentation/bpf/instruction-set.rst > > > > @@ -173,6 +173,11 @@ BPF_ARSH 0xc0 sign extending dst >>= (src & mask) > > > > BPF_END 0xd0 byte swap operations (see `Byte swap instructions`_ below) > > > > ======== ===== ========================================================== > > > > > > > > +eBPF supports 32- and 64-bit signed and unsigned integers. It does > > > > +not support floating-point data types. All signed integers are represented in > > > > +twos-complement format where the sign bit is stored in the most-significant > > > > +bit. > > > > > > Could you point to another ISA document (like x86, arm, ...) that > > > talks about signed and unsigned integers? > > > > Thank you for the reply. I hope that this change is useful. I proposed > > this change to mimic the documentation of "Numeric Data Types" in > > Volume 1, Chapter 4 of "Intel® 64 and IA-32 Architectures Software > > Developer’s Manual" [1]. > > > > [1] https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html (Apologies for a string of responses) The RISC-V ISA specifies integer representation [1]. [1] https://riscv.org/technical/specifications/ > > Perhaps you would prefer that this information goes (again) in a psABI > document? If so, that's great -- I am working on a strawman version of > one as we speak, in fact. > > Whatever you think is best is great -- you are the expert I am just > trying to help! > > Sincerely, > Will