LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_PE_RUNTIME_FUNCTION_AARCH64_UNPACKED_H
17#define LIEF_PE_RUNTIME_FUNCTION_AARCH64_UNPACKED_H
33 struct epilog_scope_t {
36 static epilog_scope_t
from_raw(uint32_t raw); uint32_t start_offset = 0;
39 uint16_t start_index = 0;
47 using epilog_scopes_t = std::vector<epilog_scope_t>;
48 using it_epilog_scopes = ref_iterator<epilog_scopes_t&>;
49 using it_const_epilog_scopes = const_ref_iterator<const epilog_scopes_t&>;
51 static std::unique_ptr<UnpackedFunction>
52 parse(Parser& ctx, BinaryStream& strm, uint32_t xdata_rva, uint32_t rva);
55 RuntimeFunctionAArch64(rva, length, PACKED_FLAGS::UNPACKED)
59 UnpackedFunction&
operator=(
const UnpackedFunction&) =
default;
62 UnpackedFunction&
operator=(UnpackedFunction&&) =
default;
66 std::unique_ptr<ExceptionInfo>
clone()
const override {
67 return std::unique_ptr<UnpackedFunction>(
new UnpackedFunction(*
this));
100 return E() == 1 ? 0 : epilog_count_;
106 return E() == 1 ? epilog_offset_ : uint16_t(-1);
116 return exception_handler_;
130 return epilog_scopes_;
134 return epilog_scopes_;
147 UnpackedFunction&
X(uint8_t value) {
152 UnpackedFunction&
E(uint8_t value) {
158 epilog_offset_ = value;
168 exception_handler_ = value;
173 epilog_scopes_ = std::move(scopes);
178 unwind_code_ = std::move(code);
182 static bool classof(
const ExceptionInfo* info) {
183 if (!RuntimeFunctionAArch64::classof(info)) {
186 const auto* aarch64 =
static_cast<const RuntimeFunctionAArch64*
>(info);
187 return aarch64->flag() == PACKED_FLAGS::UNPACKED;
191 uint32_t xdata_rva_ = 0;
192 uint32_t version_ = 0;
196 uint32_t epilog_count_;
197 uint32_t epilog_offset_ = 0;
199 uint32_t code_words_ = 0;
200 uint32_t exception_handler_ = 0;
202 epilog_scopes_t epilog_scopes_;
203 std::vector<uint8_t> unwind_code_;
This class represents an unpacked AArch64 exception entry.
Definition UnpackedFunction.hpp:31
uint8_t X() const
1-bit field that indicates the presence (1) or absence (0) of exception data.
Definition UnpackedFunction.hpp:87
static std::unique_ptr< UnpackedFunction > parse(Parser &ctx, BinaryStream &strm, uint32_t xdata_rva, uint32_t rva)
UnpackedFunction(uint32_t rva, uint32_t length)
Definition UnpackedFunction.hpp:54
UnpackedFunction & code_words(uint32_t value)
Definition UnpackedFunction.hpp:162
it_epilog_scopes epilog_scopes()
Iterator over the epilog scopes.
Definition UnpackedFunction.hpp:129
span< uint8_t > unwind_code()
Definition UnpackedFunction.hpp:124
uint16_t epilog_offset() const
If E() == 1, index of the first unwind code that describes the one and only epilog.
Definition UnpackedFunction.hpp:105
uint8_t E() const
1-bit field that indicates that information describing a single epilog is packed into the header (1) ...
Definition UnpackedFunction.hpp:93
UnpackedFunction & version(uint32_t value)
Definition UnpackedFunction.hpp:142
~UnpackedFunction() override=default
UnpackedFunction & epilog_cnt_offset(uint16_t value)
Definition UnpackedFunction.hpp:157
UnpackedFunction & E(uint8_t value)
Definition UnpackedFunction.hpp:152
UnpackedFunction & epilog_scopes(epilog_scopes_t scopes)
Definition UnpackedFunction.hpp:172
uint32_t exception_handler() const
Exception handler RVA (if any)
Definition UnpackedFunction.hpp:115
uint32_t code_words() const
Number of 32-bit words needed to contain all of the unwind codes.
Definition UnpackedFunction.hpp:110
UnpackedFunction & X(uint8_t value)
Definition UnpackedFunction.hpp:147
uint32_t xdata_rva() const
RVA where this unpacked data is located (usually pointing in .xdata)
Definition UnpackedFunction.hpp:73
UnpackedFunction & exception_handler(uint32_t value)
Definition UnpackedFunction.hpp:167
UnpackedFunction & xdata_rva(uint32_t value)
Definition UnpackedFunction.hpp:137
UnpackedFunction & operator=(UnpackedFunction &&)=default
UnpackedFunction & operator=(const UnpackedFunction &)=default
span< const uint8_t > unwind_code() const
Bytes that contain the unwind codes.
Definition UnpackedFunction.hpp:120
it_const_epilog_scopes epilog_scopes() const
Definition UnpackedFunction.hpp:133
UnpackedFunction(UnpackedFunction &&)=default
uint32_t version() const
Describes the version of the remaining .xdata.
Definition UnpackedFunction.hpp:81
std::unique_ptr< ExceptionInfo > clone() const override
Definition UnpackedFunction.hpp:66
UnpackedFunction(const UnpackedFunction &)=default
std::string to_string() const override
UnpackedFunction & unwind_code(std::vector< uint8_t > code)
Definition UnpackedFunction.hpp:177
static bool classof(const ExceptionInfo *info)
Definition UnpackedFunction.hpp:182
uint16_t epilog_count() const
If E() == 0, specifies the count of the total number of epilog scopes. Otherwise, return 0
Definition UnpackedFunction.hpp:99
This namespace wraps code related to PE-ARM64 unwinding code.
Definition PackedFunction.hpp:26
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
@ E
Definition AcceleratorCodes.hpp:82
LIEF namespace.
Definition Abstract/Binary.hpp:36
static epilog_scope_t from_raw(uint32_t raw)
#define LIEF_API
Definition visibility.h:41