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