1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/* Chrysalide - Outil d'analyse de fichiers binaires
* helpers.h - prototypes pour l'aide à la mise en place des opérandes ARMv7
*
* Copyright (C) 2014 Cyrille Bagard
*
* This file is part of Chrysalide.
*
* OpenIDA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* OpenIDA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ARCH_ARM_V7_HELPERS_H
#define _ARCH_ARM_V7_HELPERS_H
#include <libio.h>
#include "pseudo.h"
#include "../../operand.h"
#define ARMExpandImm_C(imm12, c) \
({ \
uint32_t __val; \
__val = armv7_arm_expand_imm_c(imm12, (bool []) { c }); \
g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
})
#define ARMExpandImm(imm12) \
({ \
uint32_t __val; \
__val = armv7_arm_expand_imm_c(imm12, NULL); \
g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
})
#define ZeroExtend(x, n, i) \
({ \
MemoryDataSize __mds; \
uint ## i ## _t __val; \
mds = MDS_ ## sz ## _BITS_UNSIGNED; \
__val = armv7_zero_extend(x, n, i); \
g_imm_operand_new_from_value(__mds, __val); \
})
#define Zeros(i) \
({ \
MemoryDataSize __mds; \
uint ## i ## _t __val; \
mds = MDS_ ## sz ## _BITS_UNSIGNED; \
__val = 0; \
g_imm_operand_new_from_value(__mds, __val); \
})
/* Effectue une rotation vers la droit d'une valeur. */
GArchOperand *ror_armv7_imm(uint32_t, unsigned int);
/* Crée un opérande de valeur immédiate avec extension de signe. */
GArchOperand *sign_extend_armv7_imm(uint32_t, bool, unsigned int);
/* Etend une valeur immédiate en mode 'Thumb' ARMv7. */
GArchOperand *thumb_expand_armv7_imm(uint32_t);
/* Crée un opérande représentant un registre ARMv7. */
GArchOperand *translate_armv7_register(uint8_t);
/* Réalise un simple transtypage de valeur entière. */
GArchOperand *zero_extend_armv7_imm(uint32_t, unsigned int);
#endif /* _ARCH_ARM_V7_HELPERS_H */
|