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

Commit b6d8898

Browse files
committed
Groups the SBPFVersion feature flags by their SIMDs.
1 parent e405163 commit b6d8898

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

src/program.rs

+27-31
Original file line numberDiff line numberDiff line change
@@ -20,65 +20,61 @@ pub enum SBPFVersion {
2020
}
2121

2222
impl SBPFVersion {
23-
/// Explicitly perform sign extension of results
24-
pub fn explicit_sign_extension_of_results(&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 little-endian byte swap instructions
29-
pub fn disable_le(&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-
/// Enable the negation instruction
34-
pub fn disable_neg(&self) -> bool {
32+
/// ... SIMD-0173
33+
pub fn disable_lddw(&self) -> bool {
3534
self != &SBPFVersion::V1
3635
}
37-
38-
/// Swaps the reg and imm operands of the subtraction instruction
39-
pub fn swap_sub_reg_imm_operands(&self) -> bool {
36+
/// ... SIMD-0173
37+
pub fn disable_le(&self) -> bool {
4038
self != &SBPFVersion::V1
4139
}
42-
43-
/// Enable the only two slots long instruction: LD_DW_IMM
44-
pub fn disable_lddw(&self) -> bool {
40+
/// ... SIMD-0173
41+
pub fn move_memory_instruction_classes(&self) -> bool {
4542
self != &SBPFVersion::V1
4643
}
4744

48-
/// Enable the BPF_PQR instruction class
45+
/// Enable SIMD-0174: SBPF arithmetics improvements
4946
pub fn enable_pqr(&self) -> bool {
5047
self != &SBPFVersion::V1
5148
}
52-
53-
/// Use src reg instead of imm in callx
54-
pub fn callx_uses_src_reg(&self) -> bool {
49+
/// ... SIMD-0174
50+
pub fn disable_neg(&self) -> bool {
5551
self != &SBPFVersion::V1
5652
}
57-
58-
/// Ensure that rodata sections don't exceed their maximum allowed size and
59-
/// overlap with the stack
60-
pub fn reject_rodata_stack_overlap(&self) -> bool {
53+
/// ... SIMD-0174
54+
pub fn swap_sub_reg_imm_operands(&self) -> bool {
6155
self != &SBPFVersion::V1
6256
}
63-
64-
/// Allow sh_addr != sh_offset in elf sections. Used in V2 to align
65-
/// section vaddrs to MM_PROGRAM_START.
66-
pub fn enable_elf_vaddr(&self) -> bool {
57+
/// ... SIMD-0174
58+
pub fn explicit_sign_extension_of_results(&self) -> bool {
6759
self != &SBPFVersion::V1
6860
}
6961

70-
/// Use dynamic stack frame sizes
71-
pub fn dynamic_stack_frames(&self) -> bool {
62+
/// Enable SIMD-0176: SBPF static syscalls
63+
pub fn static_syscalls(&self) -> bool {
7264
self != &SBPFVersion::V1
7365
}
7466

75-
/// Support syscalls via pseudo calls (insn.src = 0)
76-
pub fn static_syscalls(&self) -> bool {
67+
/// Enable SIMD-XXXX: SBPF stricter controlflow
68+
pub fn stricter_controlflow(&self) -> bool {
7769
self != &SBPFVersion::V1
7870
}
7971

80-
/// Restricts jump and call targets to function boundaries
81-
pub fn stricter_controlflow(&self) -> bool {
72+
/// Enable SIMD-XXXX: Stricter ELF header
73+
pub fn reject_rodata_stack_overlap(&self) -> bool {
74+
self != &SBPFVersion::V1
75+
}
76+
/// ... SIMD-XXXX
77+
pub fn enable_elf_vaddr(&self) -> bool {
8278
self != &SBPFVersion::V1
8379
}
8480
}

0 commit comments

Comments
 (0)