From 34508c0b01fa6a652f7e7eb5fad51823d2ba66d1 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 31 Jan 2021 13:06:59 +0000 Subject: 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. --- Userland/Libraries/LibX86/Instruction.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Userland/Libraries') diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h index 98428b7334..2631cf2030 100644 --- a/Userland/Libraries/LibX86/Instruction.h +++ b/Userland/Libraries/LibX86/Instruction.h @@ -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; -- cgit v1.2.3