Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/x86/net/bpf_timed_may_goto.S
26442 views
1
// SPDX-License-Identifier: GPL-2.0
2
/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
3
4
#include <linux/export.h>
5
#include <linux/linkage.h>
6
#include <asm/nospec-branch.h>
7
8
.code64
9
.section .text, "ax"
10
11
SYM_FUNC_START(arch_bpf_timed_may_goto)
12
ANNOTATE_NOENDBR
13
14
/*
15
* r10 passes us stack depth, load the pointer to count and timestamp
16
* into r10 by adding it to BPF frame pointer.
17
*/
18
leaq (%rbp, %r10, 1), %r10
19
20
/* Setup frame. */
21
pushq %rbp
22
movq %rsp, %rbp
23
24
/* Save r0-r5. */
25
pushq %rax
26
pushq %rdi
27
pushq %rsi
28
pushq %rdx
29
pushq %rcx
30
pushq %r8
31
32
/*
33
* r10 has the pointer to count and timestamp, pass it as first
34
* argument.
35
*/
36
movq %r10, %rdi
37
38
/* Emit call depth accounting for call below. */
39
CALL_DEPTH_ACCOUNT
40
call bpf_check_timed_may_goto
41
42
/* BPF_REG_AX=r10 will be stored into count, so move return value to it. */
43
movq %rax, %r10
44
45
/* Restore r5-r0. */
46
popq %r8
47
popq %rcx
48
popq %rdx
49
popq %rsi
50
popq %rdi
51
popq %rax
52
53
leave
54
RET
55
SYM_FUNC_END(arch_bpf_timed_may_goto)
56
57