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:
parent
3b9ead985c
commit
34508c0b01
Notes:
sideshowbarker
2024-07-18 22:41:29 +09:00
Author: https://github.com/thomas-mangin 🔰 Commit: https://github.com/SerenityOS/serenity/commit/34508c0b01f Pull-request: https://github.com/SerenityOS/serenity/pull/5199
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue