summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibX86
AgeCommit message (Collapse)Author
2022-12-28LibX86: Remove i686 supportLiav A
2022-12-11LibX86: Only pass ProcessorMode to Instruction constructorItamar
We previously passed both OperandSize and AddressSize to the constructor. Both values were only ever 32-bit at construction. We used AddressSize::Size64 to signify Long mode which was needlessly complicated.
2022-12-11LibX86: Use AddressSize::32 in Long modeItamar
As the existing near-by comment says, the default size of displacements & immediates is 32 bits even in Long mode. This makes `disasm` work on our binaries in x86-64 builds.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-26LibX86: Use '+' format parameter to include signs for displacementsSimon Wanner
2022-11-26LibX86: Add basic x86-64 supportSimon Wanner
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.
2022-11-26LibX86: Split up the ModRM and SIB bytes into multiple membersSimon Wanner
This will allow adding extra bits with REX prefixes
2022-11-26LibX86: Add OP_regW_immWSimon Wanner
This is a variation of OP_reg32_imm32 that turns into "OP_reg64_imm64" with a REX.W prefix.
2022-11-26LibX86: Make Instruction::length work for invalid instructionsSimon Wanner
2022-11-26LibX86: Templatize the opcode table buildersSimon Wanner
2022-11-26LibX86: Add {Address,Operand}Size::Size64Simon Wanner
For now the opcode tables for OperandSize::Size64 are empty
2022-11-26LibX86+UserspaceEmulator: Introduce AddressSize and OperandSize enumsSimon Wanner
These replace the bools a32 and o32, which will make implementing 64-bit sizes possible. :^)
2022-11-01Everywhere: Explicitly link all binaries against the LibC targetTim Schumacher
Even though the toolchain implicitly links against -lc, it does not know where it should get LibC from except for the sysroot. In the case of Clang this causes it to pick up the LibC stub instead, which might be slightly outdated and feature missing symbols. This is currently not an issue that manifests because we pass through the dependency on LibC and other libraries by accident, which causes CMake to link against the LibC target (instead of just the library), and thus points the linker at the build output directory. Since we are looking to fix that in the upcoming commits, let's make sure that everything will still be able to find the proper LibC first.
2022-10-04AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most placesNico Weber
Doesn't use them in libc headers so that those don't have to pull in AK/Platform.h. AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is defined in clang builds as well.) Using AK_COMPILER_GCC simplifies things some. AK_COMPILER_CLANG isn't as much of a win, other than that it's consistent with AK_COMPILER_GCC.
2022-09-14Everywhere: Fix a variety of typosBrian Gianforcaro
Spelling fixes found by `codespell`.
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12LibX86: Convert register names to StringViewssin-ack
2022-04-07LibX86+disasm: Use an output format closer to objdumpHendiadyoin1
This mainly does two things, 1. Removes spaces after commas 2. Elides "0x" and leading zeros in most contexts Remaining differences are: 1. objdump always has memory size annotations We lack these and probably have some annotations wrong 2. Boolean check names We use jump-zero, while objdump uses jump-equal for example 3. We sometimes add "00 00" symbols, which objdump elides 4. We always demangle (This is a good thing) 5. We always resolve relocations (This is a good thing) 6. We seem to detect some symbols differently/incorrectly
2022-04-07LibX86: Fix weird formatting in Interpreter.hHendiadyoin1
2022-04-06LibX86: Add CMPXCHG8B, RDRAND and RDSEEDHendiadyoin1
With this we can run following script with no errors: ```sh for /usr/lib/*.so { disasm "$it" > /dev/zero } ```
2022-04-06LibX86: Support SSE2 :^)Hendiadyoin1
This allows disassembly of binaries with SSE2 instructions in them. SSE2 also extends all MMX instructions without affecting the mnemonic, therefore these are just directed to the same function for now. The UserspaceEmulator does not know this as of this commit.
2022-04-06LibX86: Mark MMX instructions as SSE instructionsHendiadyoin1
SSE2 expands on the same opcodes as MMX, so we have to mutate on prefix here.
2022-04-06LibX86: Correct CVTSS2SI's register signatureHendiadyoin1
This was annotated the wrong way around.
2022-04-02LibX86: Correctly name CVTTSS2SI_r32_xmm2m32Hendiadyoin1
This was previously erroneously called CVTTPS2PI_r32_xmm2m32, while the mnemonic was correctly CVTTSS2SI.
2022-04-02LibX86: Use the correct code for UNPCKLSHendiadyoin1
We were accidentally using 0x15, which was immediately overridden by UNPCKHS
2022-04-02LibX86: Correctly name the first xmm argumentHendiadyoin1
We were accidentally calling it a mm-register
2022-04-02LibX86: Don't print repz prefix for SSE instructionsHendiadyoin1
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-18Userland: Change static const variables to static constexprLenny Maiorani
`static const` variables can be computed and initialized at run-time during initialization or the first time a function is called. Change them to `static constexpr` to ensure they are computed at compile-time. This allows some removal of `strlen` because the length of the `StringView` can be used which is pre-computed at compile-time.
2022-03-13Libraries: Use default constructors/destructors in LibX86Lenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-01-07Everywhere: Fix spelling mistakesmjz19910
2021-12-23LibX86: Mark two InstructionDescriptor functions as constHendiadyoin1
Thanks clang-tidy
2021-10-25LibX86: Take load base address into consideration during disassemblyDaniel Bertalan
Since our executables are position-independent, the address values extraced from processes don't correspond to their values within the ELF file. We have to offset the absolute addresses by the load base address to get the relative symbol that we need for disassembly.
2021-10-17LibX86: Add SSE supportHediadyoin1
This only adds the decodeing support for SSE, not SSE2, etc. may contain traces of SSE2.
2021-09-16LibX86: Use default instead of an empty constructor/destructorBrian Gianforcaro
Default implementations allow for more optimizations. See: https://pvs-studio.com/en/docs/warnings/v832/
2021-08-02LibX86: Stub out Disassembler::next() for x86_64Gunnar Beutner
LibX86 doesn't currently support x86_64 opcodes which causes Profiler to crash when clicking on any symbol in the call graph.
2021-08-01Libraries: Remove unused header includesBrian Gianforcaro
2021-07-22LibX86: Add missing MovD and MovQ instructionsHendiadyoin1
These are placeholders for now
2021-07-22LibX86: Use names closer to the spec for the ModrmHendiadyoin1
This gets rid of a lot of magic number shifts and ands.
2021-07-20LibX86: Add INT1 instruction (needed for disassembly)Andreas Kling
2021-06-30Debugger: Compile on x86_64Hendiadyoin1
This is not guaranteed to work at all
2021-06-11AK+LibX86: Generalize u128/256 to AK::UFixedBigIntHendiadyoin1
Doing these as custom classes might be faster, especially when writing them in SSE, but this would cause a lot of Code duplication and due to the nature of constexprs and the intelligence of the compiler they might be using SSE/MMX either way
2021-05-31LibX86: Replace fprintf(stderr) with warnln()Linus Groh
2021-05-21Revert "Userland: static vs non-static constexpr variables"Linus Groh
This reverts commit 800ea8ea969835297dc7e7da345a45b9dc5e751a. Booting the system no longer worked after these changes.
2021-05-21Userland: static vs non-static constexpr variablesLenny Maiorani
Problem: - `static` variables consume memory and sometimes are less optimizable. - `static const` variables can be `constexpr`, usually. - `static` function-local variables require an initialization check every time the function is run. Solution: - If a global `static` variable is only used in a single function then move it into the function and make it non-`static` and `constexpr`. - Make all global `static` variables `constexpr` instead of `const`. - Change function-local `static const[expr]` variables to be just `constexpr`.
2021-05-07LibX86: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
2021-05-01LibX86+UserspaceEmulator: Add MMX insns prototypesHendiadyoin1
2021-04-29Everywhere: Use "the SerenityOS developers." in copyright headersLinus Groh
We had some inconsistencies before: - Sometimes "The", sometimes "the" - Sometimes trailing ".", sometimes no trailing "." I picked the most common one (lowecase "the", trailing ".") and applied it to all copyright headers. By using the exact same string everywhere we can ensure nothing gets missed during a global search (and replace), and that these inconsistencies are not spread any further (as copyright headers are commonly copied to new files).