1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Author: George Guo <guodongtai@kylinos.cn> 4 * Copyright (C) 2026 KylinSoft Corporation. 5 */ 6 7#include <asm/asmmacro.h> 8#include <asm/regdef.h> 9#include <linux/export.h> 10#include <linux/linkage.h> 11 12SYM_FUNC_START(arch_bpf_timed_may_goto) 13 addi.d sp, sp, -64 14 st.d ra, sp, 56 15 16 /* Save BPF registers R0 - R5 (a5, a0 - a4) */ 17 st.d a5, sp, 8 18 st.d a0, sp, 16 19 st.d a1, sp, 24 20 st.d a2, sp, 32 21 st.d a3, sp, 40 22 st.d a4, sp, 48 23 24 /* 25 * BPF_REG_AX (t0) holds the offset passed in by the verifier; 26 * add it to BPF_REG_FP (s4) to get the pointer to the count and 27 * timestamp, then pass it as the first argument in a0. 28 * 29 * The verifier emits a load using FP right before this call, 30 * so BPF_REG_FP (s4) is always set up by the JIT in this case. 31 */ 32 add.d a0, t0, s4 33 bl bpf_check_timed_may_goto 34 /* BPF_REG_AX (t0) will be stored into count, so move the return value to it. */ 35 move t0, a0 36 37 ld.d ra, sp, 56 38 ld.d a5, sp, 8 39 ld.d a0, sp, 16 40 ld.d a1, sp, 24 41 ld.d a2, sp, 32 42 ld.d a3, sp, 40 43 ld.d a4, sp, 48 44 addi.d sp, sp, 64 45 46 jr ra 47SYM_FUNC_END(arch_bpf_timed_may_goto) 48