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
* immediate-int.h - définitions internes propres aux opérandes représentant des valeurs numériques
*
* Copyright (C) 2021-2024 Cyrille Bagard
*
* This file is part of Chrysalide.
*
* Chrysalide 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.
*
* Chrysalide 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ARCH_OPERANDS_IMMEDIATE_INT_H
#define _ARCH_OPERANDS_IMMEDIATE_INT_H
#include "immediate.h"
#include "../operand-int.h"
/* Définition d'un opérande de valeur numérique (instance) */
struct _GImmediateOperand
{
GArchOperand parent; /* Instance parente */
uint64_t raw; /* Valeur transtypée */
};
/* Définition d'un opérande de valeur numérique (classe) */
struct _GImmediateOperandClass
{
GArchOperandClass parent; /* Classe parente */
};
/**
* Accès aux informations éventuellement déportées.
*/
/* Informations glissées dans la structure GObject de GArchOperand */
typedef struct _immop_extra_data_t
{
ARCH_OPERAND_EXTRA_DATA(3); /* Informations pour l'opérande*/
/**
* MemoryDataSize
*/
unsigned int size : 4; /* Taille de l'opérande */
/**
* ImmOperandDisplay x 2
*/
unsigned int def_display : 3; /* Type par défaut d'affichage */
unsigned int display : 3; /* Format général d'affichage */
} immop_extra_data_t;
#define GET_IMM_OP_EXTRA(op) \
GET_GOBJECT_EXTRA(op, immop_extra_data_t)
#define SET_IMM_OP_EXTRA(op, data) \
SET_GOBJECT_EXTRA(op, immop_extra_data_t, data)
/* Met en place un opérande réprésentant une valeur numérique. */
bool g_immediate_operand_create_from_value(GImmediateOperand *, MemoryDataSize, uint64_t);
/* Crée un opérande réprésentant une valeur numérique. */
bool g_immediate_operand_create_from_data(GImmediateOperand *, MemoryDataSize, const GBinContent *, vmpa2t *, bool *, SourceEndian);
/**
* La taille d'impression d'un opérande n'est pas VMPA_MAX_SIZE,
* mais 1 + 64 caractères + octet nul final en cas d'impression en binaire.
*/
#define IMM_MAX_SIZE 66
/* Construit la chaîne de caractères correspondant à l'opérande. */
size_t _g_immediate_operand_to_string(const GImmediateOperand *, ImmOperandDisplay, char [IMM_MAX_SIZE]);
#endif /* _ARCH_OPERANDS_IMMEDIATE_INT_H */
|