From 2ddb5c26af896b10517a89abf0c9498c598b7697 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 12 Jan 2016 23:10:09 +0100
Subject: Disabled the old way to disassemble instructions.

---
 ChangeLog             |  13 +++
 src/arch/Makefile.am  |   1 -
 src/arch/artificial.c | 309 --------------------------------------------------
 src/arch/artificial.h |  71 ------------
 src/arch/processor.c  |   5 +-
 5 files changed, 17 insertions(+), 382 deletions(-)
 delete mode 100644 src/arch/artificial.c
 delete mode 100644 src/arch/artificial.h

diff --git a/ChangeLog b/ChangeLog
index 44486bc..c83a6b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 16-01-12  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/arch/Makefile.am:
+	Remove the 'artificial.[ch]' files from libarch_la_SOURCES.
+
+	* src/arch/artificial.c:
+	* src/arch/artificial.h:
+	Deleted entries. The features are provided by the 'raw.[ch]' files
+	for a while.
+
+	* src/arch/processor.c:
+	Disable the old way to disassemble instructions.
+
+16-01-12  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/analysis/disass/disassembler.c:
 	Update code.
 
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index aab7ec8..204ffbd 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libarch.la
 
 libarch_la_SOURCES =					\
 	archbase.h archbase.c				\
-	artificial.h artificial.c			\
 	context-int.h						\
 	context.h context.c					\
 	immediate.h immediate.c				\
diff --git a/src/arch/artificial.c b/src/arch/artificial.c
deleted file mode 100644
index a6fea56..0000000
--- a/src/arch/artificial.c
+++ /dev/null
@@ -1,309 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * artificial.c - instructions pures vues de l'esprit
- *
- * Copyright (C) 2009-2012 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/>.
- */
-
-
-#include "artificial.h"
-
-
-#include <string.h>
-
-
-#include "immediate.h"
-#include "instruction-int.h"
-
-
-
-/* ------------------------- INSTRUCTION INCONNUE / DONNEES ------------------------- */
-
-
-/* Définition générique d'une instruction d'architecture inconnue (instance) */
-struct _GDbInstruction
-{
-    GArchInstruction parent;                /* A laisser en premier        */
-
-#ifdef DEBUG
-    bool skipped;                           /* Donnée traitée              */
-#endif
-
-};
-
-/* Définition générique d'une instruction d'architecture inconnue (classe) */
-struct _GDbInstructionClass
-{
-    GArchInstructionClass parent;           /* A laisser en premier        */
-
-};
-
-
-/* Initialise la classe générique des opérandes. */
-static void g_db_instruction_class_init(GDbInstructionClass *);
-
-/* Initialise une instance d'opérande d'architecture. */
-static void g_db_instruction_init(GDbInstruction *);
-
-/* Supprime toutes les références externes. */
-static void g_db_instruction_dispose(GDbInstruction *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_db_instruction_finalize(GDbInstruction *);
-
-/* Reconstruit le cache complet d'une désignation d'instruction. */
-static void g_db_instruction_build_keyword(const GDbInstruction *, AsmSyntax);
-
-/* Informe sur une éventuelle référence à une autre instruction. */
-static InstructionLinkType g_db_instruction_get_link(const GDbInstruction *, vmpa_t *);
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/*                           INSTRUCTION INCONNUE / DONNEES                           */
-/* ---------------------------------------------------------------------------------- */
-
-
-/* Indique le type défini pour une instruction inconnue d'architecture. */
-G_DEFINE_TYPE(GDbInstruction, g_db_instruction, G_TYPE_ARCH_INSTRUCTION);
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : klass = classe à initialiser.                                *
-*                                                                             *
-*  Description : Initialise la classe générique des opérandes.                *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_db_instruction_class_init(GDbInstructionClass *klass)
-{
-    GObjectClass *object;                   /* Autre version de la classe  */
-    GArchInstructionClass *instr;           /* Encore une autre vision...  */
-
-    object = G_OBJECT_CLASS(klass);
-
-    object->dispose = (GObjectFinalizeFunc/* ! */)g_db_instruction_dispose;
-    object->finalize = (GObjectFinalizeFunc)g_db_instruction_finalize;
-
-    instr = G_ARCH_INSTRUCTION_CLASS(klass);
-
-    instr->build_key = (build_instruction_keyword_fc)g_db_instruction_build_keyword;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr = instance à initialiser.                              *
-*                                                                             *
-*  Description : Initialise une instance d'instruction d'architecture.        *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_db_instruction_init(GDbInstruction *instr)
-{
-    GArchInstruction *parent;               /* Instance parente            */
-
-    parent = G_ARCH_INSTRUCTION(instr);
-
-    parent->get_link = (get_instruction_link_fc)g_db_instruction_get_link;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr = instance d'objet GLib à traiter.                     *
-*                                                                             *
-*  Description : Supprime toutes les références externes.                     *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_db_instruction_dispose(GDbInstruction *instr)
-{
-    G_OBJECT_CLASS(g_db_instruction_parent_class)->dispose(G_OBJECT(instr));
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr = instance d'objet GLib à traiter.                     *
-*                                                                             *
-*  Description : Procède à la libération totale de la mémoire.                *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_db_instruction_finalize(GDbInstruction *instr)
-{
-    G_OBJECT_CLASS(g_db_instruction_parent_class)->finalize(G_OBJECT(instr));
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : data = flux de données à analyser.                           *
-*                pos  = position courante dans ce flux. [OUT]                 *
-*                end  = limite des données à analyser.                        *
-*                addr = adresse, virtuelle ou physique, de l'instruction.     *
-*                proc = architecture ciblée par le désassemblage.             *
-*                                                                             *
-*  Description : Crée une instruction de type 'db' à partir de données.       *
-*                                                                             *
-*  Retour      : Instruction mise en place.                                   *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-GArchInstruction *g_db_instruction_new_from_data(const bin_t *data, vmpa2t *address, off_t end, const GArchProcessor *proc)
-{
-    GArchInstruction *result;               /* Instruction à retourner     */
-    off_t pos;
-    off_t old;
-    GArchOperand *operand;                  /* Octet non décodé à afficher */
-
-    result = g_object_new(G_TYPE_DB_INSTRUCTION, NULL);
-
-    pos = get_phy_addr(address);
-    old = pos;
-
-    operand = g_imm_operand_new_from_data_old(g_arch_processor_get_instruction_size(proc),
-                                          data, &pos, end,
-                                          g_arch_processor_get_endianness(proc));
-
-    address->physical += (pos - old);
-
-    /* FIXME : essayer une taille plus petite en cas d'échec (on peut être en bout de binaire) */
-
-    if (operand == NULL) goto gdinfd_error;
-
-    g_imm_operand_pad(G_IMM_OPERAND(operand), true);
-
-    g_arch_instruction_attach_extra_operand(result, operand);
-
-    return result;
-
- gdinfd_error:
-
-    g_object_unref(G_OBJECT(result));
-
-    return NULL;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr  = instruction à traiter.                              *
-*                format = format du binaire manipulé.                         *
-*                syntax = type de représentation demandée.                    *
-*                                                                             *
-*  Description : Reconstruit le cache complet d'une désignation d'instruction.*
-*                                                                             *
-*  Retour      : Mot clef de bas niveau.                                      *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_db_instruction_build_keyword(const GDbInstruction *instr, AsmSyntax syntax)
-{
-    G_ARCH_INSTRUCTION(instr)->cached_keyword = strdup("db");
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr = instruction à consulter.                             *
-*                addr  = eventuelle adresse associée à faire connaître. [OUT] *
-*                                                                             *
-*  Description : Informe sur une éventuelle référence à une autre instruction.*
-*                                                                             *
-*  Retour      : Type de lien trouvé ou ILT_NONE si aucun.                    *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static InstructionLinkType g_db_instruction_get_link(const GDbInstruction *instr, vmpa_t *addr)
-{
-    return ILT_NONE;
-
-}
-
-
-#ifdef DEBUG
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr = instruction à mettre à jour.                         *
-*                                                                             *
-*  Description : Marque une donnée comme ayant été considérée au sein du code.*
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-void g_db_instruction_mark_as_skipped(GDbInstruction *instr)
-{
-    instr->skipped = true;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : instr = instruction à consulter.                             *
-*                                                                             *
-*  Description : Indique si une donnée fait partie du code exécutable.        *
-*                                                                             *
-*  Retour      : true si la donnée est intégrée dans le code, false sinon.    *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool g_db_instruction_is_skipped(const GDbInstruction *instr)
-{
-    return instr->skipped;
-
-}
-
-#endif
diff --git a/src/arch/artificial.h b/src/arch/artificial.h
deleted file mode 100644
index 65eb4fe..0000000
--- a/src/arch/artificial.h
+++ /dev/null
@@ -1,71 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * artificial.h - prototypes pour les instructions pures vues de l'esprit
- *
- * Copyright (C) 2009-2012 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_ARTIFICIAL_H
-#define _ARCH_ARTIFICIAL_H
-
-
-#include <glib-object.h>
-
-
-#include "archbase.h"
-#include "processor.h"
-#include "vmpa.h"
-
-
-
-/* ------------------------- INSTRUCTION INCONNUE / DONNEES ------------------------- */
-
-
-#define G_TYPE_DB_INSTRUCTION                   g_db_instruction_get_type()
-#define G_DB_INSTRUCTION(obj)                   (G_TYPE_CHECK_INSTANCE_CAST((obj), g_db_instruction_get_type(), GDbInstruction))
-#define G_IS_DB_INSTRUCTION(obj)                (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_db_instruction_get_type()))
-#define G_DB_INSTRUCTION_GET_IFACE(inst)        (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_db_instruction_get_type(), GDbInstructionIface))
-
-
-/* Définition générique d'une instruction d'architecture inconnue (instance) */
-typedef struct _GDbInstruction GDbInstruction;
-
-/* Définition générique d'une instruction d'architecture inconnue (classe) */
-typedef struct _GDbInstructionClass GDbInstructionClass;
-
-
-/* Indique le type défini pour une instruction inconnue d'architecture. */
-GType g_db_instruction_get_type(void);
-
-/* Crée une instruction de type 'db' à partir de données. */
-GArchInstruction *g_db_instruction_new_from_data(const bin_t *, vmpa2t *, off_t, const GArchProcessor *);
-
-#ifdef DEBUG
-
-/*  Marque une donnée comme ayant été considérée au sein du code. */
-void g_db_instruction_mark_as_skipped(GDbInstruction *);
-
-/* Indique si une donnée fait partie du code exécutable. */
-bool g_db_instruction_is_skipped(const GDbInstruction *);
-
-#endif
-
-
-
-#endif  /* _ARCH_ARTIFICIAL_H */
diff --git a/src/arch/processor.c b/src/arch/processor.c
index cb00a2d..91f9821 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -45,7 +45,6 @@
 
 
 
-#include "artificial.h"
 
 
 
@@ -250,6 +249,7 @@ MemoryDataSize g_arch_processor_get_instruction_size(const GArchProcessor *proc)
 
 GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *proc, GProcContext *ctx, const bin_t *data, off_t *pos, off_t end, vmpa_t addr, GBinFormat *format)
 {
+#if 0
     GArchInstruction *result;               /* Instruction à renvoyer      */
     off_t old_pos;                          /* Sauvegarde de la position   */
     bool skipped;                           /* Données prise en compte ?   */
@@ -276,6 +276,9 @@ GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *proc
     //g_arch_instruction_set_location(result, old_pos, *pos - old_pos, addr);
 
     return result;
+#endif
+
+    return NULL;
 
 }
 
-- 
cgit v0.11.2-87-g4458