mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 22:22:08 +02:00
selftests/bpf: Introduce cond_break_label
Add a new cond_break_label macro that jumps to the specified label when the cond_break termination check fires, and allows us to better handle the uncontrolled termination of the loop. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20250306035431.2186189-2-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
dc438a9bc7
commit
4b7ede0be3
|
|
@ -368,12 +368,12 @@ l_true: \
|
|||
ret; \
|
||||
})
|
||||
|
||||
#define cond_break \
|
||||
#define __cond_break(expr) \
|
||||
({ __label__ l_break, l_continue; \
|
||||
asm volatile goto("may_goto %l[l_break]" \
|
||||
:::: l_break); \
|
||||
goto l_continue; \
|
||||
l_break: break; \
|
||||
l_break: expr; \
|
||||
l_continue:; \
|
||||
})
|
||||
#else
|
||||
|
|
@ -392,7 +392,7 @@ l_true: \
|
|||
ret; \
|
||||
})
|
||||
|
||||
#define cond_break \
|
||||
#define __cond_break(expr) \
|
||||
({ __label__ l_break, l_continue; \
|
||||
asm volatile goto("1:.byte 0xe5; \
|
||||
.byte 0; \
|
||||
|
|
@ -400,7 +400,7 @@ l_true: \
|
|||
.short 0" \
|
||||
:::: l_break); \
|
||||
goto l_continue; \
|
||||
l_break: break; \
|
||||
l_break: expr; \
|
||||
l_continue:; \
|
||||
})
|
||||
#else
|
||||
|
|
@ -418,7 +418,7 @@ l_true: \
|
|||
ret; \
|
||||
})
|
||||
|
||||
#define cond_break \
|
||||
#define __cond_break(expr) \
|
||||
({ __label__ l_break, l_continue; \
|
||||
asm volatile goto("1:.byte 0xe5; \
|
||||
.byte 0; \
|
||||
|
|
@ -426,12 +426,15 @@ l_true: \
|
|||
.short 0" \
|
||||
:::: l_break); \
|
||||
goto l_continue; \
|
||||
l_break: break; \
|
||||
l_break: expr; \
|
||||
l_continue:; \
|
||||
})
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define cond_break __cond_break(break)
|
||||
#define cond_break_label(label) __cond_break(goto label)
|
||||
|
||||
#ifndef bpf_nop_mov
|
||||
#define bpf_nop_mov(var) \
|
||||
asm volatile("%[reg]=%[reg]"::[reg]"r"((short)var))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user