1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

LibX86: Add basic x86-64 support

Most of the 64-bit instructions default to 32-bit operands and select
64-bit using REX.W prefixes. Because of that instead of defining new
instruction formats, this reuses the 32-bit formats and changes them
to take the REX prefixes into account when necessary.

Additionally this removes, adds or modifies the instruction
descriptors in the 64-bit table, where they are different from 32-bit.

Using 'disasm' these changes seem to cover pretty much all of our
64-bit binaries (except for AVX) :^)

Note that UserspaceEmulator will need to account for these prefixed
versions in its 32-bit instruction handlers before being usable on
x86-64.
This commit is contained in:
Simon Wanner 2022-03-27 23:15:32 +02:00 committed by Andreas Kling
parent 735fd5f5db
commit 2ae228dac7
3 changed files with 295 additions and 67 deletions

View file

@ -26,7 +26,7 @@ public:
return Instruction::from_stream(m_stream, OperandSize::Size32, AddressSize::Size32);
#else
# if ARCH(X86_64)
return Instruction::from_stream(m_stream, OperandSize::Size64, AddressSize::Size64);
return Instruction::from_stream(m_stream, OperandSize::Size32, AddressSize::Size64);
# else
dbgln("Unsupported platform");
return {};