Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 88e0c85

Browse files
committed
Groups the SBPFVersion feature flags by their SIMDs.
1 parent f1790c8 commit 88e0c85

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed

src/program.rs

+25-28
Original file line numberDiff line numberDiff line change
@@ -20,60 +20,57 @@ pub enum SBPFVersion {
2020
}
2121

2222
impl SBPFVersion {
23-
/// Enable the little-endian byte swap instructions
24-
pub fn disable_le(&self) -> bool {
23+
/// Enable SIMD-0166: SBPF dynamic stack frames
24+
pub fn dynamic_stack_frames(&self) -> bool {
2525
self != &SBPFVersion::V1
2626
}
2727

28-
/// Enable the negation instruction
29-
pub fn disable_neg(&self) -> bool {
28+
/// Enable SIMD-0173: SBPF instruction encoding improvements
29+
pub fn callx_uses_src_reg(&self) -> bool {
3030
self != &SBPFVersion::V1
3131
}
32-
33-
/// Swaps the reg and imm operands of the subtraction instruction
34-
pub fn swap_sub_reg_imm_operands(&self) -> bool {
32+
/// ... SIMD-0173
33+
pub fn disable_lddw(&self) -> bool {
3534
self != &SBPFVersion::V1
3635
}
37-
38-
/// Enable the only two slots long instruction: LD_DW_IMM
39-
pub fn disable_lddw(&self) -> bool {
36+
/// ... SIMD-0173
37+
pub fn disable_le(&self) -> bool {
4038
self != &SBPFVersion::V1
4139
}
4240

43-
/// Enable the BPF_PQR instruction class
41+
/// Enable SIMD-0174: SBPF arithmetics improvements
4442
pub fn enable_pqr(&self) -> bool {
4543
self != &SBPFVersion::V1
4644
}
47-
48-
/// Use src reg instead of imm in callx
49-
pub fn callx_uses_src_reg(&self) -> bool {
45+
/// ... SIMD-0174
46+
pub fn disable_neg(&self) -> bool {
5047
self != &SBPFVersion::V1
5148
}
52-
53-
/// Ensure that rodata sections don't exceed their maximum allowed size and
54-
/// overlap with the stack
55-
pub fn reject_rodata_stack_overlap(&self) -> bool {
49+
/// ... SIMD-0174
50+
pub fn swap_sub_reg_imm_operands(&self) -> bool {
5651
self != &SBPFVersion::V1
5752
}
53+
/// ... SIMD-0174
54+
pub fn implicit_sign_extension_of_results(&self) -> bool {
55+
self == &SBPFVersion::V1
56+
}
5857

59-
/// Allow sh_addr != sh_offset in elf sections. Used in V2 to align
60-
/// section vaddrs to MM_PROGRAM_START.
61-
pub fn enable_elf_vaddr(&self) -> bool {
58+
/// Enable SIMD-0176: SBPF static syscalls
59+
pub fn static_syscalls(&self) -> bool {
6260
self != &SBPFVersion::V1
6361
}
6462

65-
/// Use dynamic stack frame sizes
66-
pub fn dynamic_stack_frames(&self) -> bool {
63+
/// Enable SIMD-XXXX: SBPF stricter controlflow
64+
pub fn stricter_controlflow(&self) -> bool {
6765
self != &SBPFVersion::V1
6866
}
6967

70-
/// Support syscalls via pseudo calls (insn.src = 0)
71-
pub fn static_syscalls(&self) -> bool {
68+
/// Enable SIMD-XXXX: Stricter ELF header
69+
pub fn reject_rodata_stack_overlap(&self) -> bool {
7270
self != &SBPFVersion::V1
7371
}
74-
75-
/// Restricts jump and call targets to function boundaries
76-
pub fn stricter_controlflow(&self) -> bool {
72+
/// ... SIMD-XXXX
73+
pub fn enable_elf_vaddr(&self) -> bool {
7774
self != &SBPFVersion::V1
7875
}
7976
}

0 commit comments

Comments
 (0)