Nyxstone class for assembling and disassembling for a given architecture.
More...
#include <nyxstone.h>
|
| Nyxstone (llvm::Triple &&triple, const llvm::Target &target, llvm::MCTargetOptions &&target_options, std::unique_ptr< llvm::MCRegisterInfo > &®ister_info, std::unique_ptr< llvm::MCAsmInfo > &&assembler_info, std::unique_ptr< llvm::MCInstrInfo > &&instruction_info, std::unique_ptr< llvm::MCSubtargetInfo > &&subtarget_info, std::unique_ptr< llvm::MCInstPrinter > &&instruction_printer) noexcept |
| Nyxstone constructor called by NyxstoneBuilder::build.
|
|
tl::expected< std::vector< u8 >, std::string > | assemble (const std::string &assembly, uint64_t address, const std::vector< LabelDefinition > &labels) const |
| Translates assembly instructions at a given start address to bytes.
|
|
tl::expected< std::vector< Instruction >, std::string > | assemble_to_instructions (const std::string &assembly, uint64_t address, const std::vector< LabelDefinition > &labels) const |
| Translates assembly instructions at given start address to instruction details containing bytes.
|
|
tl::expected< std::string, std::string > | disassemble (const std::vector< uint8_t > &bytes, uint64_t address, size_t count) const |
| Translates bytes to disassembly text at given start address.
|
|
tl::expected< std::vector< Instruction >, std::string > | disassemble_to_instructions (const std::vector< uint8_t > &bytes, uint64_t address, size_t count) const |
| Translates bytes to instruction details containing disassembly text at given start address.
|
|
Nyxstone class for assembling and disassembling for a given architecture.
◆ Nyxstone()
nyxstone::Nyxstone::Nyxstone |
( |
llvm::Triple && | triple, |
|
|
const llvm::Target & | target, |
|
|
llvm::MCTargetOptions && | target_options, |
|
|
std::unique_ptr< llvm::MCRegisterInfo > && | register_info, |
|
|
std::unique_ptr< llvm::MCAsmInfo > && | assembler_info, |
|
|
std::unique_ptr< llvm::MCInstrInfo > && | instruction_info, |
|
|
std::unique_ptr< llvm::MCSubtargetInfo > && | subtarget_info, |
|
|
std::unique_ptr< llvm::MCInstPrinter > && | instruction_printer ) |
|
inlinenoexcept |
Nyxstone constructor called by NyxstoneBuilder::build.
- Warning
- This function should not be called directly, use NyxstoneBuilder instead.
- Parameters
-
triple | The llvm triple used to construct the llvm objects. |
cpu | The cpu string used to construct the subtarget_info (as it points to the data inside). |
features | The cpu features used to construct the subtarget_info (as it points to the data inside). |
target | Target for the given triple. |
target_options | Empty target options (reused from creating assembler_info). |
register_info | Register info for the given triple. |
assembler_info | Assembler info for given triple. |
instruction_info | Instruction information for the given triple. |
subtarget_info | Information about the subtarget, created with cpu and features . |
instruction_printer | Instruction printer for the given architecture. |
◆ assemble()
tl::expected< std::vector< u8 >, std::string > nyxstone::Nyxstone::assemble |
( |
const std::string & | assembly, |
|
|
uint64_t | address, |
|
|
const std::vector< LabelDefinition > & | labels ) const |
Translates assembly instructions at a given start address to bytes.
Additional label definitions by absolute address may be supplied. Does not support assembly directives that impact the layout (f. i., .section, .org).
- Parameters
-
assembly | The assembly instruction(s) to be assembled. |
address | The absolute address of the first instruction. |
labels | Label definitions, should hold all external labels used in the assembly . |
- Returns
- The assembled bytes on success, an error string otherwise.
◆ assemble_to_instructions()
tl::expected< std::vector< Nyxstone::Instruction >, std::string > nyxstone::Nyxstone::assemble_to_instructions |
( |
const std::string & | assembly, |
|
|
uint64_t | address, |
|
|
const std::vector< LabelDefinition > & | labels ) const |
Translates assembly instructions at given start address to instruction details containing bytes.
Additional label definitions by absolute address may be supplied. Does not support assembly directives that impact the layout (f. i., .section, .org).
- Parameters
-
assembly | The assembly instruction(s) to be assembled. |
address | The absolute address of the first instruction. |
labels | Label definitions, should hold all external labels used in the assembly . |
- Returns
- The instruction details on success, an error string otherwise.
◆ disassemble()
tl::expected< std::string, std::string > nyxstone::Nyxstone::disassemble |
( |
const std::vector< uint8_t > & | bytes, |
|
|
uint64_t | address, |
|
|
size_t | count ) const |
Translates bytes to disassembly text at given start address.
- Parameters
-
bytes | The byte code to be disassembled. |
address | The absolute address of the byte code. |
count | The number of instructions which should be disassembled, 0 means all. |
- Returns
- The disassembly on success, an error string otherwise.
◆ disassemble_to_instructions()
tl::expected< std::vector< Nyxstone::Instruction >, std::string > nyxstone::Nyxstone::disassemble_to_instructions |
( |
const std::vector< uint8_t > & | bytes, |
|
|
uint64_t | address, |
|
|
size_t | count ) const |
Translates bytes to instruction details containing disassembly text at given start address.
- Parameters
-
bytes | The byte code to be disassembled. |
address | The absolute address of the byte code. |
count | The number of instructions which should be disassembled, 0 means all. |
- Returns
- The instruction details on success, an error string otherwise.
The documentation for this class was generated from the following files: