18 Commits
Author SHA1 Message Date
Linus Groh 8286fec393 LibELF: Change Elf64 types and structs to match the System V ABI
The source is NIH, changes taken from this OpenBSD change:
https://github.com/openbsd/src/commit/29a5018d36e1893562b3c4665fd74c2724fb2b1b
2026-10-23 09:18:11 -04:00
kleines Filmröllchen 1f2d551ae7 LibDisassembly: Use RISC-V decoding functions for 32-bit instructions
This was prettier to add in one go instead of many small sections :^)
2025-09-16 17:26:46 +02:00
kleines Filmröllchen 1d5cd6a903 LibDisassembly: Add common priviledged instructions
This does not include all instructions for S- and M-mode from the
priviledged spec, but these are the common ones that we will definitely
need (and use ourselves)
2025-09-16 17:26:46 +02:00
kleines Filmröllchen 6b50d895ba LibDisassembly: Fix decoding float-float conversions in RV64D
These were the wrong way around.
2025-09-16 17:26:46 +02:00
kleines Filmröllchen 1a02808283 LibDisassembly: Add RISC-V A extension decoding 2025-04-26 16:48:21 +02:00
kleines Filmröllchen 92e02cf434 LibDisassembly: Add RISC-V FD extension decoding
Again, no point in splitting these two since the orthagonal instruction
set makes supporting both in common abstractions convenient.
2025-04-26 16:48:21 +02:00
kleines Filmröllchen 35d665be26 LibDisassembly: Add RISC-V Zicsr extension decoding
Note that CSR pretty-printing is not yet implemented, since we aim to
establish shared CSR utilities in AK in the near future.
2025-04-26 16:48:21 +02:00
kleines Filmröllchen 703bfed298 LibDisassembly: Support disassembling a RISC-V instruction stream
This small commit finally plugs the RISC-V decoding capabilities into
Disassembler, allowing RISC-V to be disassembled correctly.
2025-03-24 10:44:34 +01:00
kleines Filmröllchen ec31c687c3 LibDisassembly: Add RISC-V 64 base ISA instruction decoding
Actually, this is RV64IMZifencei and RV32IMZifencei:
- As per RISC-V, RV64I of course includes RV32I
- The M extension is not separable in a good way since it just adds more
  arithmetic instructions that are represented in a common class with
  other I instructions.
- Zifencei is just one instruction (FENCE.I) that doesn't need its own
  file.
2025-03-24 10:44:34 +01:00
kleines Filmröllchen c6f7fb51da LibDisassembly: Add RISC-V instruction abstractions
These will be used later on by concrete instruction implementations.
2025-03-24 10:44:34 +01:00
kleines Filmröllchen 20847aaa3d LibDisassembly: Add string fmting for RISC-V registers and rounding mode 2025-03-24 10:44:34 +01:00
kleines Filmröllchen 7295da88ec LibDisassembly: Add decoding for RISC-V uncompressed instruction formats
These structs just handle decoding the raw bit format, including details
like sign extending, but not interpreting these bits or translating them
to higher level constructs.
2025-03-24 10:44:34 +01:00
kleines Filmröllchen 90bad07b7e LibDisassembly: Add RISC-V register definitions
The next series of commits will add full RV64GC decoding, but since this
is a lot of code, it is split up into semi-logical chunks which each
contain plenty of dead code initially.

This first commit adds the RISC-V register definitions and enums
necessary for RV64GC; that is, no vector registers.
2025-03-24 10:44:34 +01:00
kleines Filmröllchen 276655b4ce LibDisassembly: Allow disassembler to disassemble any architecture
We can easily detect the architecture from a given ELF file or just use
the native architecture. Importantly, this allows every implemented
target architecture to be disassembled on every host architecture.
2025-03-15 23:34:54 +01:00
kleines Filmröllchen 9430a6c336 LibDisassembly: Use generic Instruction interface for Disassembler
This change includes genericising a few users of this interface where
this is simple to do.
2025-03-15 23:34:54 +01:00
kleines Filmröllchen e4a8aa18af LibDisassembly: Add a generic Instruction interface
At the moment, there's only two generic methods used on Instruction, so
generalizing those allows handling Instructions generically by many
tools. This commit updates the length() interface to use size_t, but not
the serialization interface to use String since that requires a lot more
changes. The serialization interface is however cleaned up and
genericised.

Note that the implementations still construct a non-heap-allocated
Instruction with their creation function, since that yields no
performance degradation for users of arch-specific Instruction like UE.
2025-03-15 23:34:54 +01:00
kleines Filmröllchen e222d2cb8e LibDisassembly: Split existing generic interfaces from x86-specific code
InstructionStream, SymbolProvider and Disassembler are already generic
interfaces, so we can separate those from the x86-specific code. The
x86-specific code is moved to a new x86 subdirectory, which will be
accompanied by other architecture-specific directories soon.
2025-03-15 23:34:54 +01:00
kleines Filmröllchen 881681580a LibX86: Rename to LibDisassembly
Before making this library generic for our different architectures,
let's rename it to indicate this general purpose. The namespace is
changed to Disassembly::X86 since all code is still x86-specific at the
moment, and this namespace will remain in existence to host x86-specific
parts in addition to new sub-namespaces like Disassembly::RISCV and
Disassembly::Aarch64.
2025-03-15 23:34:54 +01:00