@@ -720,7 +720,6 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
720
720
// BPF_JMP class
721
721
ebpf:: JA => {
722
722
self . emit_validate_and_profile_instruction_count ( Some ( target_pc) ) ;
723
- self . emit_ins ( X86Instruction :: load_immediate ( REGISTER_SCRATCH , target_pc as i64 ) ) ;
724
723
let jump_offset = self . relative_to_target_pc ( target_pc, 5 ) ;
725
724
self . emit_ins ( X86Instruction :: jump_immediate ( jump_offset) ) ;
726
725
} ,
@@ -1222,7 +1221,6 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
1222
1221
} else { // Arithmetic
1223
1222
self . emit_ins ( X86Instruction :: cmp ( OperandSize :: S64 , first_operand, second_operand, None ) ) ;
1224
1223
}
1225
- self . emit_ins ( X86Instruction :: load_immediate ( REGISTER_SCRATCH , target_pc as i64 ) ) ;
1226
1224
let jump_offset = self . relative_to_target_pc ( target_pc, 6 ) ;
1227
1225
self . emit_ins ( X86Instruction :: conditional_jump_immediate ( op, jump_offset) ) ;
1228
1226
self . emit_undo_profile_instruction_count ( target_pc) ;
@@ -1232,18 +1230,19 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
1232
1230
fn emit_conditional_branch_imm ( & mut self , op : u8 , bitwise : bool , immediate : i64 , second_operand : X86Register , target_pc : usize ) {
1233
1231
self . emit_validate_and_profile_instruction_count ( Some ( target_pc) ) ;
1234
1232
if self . should_sanitize_constant ( immediate) {
1233
+ self . emit_ins ( X86Instruction :: mov_mmx ( OperandSize :: S64 , REGISTER_SCRATCH , MM0 ) ) ;
1235
1234
self . emit_sanitized_load_immediate ( REGISTER_SCRATCH , immediate) ;
1236
1235
if bitwise { // Logical
1237
1236
self . emit_ins ( X86Instruction :: test ( OperandSize :: S64 , REGISTER_SCRATCH , second_operand, None ) ) ;
1238
1237
} else { // Arithmetic
1239
1238
self . emit_ins ( X86Instruction :: cmp ( OperandSize :: S64 , REGISTER_SCRATCH , second_operand, None ) ) ;
1240
1239
}
1240
+ self . emit_ins ( X86Instruction :: mov_mmx ( OperandSize :: S64 , MM0 , REGISTER_SCRATCH ) ) ;
1241
1241
} else if bitwise { // Logical
1242
1242
self . emit_ins ( X86Instruction :: test_immediate ( OperandSize :: S64 , second_operand, immediate, None ) ) ;
1243
1243
} else { // Arithmetic
1244
1244
self . emit_ins ( X86Instruction :: cmp_immediate ( OperandSize :: S64 , second_operand, immediate, None ) ) ;
1245
1245
}
1246
- self . emit_ins ( X86Instruction :: load_immediate ( REGISTER_SCRATCH , target_pc as i64 ) ) ;
1247
1246
let jump_offset = self . relative_to_target_pc ( target_pc, 6 ) ;
1248
1247
self . emit_ins ( X86Instruction :: conditional_jump_immediate ( op, jump_offset) ) ;
1249
1248
self . emit_undo_profile_instruction_count ( target_pc) ;
0 commit comments