thumb: Change ordering when decoding thumb instruction.
This fixes a bug where "swi" instructions are decoded as conditional branches. The order really matters here, because Swi instructions are actually conditional branch with illegal condition code. Former-commit-id: 0024a8b53386a510dd321c157391c99a2af29223
This commit is contained in:
parent
387e26fad9
commit
eea26d2393
|
@ -124,10 +124,10 @@ impl InstructionDecoder for ThumbInstruction {
|
||||||
Ok(PushPop)
|
Ok(PushPop)
|
||||||
} else if raw & 0xf000 == 0xc000 {
|
} else if raw & 0xf000 == 0xc000 {
|
||||||
Ok(LdmStm)
|
Ok(LdmStm)
|
||||||
} else if raw & 0xf000 == 0xd000 {
|
|
||||||
Ok(BranchConditional)
|
|
||||||
} else if raw & 0xff00 == 0xdf00 {
|
} else if raw & 0xff00 == 0xdf00 {
|
||||||
Ok(Swi)
|
Ok(Swi)
|
||||||
|
} else if raw & 0xf000 == 0xd000 {
|
||||||
|
Ok(BranchConditional)
|
||||||
} else if raw & 0xf800 == 0xe000 {
|
} else if raw & 0xf800 == 0xe000 {
|
||||||
Ok(Branch)
|
Ok(Branch)
|
||||||
} else if raw & 0xf000 == 0xf000 {
|
} else if raw & 0xf000 == 0xf000 {
|
||||||
|
@ -323,7 +323,7 @@ impl ThumbInstruction {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cond(&self) -> ArmCond {
|
pub fn cond(&self) -> ArmCond {
|
||||||
ArmCond::from_u8(self.raw.bit_range(8..12) as u8).unwrap()
|
ArmCond::from_u8(self.raw.bit_range(8..12) as u8).expect("bad condition")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flag(&self, bit: usize) -> bool {
|
pub fn flag(&self, bit: usize) -> bool {
|
||||||
|
|
Reference in a new issue