@@ -116,6 +116,15 @@ static inline bool is_nearbranch(int offset)
116
116
#define SEEN_STACK 0x40000000 /* uses BPF stack */
117
117
#define SEEN_TAILCALL 0x80000000 /* uses tail calls */
118
118
119
+ #define SEEN_VREG_MASK 0x1ff80000 /* Volatile registers r3-r12 */
120
+ #define SEEN_NVREG_MASK 0x0003ffff /* Non volatile registers r14-r31 */
121
+
122
+ #ifdef CONFIG_PPC64
123
+ extern const int b2p [MAX_BPF_JIT_REG + 2 ];
124
+ #else
125
+ extern const int b2p [MAX_BPF_JIT_REG + 1 ];
126
+ #endif
127
+
119
128
struct codegen_context {
120
129
/*
121
130
* This is used to track register usage as well
@@ -129,6 +138,7 @@ struct codegen_context {
129
138
unsigned int seen ;
130
139
unsigned int idx ;
131
140
unsigned int stack_size ;
141
+ int b2p [ARRAY_SIZE (b2p )];
132
142
};
133
143
134
144
static inline void bpf_flush_icache (void * start , void * end )
@@ -147,11 +157,17 @@ static inline void bpf_set_seen_register(struct codegen_context *ctx, int i)
147
157
ctx -> seen |= 1 << (31 - i );
148
158
}
149
159
160
+ static inline void bpf_clear_seen_register (struct codegen_context * ctx , int i )
161
+ {
162
+ ctx -> seen &= ~(1 << (31 - i ));
163
+ }
164
+
150
165
void bpf_jit_emit_func_call_rel (u32 * image , struct codegen_context * ctx , u64 func );
151
166
int bpf_jit_build_body (struct bpf_prog * fp , u32 * image , struct codegen_context * ctx ,
152
167
u32 * addrs , bool extra_pass );
153
168
void bpf_jit_build_prologue (u32 * image , struct codegen_context * ctx );
154
169
void bpf_jit_build_epilogue (u32 * image , struct codegen_context * ctx );
170
+ void bpf_jit_realloc_regs (struct codegen_context * ctx );
155
171
156
172
#endif
157
173
0 commit comments