mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
bpf: Add iterator for spilled registers
Add this iterator for spilled registers, it concentrates the details of how to get the current frame's spilled registers into a single macro while clarifying the intention of the code which is calling the macro. Signed-off-by: Joe Stringer <joe@wand.net.nz> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
940656fb3f
commit
f3709f69b7
2 changed files with 18 additions and 9 deletions
|
@ -131,6 +131,17 @@ struct bpf_verifier_state {
|
|||
u32 curframe;
|
||||
};
|
||||
|
||||
#define bpf_get_spilled_reg(slot, frame) \
|
||||
(((slot < frame->allocated_stack / BPF_REG_SIZE) && \
|
||||
(frame->stack[slot].slot_type[0] == STACK_SPILL)) \
|
||||
? &frame->stack[slot].spilled_ptr : NULL)
|
||||
|
||||
/* Iterate over 'frame', setting 'reg' to either NULL or a spilled register. */
|
||||
#define bpf_for_each_spilled_reg(iter, frame, reg) \
|
||||
for (iter = 0, reg = bpf_get_spilled_reg(iter, frame); \
|
||||
iter < frame->allocated_stack / BPF_REG_SIZE; \
|
||||
iter++, reg = bpf_get_spilled_reg(iter, frame))
|
||||
|
||||
/* linked list of verifier states used to prune search */
|
||||
struct bpf_verifier_state_list {
|
||||
struct bpf_verifier_state state;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue