/* 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 . */ #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 */