LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
PE
exceptions_info
internal_arm64.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_UNWIND_CODE_ARM64_INTERNAL_H
17
#define LIEF_PE_UNWIND_CODE_ARM64_INTERNAL_H
18
#include <cstdint>
19
#include <array>
20
21
namespace
LIEF::PE::details
{
22
inline
uint32_t
xdata_unpacked_rva
(uint32_t value) {
23
return
value & ~0x3;
24
}
25
26
struct
arm64_packed_t
{
27
uint32_t
raw
;
28
29
uint8_t
flags
()
const
{
30
return
raw
& 0x03;
31
}
32
33
uint32_t
function_length
()
const
{
34
return
((
raw
& 0x00001ffc) >> 2) << 2;
35
}
36
37
uint8_t
RF
()
const
{
38
return
((
raw
& 0x0000e000) >> 13);
39
}
40
41
uint8_t
RI
()
const
{
42
return
((
raw
& 0x000f0000) >> 16);
43
}
44
45
bool
H
()
const
{
46
return
((
raw
& 0x00100000) >> 20);
47
}
48
49
uint8_t
CR
()
const
{
50
return
((
raw
& 0x600000) >> 21);
51
}
52
53
uint8_t
frame_size
()
const
{
54
return
((
raw
& 0xff800000) >> 23);
55
}
56
};
57
58
static_assert
(
sizeof
(arm64_packed_t) ==
sizeof
(uint32_t));
59
60
struct
arm64_unpacked_t
{
61
static
constexpr
auto
MAX_WORDS
= 2;
62
std::array<uint32_t, MAX_WORDS>
data
= {0};
63
64
uint32_t
function_length
()
const
{
65
return
(
data
[0] & 0x0003ffff) << 2;
66
}
67
68
uint8_t
version
()
const
{
69
return
(
data
[0] & 0x000C0000) >> 18;
70
}
71
72
bool
X
()
const
{
73
return
(
data
[0] & 0x00100000) >> 20;
74
}
75
76
uint8_t
E
()
const
{
77
return
(
data
[0] & 0x00200000) >> 21;
78
}
79
80
uint16_t
epilog_count
()
const
{
81
return
is_extended
() ? (
data
[1] & 0x0000ffff) :
82
(
data
[0] & 0x07C00000) >> 22;
83
}
84
85
uint8_t
code_words
()
const
{
86
return
is_extended
() ? (
data
[1] & 0x00ff0000) >> 16 :
87
(
data
[0] & 0xf8000000) >> 27;
88
}
89
90
bool
is_extended
()
const
{
91
return
(
data
[0] & 0xffc00000) == 0;
92
}
93
};
94
95
struct
arm64_epilog_scope_t
{
96
uint32_t
raw
;
97
98
uint32_t
start_offset
()
const
{
99
return
raw
& 0x0003ffff;
100
}
101
102
uint8_t
reserved
()
const
{
103
return
(
raw
& 0x000f0000) >> 18;
104
}
105
106
uint16_t
start_index
()
const
{
107
return
(
raw
& 0xffc00000) >> 22;
108
}
109
};
110
111
}
112
#endif
LIEF::PE::details
Definition
DataDirectory.hpp:37
LIEF::PE::details::xdata_unpacked_rva
uint32_t xdata_unpacked_rva(uint32_t value)
Definition
internal_arm64.hpp:22
LIEF::PE::details::arm64_epilog_scope_t
Definition
internal_arm64.hpp:95
LIEF::PE::details::arm64_epilog_scope_t::raw
uint32_t raw
Definition
internal_arm64.hpp:96
LIEF::PE::details::arm64_epilog_scope_t::reserved
uint8_t reserved() const
Definition
internal_arm64.hpp:102
LIEF::PE::details::arm64_epilog_scope_t::start_index
uint16_t start_index() const
Definition
internal_arm64.hpp:106
LIEF::PE::details::arm64_epilog_scope_t::start_offset
uint32_t start_offset() const
Definition
internal_arm64.hpp:98
LIEF::PE::details::arm64_packed_t
Definition
internal_arm64.hpp:26
LIEF::PE::details::arm64_packed_t::H
bool H() const
Definition
internal_arm64.hpp:45
LIEF::PE::details::arm64_packed_t::RF
uint8_t RF() const
Definition
internal_arm64.hpp:37
LIEF::PE::details::arm64_packed_t::RI
uint8_t RI() const
Definition
internal_arm64.hpp:41
LIEF::PE::details::arm64_packed_t::flags
uint8_t flags() const
Definition
internal_arm64.hpp:29
LIEF::PE::details::arm64_packed_t::raw
uint32_t raw
Definition
internal_arm64.hpp:27
LIEF::PE::details::arm64_packed_t::function_length
uint32_t function_length() const
Definition
internal_arm64.hpp:33
LIEF::PE::details::arm64_packed_t::frame_size
uint8_t frame_size() const
Definition
internal_arm64.hpp:53
LIEF::PE::details::arm64_packed_t::CR
uint8_t CR() const
Definition
internal_arm64.hpp:49
LIEF::PE::details::arm64_unpacked_t
Definition
internal_arm64.hpp:60
LIEF::PE::details::arm64_unpacked_t::version
uint8_t version() const
Definition
internal_arm64.hpp:68
LIEF::PE::details::arm64_unpacked_t::E
uint8_t E() const
Definition
internal_arm64.hpp:76
LIEF::PE::details::arm64_unpacked_t::code_words
uint8_t code_words() const
Definition
internal_arm64.hpp:85
LIEF::PE::details::arm64_unpacked_t::MAX_WORDS
static constexpr auto MAX_WORDS
Definition
internal_arm64.hpp:61
LIEF::PE::details::arm64_unpacked_t::epilog_count
uint16_t epilog_count() const
Definition
internal_arm64.hpp:80
LIEF::PE::details::arm64_unpacked_t::function_length
uint32_t function_length() const
Definition
internal_arm64.hpp:64
LIEF::PE::details::arm64_unpacked_t::is_extended
bool is_extended() const
Definition
internal_arm64.hpp:90
LIEF::PE::details::arm64_unpacked_t::data
std::array< uint32_t, MAX_WORDS > data
Definition
internal_arm64.hpp:62
LIEF::PE::details::arm64_unpacked_t::X
bool X() const
Definition
internal_arm64.hpp:72
Generated by
1.17.0