summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibX86
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2021-01-31 13:06:59 +0000
committerAndreas Kling <kling@serenityos.org>2021-01-31 19:06:24 +0100
commit34508c0b01fa6a652f7e7eb5fad51823d2ba66d1 (patch)
tree78002ab5f2eafa9c70d2dad15aeffa6e12a4bdcd /Userland/Libraries/LibX86
parent3b9ead985c591e21f20a399147d3ba7f2f44546d (diff)
downloadserenity-34508c0b01fa6a652f7e7eb5fad51823d2ba66d1.zip
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.
Diffstat (limited to 'Userland/Libraries/LibX86')
-rw-r--r--Userland/Libraries/LibX86/Instruction.h4
1 files changed, 4 insertions, 0 deletions
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;