ietf-wg-bpf / ebpf-docs

eBPF Standard Documentation
37 stars 5 forks source link

ISA: Inconsistent definitions of code field #68

Closed dthaler closed 4 months ago

dthaler commented 6 months ago

Aoyang Fang (SSE, 222010547) [aoyangfang@link.cuhk.edu.cn](mailto:aoyangfang@link.cuhk.edu.cn) wrote:

If so, the value of arithmetic instructions’ code should be 4 bit, rather than BPF_ADD: 0x00, BPF_SUB: 0x10, BPF_MUL: 0x20. Otherwise the convention of arithmetic instruction is not consistent with the convention of jump instructions.

As Aoyang Fang points out, Section 3.1 (Arithmetic instructions) and 3.3 (Jump instructions) are not consistent with each other. 'code' is defined in section 3 as a 4-bit field. Section 3.1 defines 8-bit values of the code field (BPF_SUB: 0x10, BPF_MUL: 0x20, etc.) whereas section 3.3 defines 4-bit values of the code field (BPF_JEQ: 0x1, BPF_JGT: 0x2, etc.).

It would be more consistent to change section 3.1 rather than defining 8-bit values for a 4-bit field.

dthaler commented 5 months ago

Draft visible at PR #91, not yet posted as a proposed patch.

dthaler commented 4 months ago

Proposed patch posted at https://mailarchive.ietf.org/arch/msg/bpf/CUaCcKtQQNfq53qEjJxQ7qZCEcg/

dthaler commented 4 months ago

Fixed in PR https://github.com/ietf-wg-bpf/ebpf-docs/pull/105

dthaler commented 4 months ago

Fixed in draft -01