LibX86: sanity check for Instruction read size

During "Emulator hacking: Let's make the userspace emulator go faster!",
the switch implented in read() was inlined (toward the end of the video).

This patch restore the assert check for any read other than 8, 16 or 32
bits was lost during the code conversion.
This commit is contained in:
Thomas Mangin 2021-01-31 13:06:59 +00:00 committed by Andreas Kling
parent 3b9ead985c
commit 34508c0b01
Notes: sideshowbarker 2024-07-18 22:41:29 +09:00

View file

@ -863,6 +863,8 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, bool o32,
case 4:
m_imm2 = stream.read32();
break;
default:
ASSERT_NOT_REACHED();
}
switch (imm1_bytes) {
@ -875,6 +877,8 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, bool o32,
case 4:
m_imm1 = stream.read32();
break;
default:
ASSERT_NOT_REACHED();
}
m_extra_bytes = prefix_bytes + imm1_bytes + imm2_bytes;