|
1 | | -use crate::jit::assembler::arm::alu_assembler::{AluImm, AluReg, AluShiftImm, Bfc, MulReg}; |
| 1 | +use crate::jit::assembler::arm::alu_assembler::{AluImm, AluReg, AluShiftImm, Bfc, Bfi, MulReg}; |
2 | 2 | use crate::jit::assembler::arm::branch_assembler::Bx; |
3 | 3 | use crate::jit::assembler::arm::transfer_assembler::{LdmStm, LdrStrImm, LdrStrImmSBHD, LdrStrReg, LdrStrRegSBHD, Mrs, Msr}; |
4 | 4 | use crate::jit::assembler::arm::Bkpt; |
@@ -124,6 +124,7 @@ impl BlockInst { |
124 | 124 | BlockSystemRegOp::Msr => (block_reg_set!(operand.try_as_reg()), block_reg_set!()), |
125 | 125 | }, |
126 | 126 | BlockInst::Bfc { operand, .. } => (block_reg_set!(Some(*operand)), block_reg_set!(Some(*operand))), |
| 127 | + BlockInst::Bfi { operands, .. } => (block_reg_set!(Some(operands[0]), Some(operands[1])), block_reg_set!(Some(operands[0]))), |
127 | 128 |
|
128 | 129 | BlockInst::SaveContext { .. } => (block_reg_set!(), block_reg_set!()), |
129 | 130 | BlockInst::SaveReg { |
@@ -250,6 +251,10 @@ impl BlockInst { |
250 | 251 | } |
251 | 252 | } |
252 | 253 | BlockInst::Bfc { operand, .. } => Self::replace_reg(operand, old, new), |
| 254 | + BlockInst::Bfi { operands, .. } => { |
| 255 | + Self::replace_reg(&mut operands[0], old, new); |
| 256 | + Self::replace_reg(&mut operands[1], old, new); |
| 257 | + } |
253 | 258 | BlockInst::SaveContext { .. } => { |
254 | 259 | unreachable!() |
255 | 260 | } |
@@ -296,6 +301,7 @@ impl BlockInst { |
296 | 301 | } |
297 | 302 | } |
298 | 303 | BlockInst::Bfc { operand, .. } => Self::replace_reg(operand, old, new), |
| 304 | + BlockInst::Bfi { operands, .. } => Self::replace_reg(&mut operands[0], old, new), |
299 | 305 | BlockInst::SaveContext { tmp_guest_cpsr_reg, .. } => Self::replace_reg(tmp_guest_cpsr_reg, old, new), |
300 | 306 | BlockInst::SaveReg { |
301 | 307 | guest_reg, |
@@ -338,6 +344,10 @@ impl BlockInst { |
338 | 344 | BlockInst::TransferMultiple { operand, .. } => Self::replace_reg(operand, old, new), |
339 | 345 | BlockInst::SystemReg { operand, .. } => Self::replace_operand(operand, old, new), |
340 | 346 | BlockInst::Bfc { operand, .. } => Self::replace_reg(operand, old, new), |
| 347 | + BlockInst::Bfi { operands, .. } => { |
| 348 | + Self::replace_reg(&mut operands[0], old, new); |
| 349 | + Self::replace_reg(&mut operands[1], old, new); |
| 350 | + } |
341 | 351 |
|
342 | 352 | BlockInst::SaveContext { .. } => { |
343 | 353 | unreachable!() |
@@ -518,6 +528,7 @@ impl BlockInst { |
518 | 528 | BlockSystemRegOp::Msr => opcodes.push(Msr::cpsr_flags(operand.as_reg().as_fixed(), Cond::AL)), |
519 | 529 | }, |
520 | 530 | BlockInst::Bfc { operand, lsb, width } => opcodes.push(Bfc::create(operand.as_fixed(), *lsb, *width, Cond::AL)), |
| 531 | + BlockInst::Bfi { operands, lsb, width } => opcodes.push(Bfi::create(operands[0].as_fixed(), operands[1].as_fixed(), *lsb, *width, Cond::AL)), |
521 | 532 | BlockInst::Mul { operands, set_cond, .. } => match operands[2].operand { |
522 | 533 | BlockOperand::Reg(reg) => opcodes.push(MulReg::mul( |
523 | 534 | operands[0].as_reg().as_fixed(), |
@@ -686,6 +697,11 @@ pub enum BlockInst { |
686 | 697 | lsb: u8, |
687 | 698 | width: u8, |
688 | 699 | }, |
| 700 | + Bfi { |
| 701 | + operands: [BlockReg; 2], |
| 702 | + lsb: u8, |
| 703 | + width: u8, |
| 704 | + }, |
689 | 705 | Mul { |
690 | 706 | operands: [BlockOperandShift; 3], |
691 | 707 | set_cond: BlockAluSetCond, |
@@ -789,6 +805,7 @@ impl Debug for BlockInst { |
789 | 805 | } |
790 | 806 | BlockInst::SystemReg { op, operand } => write!(f, "{op:?} {operand:?}"), |
791 | 807 | BlockInst::Bfc { operand, lsb, width } => write!(f, "Bfc {operand:?}, {lsb}, {width}"), |
| 808 | + BlockInst::Bfi { operands, lsb, width } => write!(f, "Bfi {:?}, {:?}, {lsb}, {width}", operands[0], operands[1]), |
792 | 809 | BlockInst::Mul { operands, set_cond, thumb_pc_aligned } => write!(f, "Mul{set_cond:?} {operands:?}, align pc: {thumb_pc_aligned}"), |
793 | 810 | BlockInst::Label { label, guest_pc } => { |
794 | 811 | let guest_pc = match guest_pc { |
|
0 commit comments