LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
PackedFunction.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_RUNTIME_FUNCTION_AARCH64_PACKED_H
17#define LIEF_PE_RUNTIME_FUNCTION_AARCH64_PACKED_H
18
19#include "LIEF/visibility.h"
20#include <memory>
21
23
24namespace LIEF {
25namespace PE {
26namespace unwind_aarch64 {
27
34 public:
35 static std::unique_ptr<PackedFunction>
36 parse(Parser& ctx, BinaryStream& strm, uint32_t rva, uint32_t unwind_data);
37
39
40 PackedFunction(const PackedFunction&) = default;
42
45
46 ~PackedFunction() override = default;
47
48 std::unique_ptr<ExceptionInfo> clone() const override {
49 return std::unique_ptr<PackedFunction>(new PackedFunction(*this));
50 }
51
52 std::string to_string() const override;
53
54 static bool classof(const ExceptionInfo* info) {
56 return false;
57 }
58 const auto* aarch64 = static_cast<const RuntimeFunctionAArch64*>(info);
59 return aarch64->flag() == PACKED_FLAGS::PACKED ||
60 aarch64->flag() == PACKED_FLAGS::PACKED_FRAGMENT;
61 }
62
64 uint8_t frame_size() const {
65 return frame_size_;
66 }
67
70 uint8_t reg_I() const {
71 return reg_I_;
72 }
73
76 uint8_t reg_F() const {
77 return reg_F_;
78 }
79
83 uint8_t H() const {
84 return h_;
85 }
86
89 uint8_t CR() const {
90 return cr_;
91 }
92
93 PackedFunction& frame_size(uint8_t value) {
94 frame_size_ = value;
95 return *this;
96 }
97
98 PackedFunction& reg_I(uint8_t value) {
99 reg_I_ = value;
100 return *this;
101 }
102
103 PackedFunction& reg_F(uint8_t value) {
104 reg_F_ = value;
105 return *this;
106 }
107
108 PackedFunction& H(uint8_t value) {
109 h_ = value;
110 return *this;
111 }
112
113 PackedFunction& CR(uint8_t value) {
114 cr_ = value;
115 return *this;
116 }
117
118 private:
119 uint8_t frame_size_ = 0;
120 uint8_t cr_ = 0;
121 uint8_t h_ = 0;
122 uint8_t reg_I_ = 0;
123 uint8_t reg_F_ = 0;
124
125};
126}
127}
128}
129#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
static bool classof(const ExceptionInfo *info)
Definition RuntimeFunctionAArch64.hpp:83
@ PACKED_FRAGMENT
Definition RuntimeFunctionAArch64.hpp:43
@ PACKED
Definition RuntimeFunctionAArch64.hpp:42
RuntimeFunctionAArch64(uint64_t RVA, uint32_t length, PACKED_FLAGS flag)
Definition RuntimeFunctionAArch64.hpp:50
static std::unique_ptr< PackedFunction > parse(Parser &ctx, BinaryStream &strm, uint32_t rva, uint32_t unwind_data)
PackedFunction & CR(uint8_t value)
Definition PackedFunction.hpp:113
uint8_t reg_I() const
Number of non-volatile INT registers (x19-x28) saved in the canonical stack location.
Definition PackedFunction.hpp:70
static bool classof(const ExceptionInfo *info)
Definition PackedFunction.hpp:54
PackedFunction & frame_size(uint8_t value)
Definition PackedFunction.hpp:93
std::unique_ptr< ExceptionInfo > clone() const override
Definition PackedFunction.hpp:48
std::string to_string() const override
uint8_t CR() const
Flag indicating whether the function includes extra instructions to set up a frame chain and return l...
Definition PackedFunction.hpp:89
uint8_t reg_F() const
Number of non-volatile FP registers (d8-d15) saved in the canonical stack location.
Definition PackedFunction.hpp:76
PackedFunction(PackedFunction &&)=default
uint8_t H() const
1-bit flag indicating whether the function homes the integer parameter registers (x0-x7) by storing t...
Definition PackedFunction.hpp:83
RuntimeFunctionAArch64(uint64_t RVA, uint32_t length, PACKED_FLAGS flag)
Definition RuntimeFunctionAArch64.hpp:50
uint8_t frame_size() const
Size of the allocated stack.
Definition PackedFunction.hpp:64
PackedFunction & reg_I(uint8_t value)
Definition PackedFunction.hpp:98
PackedFunction & operator=(PackedFunction &&)=default
PackedFunction & reg_F(uint8_t value)
Definition PackedFunction.hpp:103
PackedFunction & operator=(const PackedFunction &)=default
PackedFunction(const PackedFunction &)=default
PackedFunction & H(uint8_t value)
Definition PackedFunction.hpp:108
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
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41