Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bpf_jit.h
Go to the documentation of this file.
1 #ifndef _BPF_JIT_H
2 #define _BPF_JIT_H
3 
4 /* Conventions:
5  * %g1 : temporary
6  * %g2 : Secondary temporary used by SKB data helper stubs.
7  * %g3 : packet offset passed into SKB data helper stubs.
8  * %o0 : pointer to skb (first argument given to JIT function)
9  * %o1 : BPF A accumulator
10  * %o2 : BPF X accumulator
11  * %o3 : Holds saved %o7 so we can call helper functions without needing
12  * to allocate a register window.
13  * %o4 : skb->len - skb->data_len
14  * %o5 : skb->data
15  */
16 
17 #ifndef __ASSEMBLER__
18 #define G0 0x00
19 #define G1 0x01
20 #define G3 0x03
21 #define G6 0x06
22 #define O0 0x08
23 #define O1 0x09
24 #define O2 0x0a
25 #define O3 0x0b
26 #define O4 0x0c
27 #define O5 0x0d
28 #define SP 0x0e
29 #define O7 0x0f
30 #define FP 0x1e
31 
32 #define r_SKB O0
33 #define r_A O1
34 #define r_X O2
35 #define r_saved_O7 O3
36 #define r_HEADLEN O4
37 #define r_SKB_DATA O5
38 #define r_TMP G1
39 #define r_TMP2 G2
40 #define r_OFF G3
41 
42 /* assembly code in arch/sparc/net/bpf_jit_asm.S */
43 extern u32 bpf_jit_load_word[];
44 extern u32 bpf_jit_load_half[];
45 extern u32 bpf_jit_load_byte[];
46 extern u32 bpf_jit_load_byte_msh[];
55 
56 #else
57 #define r_SKB %o0
58 #define r_A %o1
59 #define r_X %o2
60 #define r_saved_O7 %o3
61 #define r_HEADLEN %o4
62 #define r_SKB_DATA %o5
63 #define r_TMP %g1
64 #define r_TMP2 %g2
65 #define r_OFF %g3
66 #endif
67 
68 #endif /* _BPF_JIT_H */