LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
PackedFunction.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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
35 public:
36 static std::unique_ptr<PackedFunction> parse(Parser& ctx, BinaryStream& strm,
37 uint32_t rva, uint32_t unwind_data);
38
40
41 PackedFunction(const PackedFunction&) = default;
43
46
47 ~PackedFunction() override = default;
48
49 std::unique_ptr<ExceptionInfo> clone() const override {
50 return std::unique_ptr<PackedFunction>(new PackedFunction(*this));
51 }
52
53 std::string to_string() const override;
54
55 static bool classof(const ExceptionInfo* info) {
57 return false;
58 }
59 const auto* aarch64 = static_cast<const RuntimeFunctionAArch64*>(info);
60 return aarch64->flag() == PACKED_FLAGS::PACKED ||
61 aarch64->flag() == PACKED_FLAGS::PACKED_FRAGMENT;
62 }
63
65 uint8_t frame_size() const {
66 return frame_size_;
67 }
68
71 uint8_t reg_I() const {
72 return reg_I_;
73 }
74
77 uint8_t reg_F() const {
78 return reg_F_;
79 }
80
84 uint8_t H() const {
85 return h_;
86 }
87
90 uint8_t CR() const {
91 return cr_;
92 }
93
94 PackedFunction& frame_size(uint8_t value) {
95 frame_size_ = value;
96 return *this;
97 }
98
99 PackedFunction& reg_I(uint8_t value) {
100 reg_I_ = value;
101 return *this;
102 }
103
104 PackedFunction& reg_F(uint8_t value) {
105 reg_F_ = value;
106 return *this;
107 }
108
109 PackedFunction& H(uint8_t value) {
110 h_ = value;
111 return *this;
112 }
113
114 PackedFunction& CR(uint8_t value) {
115 cr_ = value;
116 return *this;
117 }
118
119 private:
120 uint8_t frame_size_ = 0;
121 uint8_t cr_ = 0;
122 uint8_t h_ = 0;
123 uint8_t reg_I_ = 0;
124 uint8_t reg_F_ = 0;
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 Parser::parse functions should be used...
Definition PE/Parser.hpp:52
static bool classof(const ExceptionInfo *info)
Definition RuntimeFunctionAArch64.hpp:86
@ PACKED_FRAGMENT
Definition RuntimeFunctionAArch64.hpp:44
@ PACKED
Definition RuntimeFunctionAArch64.hpp:43
RuntimeFunctionAArch64(uint64_t RVA, uint32_t length, PACKED_FLAGS flag)
Definition RuntimeFunctionAArch64.hpp:51
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:114
uint8_t reg_I() const
Number of non-volatile INT registers (x19-x28) saved in the canonical stack location.
Definition PackedFunction.hpp:71
static bool classof(const ExceptionInfo *info)
Definition PackedFunction.hpp:55
PackedFunction & frame_size(uint8_t value)
Definition PackedFunction.hpp:94
std::unique_ptr< ExceptionInfo > clone() const override
Definition PackedFunction.hpp:49
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:90
uint8_t reg_F() const
Number of non-volatile FP registers (d8-d15) saved in the canonical stack location.
Definition PackedFunction.hpp:77
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:84
RuntimeFunctionAArch64(uint64_t RVA, uint32_t length, PACKED_FLAGS flag)
Definition RuntimeFunctionAArch64.hpp:51
uint8_t frame_size() const
Size of the allocated stack.
Definition PackedFunction.hpp:65
PackedFunction & reg_I(uint8_t value)
Definition PackedFunction.hpp:99
PackedFunction & operator=(PackedFunction &&)=default
PackedFunction & reg_F(uint8_t value)
Definition PackedFunction.hpp:104
PackedFunction & operator=(const PackedFunction &)=default
PackedFunction(const PackedFunction &)=default
PackedFunction & H(uint8_t value)
Definition PackedFunction.hpp:109
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:43