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