Commit 6870bdb3 authored by Alexei Starovoitov's avatar Alexei Starovoitov Committed by Daniel Borkmann

bpf: Support can_loop/cond_break on big endian

Add big endian support for can_loop/cond_break macros.
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20240613013815.953-4-alexei.starovoitov@gmail.com
parent 98d7ca37
...@@ -351,6 +351,7 @@ l_true: \ ...@@ -351,6 +351,7 @@ l_true: \
l_continue:; \ l_continue:; \
}) })
#else #else
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define can_loop \ #define can_loop \
({ __label__ l_break, l_continue; \ ({ __label__ l_break, l_continue; \
bool ret = true; \ bool ret = true; \
...@@ -376,6 +377,33 @@ l_true: \ ...@@ -376,6 +377,33 @@ l_true: \
l_break: break; \ l_break: break; \
l_continue:; \ l_continue:; \
}) })
#else
#define can_loop \
({ __label__ l_break, l_continue; \
bool ret = true; \
asm volatile goto("1:.byte 0xe5; \
.byte 0; \
.long (((%l[l_break] - 1b - 8) / 8) & 0xffff) << 16; \
.short 0" \
:::: l_break); \
goto l_continue; \
l_break: ret = false; \
l_continue:; \
ret; \
})
#define cond_break \
({ __label__ l_break, l_continue; \
asm volatile goto("1:.byte 0xe5; \
.byte 0; \
.long (((%l[l_break] - 1b - 8) / 8) & 0xffff) << 16; \
.short 0" \
:::: l_break); \
goto l_continue; \
l_break: break; \
l_continue:; \
})
#endif
#endif #endif
#ifndef bpf_nop_mov #ifndef bpf_nop_mov
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment