summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-05-11 23:42:48 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-05-11 23:42:48 (GMT)
commit96cb6971ee3ca529958b8cb1e8e55a6eb4e60eae (patch)
tree68e49f325de3e93ef186d3e078da8ddc473aedf7
parent80dc0ac97987ad9246bee7c47458a015339453bf (diff)
Reorganized the way the program is built again and added partial support for the JVM.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@63 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog116
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am32
-rwxr-xr-xsrc/analysis/Makefile.am2
-rw-r--r--src/analysis/binary.c41
-rw-r--r--src/analysis/line.c2
-rw-r--r--src/analysis/line.h2
-rw-r--r--src/analysis/line_code.c20
-rw-r--r--src/analysis/line_code.h2
-rw-r--r--src/arch/Makefile.am11
-rw-r--r--src/arch/archbase.h64
-rw-r--r--src/arch/artificial.c168
-rw-r--r--src/arch/artificial.h60
-rw-r--r--src/arch/immediate.c256
-rw-r--r--src/arch/immediate.h58
-rw-r--r--src/arch/instruction-int.h61
-rw-r--r--src/arch/instruction.c156
-rw-r--r--src/arch/instruction.h59
-rw-r--r--src/arch/jvm/Makefile.am32
-rw-r--r--src/arch/jvm/instruction.c300
-rw-r--r--src/arch/jvm/instruction.h149
-rw-r--r--src/arch/jvm/op_add.c55
-rw-r--r--src/arch/jvm/op_const.c87
-rw-r--r--src/arch/jvm/op_convert.c433
-rw-r--r--src/arch/jvm/op_dup.c190
-rw-r--r--src/arch/jvm/op_getput.c62
-rw-r--r--src/arch/jvm/op_invoke.c128
-rw-r--r--src/arch/jvm/op_load.c92
-rw-r--r--src/arch/jvm/op_monitor.c82
-rw-r--r--src/arch/jvm/op_nop.c55
-rw-r--r--src/arch/jvm/op_pop.c82
-rw-r--r--src/arch/jvm/op_ret.c184
-rw-r--r--src/arch/jvm/op_store.c60
-rw-r--r--src/arch/jvm/opcodes.h160
-rw-r--r--src/arch/jvm/operand.c331
-rw-r--r--src/arch/jvm/operand.h107
-rw-r--r--src/arch/jvm/processor.c346
-rw-r--r--src/arch/jvm/processor.h53
-rw-r--r--src/arch/operand-int.h42
-rw-r--r--src/arch/operand.c83
-rw-r--r--src/arch/operand.h29
-rw-r--r--src/arch/processor-int.h53
-rw-r--r--src/arch/processor.c157
-rw-r--r--src/arch/processor.h52
-rw-r--r--src/arch/x86/Makefile.am2
-rw-r--r--src/arch/x86/processor.c4
-rwxr-xr-xsrc/common/endianness.c6
-rwxr-xr-xsrc/common/endianness.h11
-rw-r--r--src/common/extstr.c66
-rw-r--r--src/common/extstr.h5
-rw-r--r--src/editor.c1
-rw-r--r--src/format/Makefile.am9
-rw-r--r--src/format/dwarf/Makefile.am2
-rw-r--r--src/format/elf/Makefile.am2
-rw-r--r--src/format/elf/symbol.c6
-rw-r--r--src/format/exe_format-int.h4
-rw-r--r--src/format/exe_format.c19
-rw-r--r--src/format/exe_format.h16
-rwxr-xr-xsrc/format/java/Makefile.am2
-rwxr-xr-xsrc/format/java/e_java.c111
-rw-r--r--src/format/java/method.c32
-rw-r--r--src/format/java/method.h4
-rwxr-xr-xsrc/format/java/pool.c140
-rwxr-xr-xsrc/format/java/pool.h16
-rw-r--r--src/format/mangling/Makefile.am2
-rwxr-xr-xsrc/format/pe/Makefile.am2
-rw-r--r--src/gtkext/Makefile.am2
-rwxr-xr-xsrc/panel/Makefile.am5
-rw-r--r--src/plugins/Makefile.am6
-rw-r--r--src/plugins/overjump/overjump.c1
70 files changed, 4839 insertions, 152 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c237d7..c4cb704 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,119 @@
+09-05-12 Cyrille Bagard <nocbos@gmail.com>
+
+ * configure.ac:
+ Add the new Makefile from 'src/arch/jvm' directory to AC_CONFIG_FILES.
+
+ * src/analysis/binary.c:
+ Update code. The used processor is now fully abstract.
+
+ * src/analysis/line.c:
+ * src/analysis/line_code.c:
+ * src/analysis/line_code.h:
+ * src/analysis/line.h:
+ Update code.
+
+ * src/analysis/Makefile.am:
+ Reorganize the way the program is built.
+
+ * src/arch/archbase.h:
+ New entry: define basic types and enumerations.
+
+ * src/arch/artificial.c:
+ * src/arch/artificial.h:
+ * src/arch/immediate.c:
+ * src/arch/immediate.h:
+ New entries: define common operands and instructions.
+
+ * src/arch/instruction.c:
+ * src/arch/instruction.h:
+ * src/arch/instruction-int.h:
+ Define new instructions (in a GLib way).
+
+ * src/arch/jvm/instruction.c:
+ * src/arch/jvm/instruction.h:
+ * src/arch/jvm/Makefile.am:
+ * src/arch/jvm/op_add.c:
+ * src/arch/jvm/opcodes.h:
+ * src/arch/jvm/op_const.c:
+ * src/arch/jvm/op_convert.c:
+ * src/arch/jvm/op_dup.c:
+ * src/arch/jvm/operand.c:
+ * src/arch/jvm/operand.h:
+ * src/arch/jvm/op_getput.c:
+ * src/arch/jvm/op_invoke.c:
+ * src/arch/jvm/op_load.c:
+ * src/arch/jvm/op_monitor.c:
+ * src/arch/jvm/op_nop.c:
+ * src/arch/jvm/op_pop.c:
+ * src/arch/jvm/op_ret.c:
+ * src/arch/jvm/op_store.c:
+ * src/arch/jvm/processor.c:
+ * src/arch/jvm/processor.h:
+ New entries: add partial support for the JVM.
+
+ * src/arch/Makefile.am:
+ Reorganize the way the program is built.
+
+ * src/arch/operand.c:
+ * src/arch/operand.h:
+ * src/arch/operand-int.h:
+ Define new operands (in a GLib way).
+
+ * src/arch/processor.c:
+ * src/arch/processor.h:
+ * src/arch/processor-int.h:
+ Define new processors (in a GLib way).
+
+ * src/arch/x86/Makefile.am:
+ Reorganize the way the program is built.
+
+ * src/arch/x86/processor.c:
+ Update code.
+
+ * src/common/endianness.c:
+ * src/common/endianness.h:
+ Update prototypes.
+
+ * src/common/extstr.c:
+ * src/common/extstr.h:
+ Add a function to replace strings in a string.
+
+ * src/editor.c:
+ Init all processors.
+
+ * src/format/dwarf/Makefile.am:
+ * src/format/elf/Makefile.am:
+ Reorganize the way the program is built.
+
+ * src/format/elf/symbol.c:
+ Disable some hardcoded calls.
+
+ * src/format/exe_format.c:
+ * src/format/exe_format.h:
+ * src/format/exe_format-int.h:
+ Make the code more generic.
+
+ * src/format/java/e_java.c:
+ * src/format/java/Makefile.am:
+ * src/format/java/method.c:
+ * src/format/java/method.h:
+ * src/format/java/pool.c:
+ * src/format/java/pool.h:
+ Add needed extra functions to deal with JVM opcodes.
+
+ * src/format/Makefile.am:
+ * src/format/mangling/Makefile.am:
+ * src/format/pe/Makefile.am:
+ * src/gtkext/Makefile.am:
+ * src/Makefile.am:
+ * src/panel/Makefile.am:
+ * src/plugins/Makefile.am:
+ Reorganize the way the program is built.
+
+ * src/plugins/overjump/overjump.c:
+ Remove the definition of vmpa_t (cf. archbase.h).
+
+
2009-05-11 Cyrille Bagard <nocbos@gmail.com>
* src/analysis/Makefile.am:
diff --git a/configure.ac b/configure.ac
index 151ffa4..68195e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,6 +219,7 @@ AC_CONFIG_FILES([Makefile
src/Makefile
src/analysis/Makefile
src/arch/Makefile
+ src/arch/jvm/Makefile
src/arch/x86/Makefile
src/common/Makefile
src/debug/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index b7c2fa5..dd5d1ea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = liboidadisass.la liboidagtkext.la
+lib_LTLIBRARIES = liboidadisass.la liboidagtkext.la liboidagui.la liboidaplugin.la
bin_PROGRAMS=openida
@@ -19,13 +19,7 @@ liboidadisass_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS) \
liboidadisass_la_LIBADD = \
analysis/libanalysis.la \
arch/libarch.la \
- arch/x86/libarchx86.la \
- format/libformat.la \
- format/dwarf/libformatdwarf.la \
- format/elf/libformatelf.la \
- format/java/libformatjava.la \
- format/mangling/libformatmangling.la \
- format/pe/libformatpe.la
+ format/libformat.la
#--- liboidagtkext
@@ -39,6 +33,28 @@ liboidagtkext_la_LIBADD = \
gtkext/libgtkext.la
+#--- liboidagui
+
+liboidagui_la_SOURCES =
+
+liboidagui_la_LDFLAGS = $(LIBGTK_LIBS) \
+ -L.libs -loidagtkext
+
+liboidagui_la_LIBADD = \
+ panel/libpanel.la
+
+
+#--- liboidaplugin
+
+liboidaplugin_la_SOURCES =
+
+liboidaplugin_la_LDFLAGS = $(LIBGTK_LIBS) \
+ -L.libs -loidadisass -loidagui
+
+liboidaplugin_la_LIBADD = \
+ plugins/libplugins.la
+
+
############################################################
# Programme principal
diff --git a/src/analysis/Makefile.am b/src/analysis/Makefile.am
index 065704a..f763f53 100755
--- a/src/analysis/Makefile.am
+++ b/src/analysis/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libanalysis.la
+noinst_LTLIBRARIES = libanalysis.la
libanalysis_la_SOURCES = \
binary.h binary.c \
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index b606752..e5e14bc 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -46,8 +46,6 @@
-
-
#ifndef _
# define _(str) str
#endif
@@ -68,7 +66,7 @@ struct _openida_binary
uint8_t *bin_data; /* Données binaires brutes */
exe_format *format; /* Format du binaire */
- asm_processor *proc; /* Architecture du binaire */
+ GArchProcessor *proc; /* Architecture du binaire */
GRenderingLine *lines; /* Lignes de rendu en place */
disass_options options; /* Options de désassemblage */
@@ -116,9 +114,17 @@ openida_binary *load_binary_file(const char *filename)
result->format = load_new_exe_format(result->bin_data, result->bin_length);
if (result->format == NULL) goto lbf_error;
+ switch (get_exe_target_machine(result->format))
+ {
+ case FTM_JVM:
+ result->proc = get_arch_processor_for_type(APT_JVM);
+ break;
- result->proc = create_processor();
+ default:
+ goto lbf_error;
+ break;
+ }
result->options.show_address = true;
result->options.show_code = true;
@@ -573,7 +579,9 @@ GRenderingLine *build_binary_prologue(const char *filename, const uint8_t *data,
void disassemble_openida_binary(openida_binary *binary)
{
- asm_instr *instr;
+
+
+ GArchInstruction *instr;
bin_routine **routines; /* Liste des routines trouvées */
size_t routines_count; /* Nombre de ces routines */
@@ -591,7 +599,7 @@ void disassemble_openida_binary(openida_binary *binary)
off_t len;
uint64_t base = 0;
- uint64_t offset = 0;
+ vmpa_t addr = 0;
size_t i;
@@ -616,14 +624,16 @@ void disassemble_openida_binary(openida_binary *binary)
disass = get_one_plugin_for_action(PGA_DISASSEMBLE);
- if (disass != NULL)
+ if (0 && disass != NULL)
binary->lines = g_plugin_module_disassemble_binary_parts(disass, binary);
else
{
- parts = get_elf_default_code_parts(binary->format, &parts_count);
+ parts = get_java_default_code_parts(binary->format, &parts_count);
qsort(parts, parts_count, sizeof(bin_part *), compare_bin_parts);
+ printf("PARTS COUNT :: %d\n", parts_count);
+
for (i = 0; i < parts_count; i++)
{
get_bin_part_values(parts[i], &pos, &len, &base);
@@ -635,19 +645,18 @@ void disassemble_openida_binary(openida_binary *binary)
while (pos < len)
{
- offset = base + pos;
+ addr = base + pos;
- instr = decode_instruction(binary->proc, &binary->bin_data[start], &pos, len, start, offset);
+ instr = g_arch_processor_decode_instruction(binary->proc, &binary->bin_data[start], &pos, len, start, addr);
-
- line = g_code_line_new(offset, instr, &binary->options);
+ line = g_code_line_new(addr, instr, &binary->options);
g_rendering_line_add_to_lines(&binary->lines, line);
}
/* Ajout des prototypes de fonctions */
-
+#if 0
for (k = 0; k < routines_count; k++)
{
routine_offset = get_binary_routine_offset(routines[k]);
@@ -662,16 +671,16 @@ void disassemble_openida_binary(openida_binary *binary)
free(routine_desc);
}
-
+#endif
}
}
-
+ /*
line = g_rendering_line_find_by_offset(binary->lines, get_exe_entry_point(binary->format));
if (line != NULL) g_rendering_line_add_flag(line, RLF_ENTRY_POINT);
-
+ */
diff --git a/src/analysis/line.c b/src/analysis/line.c
index fb8295e..b1af518 100644
--- a/src/analysis/line.c
+++ b/src/analysis/line.c
@@ -38,8 +38,6 @@
-/* FIXME */
-//extern GtkWidget *mywid;
diff --git a/src/analysis/line.h b/src/analysis/line.h
index 0213cab..5744d24 100644
--- a/src/analysis/line.h
+++ b/src/analysis/line.h
@@ -60,7 +60,7 @@ typedef struct _disass_options
bool show_code; /* Affichage du code brut ? */
exe_format *format; /* Format du contenu bianire */
- asm_processor *proc; /* Architecture utilisée */
+ GArchProcessor *proc; /* Architecture utilisée */
} disass_options;
diff --git a/src/analysis/line_code.c b/src/analysis/line_code.c
index 2dd5a7c..44bb59f 100644
--- a/src/analysis/line_code.c
+++ b/src/analysis/line_code.c
@@ -37,7 +37,7 @@ struct _GCodeLine
{
GRenderingLine parent; /* Instance parente */
- asm_instr *instr; /* Instruction représentée */
+ GArchInstruction *instr; /* Instruction représentée */
const disass_options *options; /* Options de représentation */
};
@@ -133,7 +133,7 @@ void g_code_line_get_binary_len(GCodeLine *line, off_t *blen)
{
off_t len; /* Taille propre à la ligne */
- get_asm_instr_offset_and_length(line->instr, NULL, &len);
+ g_arch_instruction_get_location(line->instr, NULL, &len, NULL);
*blen = MAX(*blen, len);
@@ -158,7 +158,8 @@ void g_code_line_refresh_markup(GCodeLine *line)
char *content; /* Contenu réellement imprimé */
off_t bin_offset; /* Début de l'instruction */
off_t bin_len; /* Taille d'instruction */
- char buffer[CODE_BUFFER_LEN]; /* Zone tampon à utiliser */
+ char buffer[CODE_BUFFER_LEN]; /* Zone tampon à utiliser #1 */
+ char *buffer2; /* Zone tampon à utiliser #2 */
const uint8_t *exe_content; /* Contenu binaire global */
char *bin_code; /* Tampon du code binaire */
off_t k; /* Boucle de parcours #2 */
@@ -169,7 +170,7 @@ void g_code_line_refresh_markup(GCodeLine *line)
strcpy(content, "<tt>");
if (line->options->show_code)
- get_asm_instr_offset_and_length(line->instr, &bin_offset, &bin_len);
+ g_arch_instruction_get_location(line->instr, &bin_offset, &bin_len, NULL);
/* Eventuelle adresse virtuelle */
@@ -230,15 +231,16 @@ void g_code_line_refresh_markup(GCodeLine *line)
/* Instruction proprement dite */
- print_hinstruction(line->options->proc, line->options->format,
- line->instr, buffer, CODE_BUFFER_LEN, ASX_INTEL/*FIXME*/);
+ buffer2 = g_arch_instruction_get_text(line->instr, line->options->format, ASX_INTEL/*FIXME*/);
if (line->options->show_address || line->options->show_code) len += strlen("\t");
- len += strlen(buffer);
+ len += strlen(buffer2);
content = (char *)realloc(content, len * sizeof(char));
if (line->options->show_address || line->options->show_code) strcat(content, "\t");
- strcat(content, buffer);
+ strcat(content, buffer2);
+
+ free(buffer2);
/* Finalisation */
@@ -267,7 +269,7 @@ void g_code_line_refresh_markup(GCodeLine *line)
* *
******************************************************************************/
-GRenderingLine *g_code_line_new(uint64_t offset, asm_instr *instr, const disass_options *options)
+GRenderingLine *g_code_line_new(uint64_t offset, GArchInstruction *instr, const disass_options *options)
{
GCodeLine *result; /* Structure à retourner */
diff --git a/src/analysis/line_code.h b/src/analysis/line_code.h
index 3564038..8a06f28 100644
--- a/src/analysis/line_code.h
+++ b/src/analysis/line_code.h
@@ -52,7 +52,7 @@ typedef struct _GCodeLineClass GCodeLineClass;
GType g_code_line_get_type(void);
/* Crée une ligne de code binaire. */
-GRenderingLine *g_code_line_new(uint64_t, asm_instr *, const disass_options *);
+GRenderingLine *g_code_line_new(uint64_t, GArchInstruction *, const disass_options *);
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index da522df..1fb49a8 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -1,7 +1,10 @@
-lib_LTLIBRARIES = libarch.la
+noinst_LTLIBRARIES = libarch.la
libarch_la_SOURCES = \
+ archbase.h \
+ artificial.h artificial.c \
+ immediate.h immediate.c \
instruction-int.h \
instruction.h instruction.c \
operand-int.h \
@@ -9,7 +12,9 @@ libarch_la_SOURCES = \
processor-int.h \
processor.h processor.c
-libarch_la_LIBADD =
+libarch_la_LIBADD = \
+ jvm/libarchjvm.la \
+ x86/libarchx86.a
libarch_la_LDFLAGS =
@@ -21,4 +26,4 @@ AM_CPPFLAGS =
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = x86
+SUBDIRS = jvm #x86
diff --git a/src/arch/archbase.h b/src/arch/archbase.h
new file mode 100644
index 0000000..02e4ae8
--- /dev/null
+++ b/src/arch/archbase.h
@@ -0,0 +1,64 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * archbase.h - prototypes des définitions de base pour les architectures
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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_ARCHBASE_H
+#define _ARCH_ARCHBASE_H
+
+
+#include <stdint.h>
+
+
+
+/* Octet de données binaires */
+typedef uint8_t bin_t;
+
+/* Adresse mémoire ou position physique */
+typedef uint64_t vmpa_t;
+
+
+/* Taille des données intégrées */
+typedef enum _MemoryDataSize
+{
+ MDS_UNDEFINED, /* Taille non définie */
+
+ MDS_8_BITS_UNSIGNED, /* Opérande sur 8 bits n.-s. */
+ MDS_16_BITS_UNSIGNED, /* Opérande sur 16 bits n.-s. */
+ MDS_32_BITS_UNSIGNED, /* Opérande sur 32 bits n.-s. */
+ MDS_64_BITS_UNSIGNED, /* Opérande sur 64 bits n.-s. */
+
+ MDS_8_BITS_SIGNED, /* Opérande sur 8 bits signés */
+ MDS_16_BITS_SIGNED, /* Opérande sur 16 bits signés */
+ MDS_32_BITS_SIGNED, /* Opérande sur 32 bits signés */
+ MDS_64_BITS_SIGNED /* Opérande sur 64 bits signés */
+
+} MemoryDataSize;
+
+
+#define MDS_8_BITS MDS_8_BITS_UNSIGNED
+#define MDS_16_BITS MDS_16_BITS_UNSIGNED
+#define MDS_32_BITS MDS_32_BITS_UNSIGNED
+#define MDS_64_BITS MDS_64_BITS_UNSIGNED
+
+
+
+#endif /* _ARCH_ARCHBASE_H */
diff --git a/src/arch/artificial.c b/src/arch/artificial.c
new file mode 100644
index 0000000..d718a8c
--- /dev/null
+++ b/src/arch/artificial.c
@@ -0,0 +1,168 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * artificial.c - instructions pures vues de l'esprit
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "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 */
+
+};
+
+/* 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 *);
+
+/* Traduit une instruction en version humainement lisible. */
+static const char *g_db_instruction_get_text(const GDbInstruction *, const exe_format *, AsmSyntax);
+
+
+/* ---------------------------------------------------------------------------------- */
+/* 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)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* 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_text = (get_instruction_text_fc)g_db_instruction_get_text;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale 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, off_t *pos, off_t len, vmpa_t addr, const GArchProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ GArchOperand *operand; /* Octet non décodé à afficher */
+
+ result = g_object_new(G_TYPE_DB_INSTRUCTION, NULL);
+
+ operand = g_imm_operand_new_from_data(MDS_8_BITS, data, pos, len,
+ g_arch_processor_get_endianness(proc));
+ if (operand == NULL) goto gdinfd_error;
+
+ g_arch_instruction_attach_one_operand(result, operand);
+
+ return result;
+
+ gdinfd_error:
+
+ /* TODO */
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction à traiter. *
+* format = format du binaire manipulé. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit une instruction en version humainement lisible. *
+* *
+* Retour : Chaîne de caractères à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static const char *g_db_instruction_get_text(const GDbInstruction *instr, const exe_format *format, AsmSyntax syntax)
+{
+ return "db";
+
+}
diff --git a/src/arch/artificial.h b/src/arch/artificial.h
new file mode 100644
index 0000000..3e98595
--- /dev/null
+++ b/src/arch/artificial.h
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * artificial.h - prototypes pour les instructions pures vues de l'esprit
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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"
+
+
+
+/* ------------------------- 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(), GArchOperand))
+#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(), GArchOperandIface))
+
+
+/* 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 *, off_t *, off_t, vmpa_t, const GArchProcessor *);
+
+
+
+#endif /* _ARCH_ARTIFICIAL_H */
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
new file mode 100644
index 0000000..c1ad73c
--- /dev/null
+++ b/src/arch/immediate.c
@@ -0,0 +1,256 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * immediate.c - opérandes représentant des valeurs numériques
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "immediate.h"
+
+
+#include <malloc.h>
+#include <stdio.h>
+
+
+#include "operand-int.h"
+
+
+
+/* Définition d'un opérande de valeur numérique (instance) */
+struct _GImmOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ AsmOperandSize size; /* Taille de l'opérande */
+
+ /**
+ * Note : dans le cas d'une valeur signée,
+ * signed_imm contient la valeur lue/donnée, et
+ * unsigned_imm la valeur humainement lisible (ie. positive).
+ */
+
+ union
+ {
+ uint8_t val8; /* Valeur sur 8 bits */
+ uint16_t val16; /* Valeur sur 16 bits */
+ uint32_t val32; /* Valeur sur 32 bits */
+ uint64_t val64; /* Valeur sur 64 bits */
+
+ } unsigned_imm;
+
+ union
+ {
+ uint8_t val8; /* Valeur sur 8 bits */
+ uint16_t val16; /* Valeur sur 16 bits */
+ uint32_t val32; /* Valeur sur 32 bits */
+ uint64_t val64; /* Valeur sur 64 bits */
+
+ } signed_imm;
+
+};
+
+
+/* Définition d'un opérande de valeur numérique (classe) */
+struct _GImmOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des lignes de descriptions initiales. */
+static void g_imm_operand_class_init(GImmOperandClass *);
+
+/* Initialise la classe des lignes de descriptions initiales. */
+static void g_imm_operand_init(GImmOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static char *g_imm_operand_get_text(const GImmOperand *, const exe_format *, AsmSyntax);
+
+
+/* Indique le type défini pour un opérande de valeur numérique. */
+G_DEFINE_TYPE(GImmOperand, g_imm_operand, G_TYPE_ARCH_OPERAND);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des lignes de descriptions initiales. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_imm_operand_class_init(GImmOperandClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise la classe des lignes de descriptions initiales. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_imm_operand_init(GImmOperand *operand)
+{
+ GArchOperand *parent; /* Instance parente */
+
+ parent = G_ARCH_OPERAND(operand);
+
+ parent->get_text = (get_operand_text_fc)g_imm_operand_get_text;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : size = taille de l'opérande souhaitée. *
+* data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* endian = ordre des bits dans la source. *
+* *
+* Description : Crée un opérande réprésentant une valeur numérique. *
+* *
+* Retour : Instruction mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_imm_operand_new_from_data(MemoryDataSize size, const bin_t *data, off_t *pos, off_t len, SourceEndian endian)
+{
+ GImmOperand *result; /* Instruction à retourner */
+
+ result = g_object_new(G_TYPE_IMM_OPERAND, NULL);
+
+ result->size = size;
+
+ switch (size)
+ {
+ case AOS_8_BITS_UNSIGNED:
+ if (!read_u8(&result->unsigned_imm.val8, data, pos, len, endian))
+ goto gionfd_error;
+ break;
+
+
+
+
+ }
+
+ return G_ARCH_OPERAND(result);
+
+ gionfd_error:
+
+ /* TODO : free */
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* format = format du binaire manipulé. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : Chaîne de caractères à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format *format, AsmSyntax syntax)
+{
+ char *result; /* Chaîne à retourner */
+
+ result = (char *)calloc(19, sizeof(char));
+
+ switch (syntax)
+ {
+ case ASX_INTEL:
+ switch (operand->size)
+ {
+ case MDS_UNDEFINED:
+ snprintf(result, 19, "$0x???");
+ break;
+ case AOS_8_BITS_UNSIGNED:
+ case AOS_8_BITS_SIGNED:
+ snprintf(result, 19, "0x%hhx", operand->unsigned_imm.val8);
+ break;
+ case AOS_16_BITS_UNSIGNED:
+ case AOS_16_BITS_SIGNED:
+ snprintf(result, 19, "0x%hx", operand->unsigned_imm.val16);
+ break;
+ case AOS_32_BITS_UNSIGNED:
+ case AOS_32_BITS_SIGNED:
+ snprintf(result, 19, "0x%x", operand->unsigned_imm.val32);
+ break;
+ case AOS_64_BITS_UNSIGNED:
+ case AOS_64_BITS_SIGNED:
+ snprintf(result, 19, "0x%llx", operand->unsigned_imm.val64);
+ break;
+ }
+ break;
+
+ case ASX_ATT:
+ switch (operand->size)
+ {
+ case MDS_UNDEFINED:
+ snprintf(result, 19, "$0x???");
+ break;
+ case AOS_8_BITS_UNSIGNED:
+ case AOS_8_BITS_SIGNED:
+ snprintf(result, 19, "$0x%hhx", operand->unsigned_imm.val8);
+ break;
+ case AOS_16_BITS_UNSIGNED:
+ case AOS_16_BITS_SIGNED:
+ snprintf(result, 19, "$0x%hx", operand->unsigned_imm.val16);
+ break;
+ case AOS_32_BITS_UNSIGNED:
+ case AOS_32_BITS_SIGNED:
+ snprintf(result, 19, "$0x%x", operand->unsigned_imm.val32);
+ break;
+ case AOS_64_BITS_UNSIGNED:
+ case AOS_64_BITS_SIGNED:
+ snprintf(result, 19, "$0x%llx", operand->unsigned_imm.val64);
+ break;
+ }
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/src/arch/immediate.h b/src/arch/immediate.h
new file mode 100644
index 0000000..3fdab0d
--- /dev/null
+++ b/src/arch/immediate.h
@@ -0,0 +1,58 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * immediate.h - prototypes pour les opérandes représentant des valeurs numériques
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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_IMMEDIATE_H
+#define _ARCH_IMMEDIATE_H
+
+
+#include <glib-object.h>
+
+
+#include "archbase.h"
+#include "operand.h"
+#include "../common/endianness.h"
+
+
+
+#define G_TYPE_IMM_OPERAND g_imm_operand_get_type()
+#define G_IMM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_imm_operand_get_type(), GImmOperand))
+#define G_IS_IMM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_imm_operand_get_type()))
+#define G_IMM_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_imm_operand_get_type(), GImmOperandIface))
+
+
+/* Définition d'un opérande de valeur numérique (instance) */
+typedef struct _GImmOperand GImmOperand;
+
+/* Définition d'un opérande de valeur numérique (classe) */
+typedef struct _GImmOperandClass GImmOperandClass;
+
+
+/* Indique le type défini pour un opérande d'architecture. */
+GType g_imm_operand_get_type(void);
+
+/* Crée un opérande réprésentant une valeur numérique. */
+GArchOperand *g_imm_operand_new_from_data(MemoryDataSize, const bin_t *, off_t *, off_t, SourceEndian);
+
+
+
+#endif /* _ARCH_IMMEDIATE_H */
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h
index 32c8c8c..c80c20a 100644
--- a/src/arch/instruction-int.h
+++ b/src/arch/instruction-int.h
@@ -26,7 +26,6 @@
#include "instruction.h"
-#include "operand.h"
#include "operand-int.h" /* TODO: remove me */
@@ -40,7 +39,7 @@
#define DB_OPCODE 0x00
-
+#if 0
/* Typage des instructions rencontrées */
typedef enum _AsmInstrType
{
@@ -55,7 +54,7 @@ typedef enum _AsmInstrType
AIT_CALL /* Appel d'une fonction */
} AsmInstrType;
-
+#endif
/* Définition générique d'une instruction */
@@ -68,7 +67,7 @@ struct _asm_instr
off_t offset; /* Position physique de départ */
off_t length; /* Taille de l'instruction */
- AsmInstrType type; /* Type d'instruction */
+ int/*AsmInstrType*/ type; /* Type d'instruction */
asm_operand **operands; /* Liste des opérandes */
size_t operands_count; /* Nbre. d'opérandes utilisées */
@@ -81,4 +80,58 @@ struct _asm_instr
+
+
+#include "archbase.h"
+
+
+
+/* Traduit une instruction en version humainement lisible. */
+typedef const char * (* get_instruction_text_fc) (const GArchInstruction *, const exe_format *, AsmSyntax);
+
+
+/* Définition générique d'une instruction d'architecture (instance) */
+struct _GArchInstruction
+{
+ GObject parent; /* A laisser en premier */
+
+ ArchInstructionType type; /* Type d'instruction */
+
+ off_t offset; /* Position physique de départ */
+ off_t length; /* Taille de l'instruction */
+
+ vmpa_t address; /* Position associée */
+
+ GArchOperand **operands; /* Liste des opérandes */
+ size_t operands_count; /* Nbre. d'opérandes utilisées */
+
+ get_instruction_text_fc get_text; /* Texte humain équivalent */
+
+};
+
+
+
+
+
+/* Définition générique d'une instruction d'architecture (classe) */
+struct _GArchInstructionClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#endif /* _ARCH_INSTRUCTION_INT_H */
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index a03ced4..d3cc882 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -24,56 +24,94 @@
#include "instruction.h"
-#include <malloc.h>
+#include <string.h>
#include "instruction-int.h"
+#include "../common/extstr.h"
+/* Initialise la classe générique des instructions. */
+static void g_arch_instruction_class_init(GArchInstructionClass *);
+
+/* Initialise une instance d'opérande d'architecture. */
+static void g_arch_instruction_init(GArchInstruction *);
+
+
+
+/* Indique le type défini pour une instruction d'architecture. */
+G_DEFINE_TYPE(GArchInstruction, g_arch_instruction, G_TYPE_OBJECT);
+
+
/******************************************************************************
* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
+* Paramètres : klass = classe à initialiser. *
* *
-* Description : Crée une instruction de type 'db' à partir de données. *
+* Description : Initialise la classe générique des instructions. *
* *
-* Retour : Instruction mise en place. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-asm_instr *create_db_instruction(const uint8_t *data, off_t *pos, off_t len)
+static void g_arch_instruction_class_init(GArchInstructionClass *klass)
{
- asm_instr *result; /* Représentation à renvoyer */
- result = (asm_instr *)calloc(1, sizeof(asm_instr));
+}
- result->opcode = DB_OPCODE;
- result->type = AIT_DB;
+/******************************************************************************
+* *
+* Paramètres : instr = instance à initialiser. *
+* *
+* Description : Initialise une instance d'instruction d'architecture. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
- /* TODO: check result */
- result->operands = (asm_operand **)calloc(1, sizeof(asm_operand *));
- result->operands[0] = (asm_operand *)calloc(1, sizeof(asm_operand));
- fill_db_operand(result->operands[0], data[(*pos)++]);
+static void g_arch_instruction_init(GArchInstruction *instr)
+{
- result->operands_count = 1;
+}
- return result;
-}
+/******************************************************************************
+* *
+* Paramètres : instr = instruction quelconque à modifier. *
+* offset = position physique dans le code binaire. *
+* length = taille de l'instruction. *
+* address = adresse virtuelle ou position physique. *
+* *
+* Description : Définit la localisation d'une instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+void g_arch_instruction_set_location(GArchInstruction *instr, off_t offset, off_t length, vmpa_t address)
+{
+ instr->offset = offset;
+ instr->length = length;
+
+ instr->address = address;
+
+}
/******************************************************************************
* *
-* Paramètres : instr = instruction quelconque à traiter. *
-* offset = position physique dans le code binaire / NULL. [OUT]*
-* length = taille de l'instruction ou NULL. [OUT] *
+* Paramètres : instr = instruction quelconque à consulter. *
+* offset = position physique dans le code binaire/NULL. [OUT] *
+* length = taille de l'instruction ou NULL. [OUT] *
+* address = adresse virtuelle ou position physique/NULL. [OUT] *
* *
-* Description : Indique la position et/ou la taille d'une instruction. *
+* Description : Fournit la localisation d'une instruction. *
* *
* Retour : - *
* *
@@ -81,9 +119,81 @@ asm_instr *create_db_instruction(const uint8_t *data, off_t *pos, off_t len)
* *
******************************************************************************/
-void get_asm_instr_offset_and_length(const asm_instr *instr, off_t *offset, off_t *length)
+void g_arch_instruction_get_location(GArchInstruction *instr, off_t *offset, off_t *length, vmpa_t *address)
{
if (offset != NULL) *offset = instr->offset;
if (length != NULL) *length = instr->length;
+ if (address != NULL) *address = instr->address;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance à mettre à jour. *
+* opererand = instruction à venir associer. *
+* *
+* Description : Attache une seule opérande à une instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_arch_instruction_attach_one_operand(GArchInstruction *instr, GArchOperand *operand)
+{
+ instr->operands = (GArchOperand **)calloc(1, sizeof(GArchOperand *));
+ instr->operands_count = 1;
+
+ instr->operands[0] = operand;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction à traiter. *
+* format = format du binaire manipulé. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit une instruction en version humainement lisible. *
+* *
+* Retour : Chaîne de caractères à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *g_arch_instruction_get_text(const GArchInstruction *instr, const exe_format *format, AsmSyntax syntax)
+{
+ char *result; /* Chaîne à retourner */
+ size_t i; /* Boucle de parcours */
+ char *opstr; /* Chaîne d'opérande */
+
+ if (instr->operands_count == 0)
+ result = strdup(instr->get_text(instr, format, syntax));
+
+ else
+ {
+ result = g_arch_operand_get_text(G_ARCH_INSTRUCTION(instr)->operands[0], format, syntax);
+
+ for (i = 1; i < instr->operands_count; i++)
+ {
+ result = stradd(result, ", ");
+
+ opstr = g_arch_operand_get_text(G_ARCH_INSTRUCTION(instr)->operands[i], format, syntax);
+ result = stradd(result, opstr);
+ free(opstr);
+
+ }
+
+ result = strprep(result, "\t");
+ result = strprep(result, instr->get_text(instr, format, syntax));
+
+ }
+
+ return result;
+
}
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 6af865b..2df38af 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -35,11 +35,62 @@ typedef struct _asm_instr asm_instr;
-/* Crée une instruction de type 'db' à partir de données. */
-asm_instr *create_db_instruction(const uint8_t *, off_t *, off_t);
-/* Indique la position et/ou la taille d'une instruction. */
-void get_asm_instr_offset_and_length(const asm_instr *, off_t *, off_t *);
+
+
+#include <glib-object.h>
+#include <sys/types.h>
+
+
+#include "archbase.h"
+#include "operand.h"
+#include "../format/exe_format.h"
+
+
+
+/* Typage des instructions rencontrées */
+typedef enum _ArchInstructionType
+{
+ AIT_OTHER, /* Instruction inintéressante */
+
+ AIT_DB, /* Instruction non décodée */
+
+ AIT_PUSH, /* Empilement de valeur */
+ AIT_POP, /* Dépilement de valeur */
+ AIT_JUMP, /* Saut à une adresse */
+
+ AIT_CALL /* Appel d'une fonction */
+
+} ArchInstructionType;
+
+
+#define G_TYPE_ARCH_INSTRUCTION g_arch_instruction_get_type()
+#define G_ARCH_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_arch_instruction_get_type(), GArchInstruction))
+#define G_IS_ARCH_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_arch_instruction_get_type()))
+#define G_ARCH_INSTRUCTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_arch_instruction_get_type(), GArchInstructionIface))
+
+
+/* Définition générique d'une instruction d'architecture (instance) */
+typedef struct _GArchInstruction GArchInstruction;
+
+/* Définition générique d'une instruction d'architecture (classe) */
+typedef struct _GArchInstructionClass GArchInstructionClass;
+
+
+/* Indique le type défini pour une instruction d'architecture. */
+GType g_arch_instruction_get_type(void);
+
+/* Définit la localisation d'une instruction. */
+void g_arch_instruction_set_location(GArchInstruction *, off_t, off_t, vmpa_t);
+
+/* Fournit la localisation d'une instruction. */
+void g_arch_instruction_get_location(GArchInstruction *, off_t *, off_t *, vmpa_t *);
+
+/* Attache une seule opérande à une instruction. */
+void g_arch_instruction_attach_one_operand(GArchInstruction *, GArchOperand *);
+
+/* Traduit une instruction en version humainement lisible. */
+char *g_arch_instruction_get_text(const GArchInstruction *, const exe_format *, AsmSyntax);
diff --git a/src/arch/jvm/Makefile.am b/src/arch/jvm/Makefile.am
new file mode 100644
index 0000000..9b3937a
--- /dev/null
+++ b/src/arch/jvm/Makefile.am
@@ -0,0 +1,32 @@
+
+noinst_LTLIBRARIES = libarchjvm.la
+
+libarchjvm_la_SOURCES = \
+ instruction.h instruction.c \
+ op_add.c \
+ op_const.c \
+ op_convert.c \
+ op_dup.c \
+ op_getput.c \
+ op_invoke.c \
+ op_load.c \
+ op_monitor.c \
+ op_nop.c \
+ op_pop.c \
+ op_store.c \
+ op_ret.c \
+ opcodes.h \
+ operand.h operand.c \
+ processor.h processor.c
+
+libarchjvm_la_CFLAGS = $(AM_CFLAGS)
+
+
+INCLUDES = $(LIBGTK_CFLAGS)
+
+AM_CPPFLAGS =
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+
+SUBDIRS =
diff --git a/src/arch/jvm/instruction.c b/src/arch/jvm/instruction.c
new file mode 100644
index 0000000..7748624
--- /dev/null
+++ b/src/arch/jvm/instruction.c
@@ -0,0 +1,300 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * instruction.c - gestion des instructions JVM
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "instruction.h"
+
+
+#include "../instruction-int.h"
+
+
+
+/* Définition générique d'une instruction d'architecture JVM (instance) */
+struct _GJvmInstruction
+{
+ GArchInstruction parent; /* A laisser en premier */
+
+ JvmOpcodes type; /* Position dans la liste */
+
+};
+
+/* Définition générique d'une instruction d'architecture JVM (classe) */
+struct _GJvmInstructionClass
+{
+ GArchInstructionClass parent; /* A laisser en premier */
+
+};
+
+
+/* Initialise la classe des instructions pour JVM. */
+static void g_jvm_instruction_class_init(GJvmInstructionClass *);
+
+/* Initialise une instance d'opérande d'architecture JVM. */
+static void g_jvm_instruction_init(GJvmInstruction *);
+
+
+
+/* --------------------- AIDE A LA MISE EN PLACE D'INSTRUCTIONS --------------------- */
+
+
+/* Répertoire de toutes les instructions JVM */
+typedef struct _jvm_instruction
+{
+ bool care_of_data; /* Devinette = repas ? */
+ bool can_wide; /* Instruction étendue ? */
+ bin_t opcode; /* Opcode de l'instruction */
+
+ const char *keyword; /* Mot clef de la commande */
+
+} jvm_instruction;
+
+
+static jvm_instruction _instructions[JOP_COUNT] = {
+
+ [JOP_NOP] = { false, false, 0x00, "nop" },
+ [JOP_ACONST_NULL] = { false, false, 0x01, "aconst_null" },
+ [JOP_ICONST_M1] = { true, false, 0x02, "iconst_m1" },
+ [JOP_ICONST_0] = { true, false, 0x03, "iconst_0" },
+ [JOP_ICONST_1] = { true, false, 0x04, "iconst_1" },
+ [JOP_ICONST_2] = { true, false, 0x05, "iconst_2" },
+ [JOP_ICONST_3] = { true, false, 0x06, "iconst_3" },
+ [JOP_ICONST_4] = { true, false, 0x07, "iconst_4" },
+ [JOP_ICONST_5] = { true, false, 0x08, "iconst_5" },
+
+
+
+ [JOP_POP] = { false, false, 0x57, "pop" },
+ [JOP_POP2] = { false, false, 0x58, "pop2" },
+ [JOP_DUP] = { false, false, 0x59, "dup" },
+ [JOP_DUP_X1] = { false, false, 0x5a, "dup_x1" },
+ [JOP_DUP_X2] = { false, false, 0x5b, "dup_x2" },
+ [JOP_DUP2] = { false, false, 0x5c, "dup2" },
+ [JOP_DUP2_X1] = { false, false, 0x5d, "dup2_x1" },
+ [JOP_DUP2_X2] = { false, false, 0x5e, "dup2_x2" },
+
+
+ [JOP_IADD] = { false, false, 0x60, "iadd" },
+
+
+ [JOP_I2L] = { false, false, 0x85, "i2l" },
+ [JOP_I2F] = { false, false, 0x86, "i2f" },
+ [JOP_I2D] = { false, false, 0x87, "i2d" },
+ [JOP_L2I] = { false, false, 0x88, "l2i" },
+ [JOP_L2F] = { false, false, 0x89, "l2f" },
+ [JOP_L2D] = { false, false, 0x8a, "l2d" },
+ [JOP_F2I] = { false, false, 0x8b, "f2i" },
+ [JOP_F2L] = { false, false, 0x8c, "f2l" },
+ [JOP_F2D] = { false, false, 0x8d, "f2d" },
+ [JOP_D2I] = { false, false, 0x8e, "d2i" },
+ [JOP_D2L] = { false, false, 0x8f, "d2l" },
+ [JOP_D2F] = { false, false, 0x90, "d2f" },
+ [JOP_I2B] = { false, false, 0x91, "i2b" },
+ [JOP_I2C] = { false, false, 0x92, "i2c" },
+ [JOP_I2S] = { false, false, 0x93, "i2s" },
+
+
+ [JOP_ILOAD_0] = { true, false, 0x1a, "iload_0" },
+ [JOP_ILOAD_1] = { true, false, 0x1b, "iload_1" },
+ [JOP_ILOAD_2] = { true, false, 0x1c, "iload_2" },
+ [JOP_ILOAD_3] = { true, false, 0x1d, "iload_3" },
+
+
+
+ [JOP_ALOAD_0] = { true, false, 0x2a, "aload_0" },
+ [JOP_ALOAD_1] = { true, false, 0x2b, "aload_1" },
+ [JOP_ALOAD_2] = { true, false, 0x2c, "aload_2" },
+ [JOP_ALOAD_3] = { true, false, 0x2d, "aload_3" },
+
+ [JOP_ISTORE_0] = { true, false, 0x3b, "istore_0" },
+ [JOP_ISTORE_1] = { true, false, 0x3c, "istore_1" },
+ [JOP_ISTORE_2] = { true, false, 0x3d, "istore_2" },
+ [JOP_ISTORE_3] = { true, false, 0x3e, "istore_3" },
+
+ [JOP_IRETURN] = { false, false, 0xac, "ireturn" },
+ [JOP_LRETURN] = { false, false, 0xad, "lreturn" },
+ [JOP_FRETURN] = { false, false, 0xae, "freturn" },
+ [JOP_DRETURN] = { false, false, 0xaf, "dreturn" },
+ [JOP_ARETURN] = { false, false, 0xb0, "areturn" },
+ [JOP_RETURN] = { false, false, 0xb1, "return" },
+ [JOP_GETSTATIC] = { false, false, 0xb2, "getstatic" },
+
+ [JOP_INVOKE_VIRTUAL] = { false, false, 0xb6, "invokevirtual" },
+ [JOP_INVOKE_SPECIAL] = { false, false, 0xb7, "invokespecial" },
+ [JOP_INVOKE_STATIC] = { false, false, 0xb8, "invokestatic" },
+
+
+ [JOP_MONITOR_ENTER] = { false, false, 0xc2, "monitorenter" },
+ [JOP_MONITOR_EXIT] = { false, false, 0xc3, "monitorexit" }
+
+
+
+};
+
+
+/* Traduit une instruction en version humainement lisible. */
+static const char *jvm_get_instruction_text(const GJvmInstruction *, const exe_format *, AsmSyntax);
+
+
+
+
+
+
+/* Indique le type défini pour une instruction d'architecture JVM. */
+G_DEFINE_TYPE(GJvmInstruction, g_jvm_instruction, G_TYPE_ARCH_INSTRUCTION);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des instructions pour JVM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_instruction_class_init(GJvmInstructionClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance à initialiser. *
+* *
+* Description : Initialise une instance d'instruction d'architecture JVM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_instruction_init(GJvmInstruction *instr)
+{
+ GArchInstruction *parent; /* Instance parente */
+
+ parent = G_ARCH_INSTRUCTION(instr);
+
+ parent->get_text = (get_instruction_text_fc)jvm_get_instruction_text;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type d'instruction à représenter. *
+* *
+* Description : Crée une instruction pour l'architecture JVM. *
+* *
+* Retour : Architecture mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *g_jvm_instruction_new(JvmOpcodes type)
+{
+ GArchInstruction *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_JVM_INSTRUCTION, NULL);
+
+ G_JVM_INSTRUCTION(result)->type = type;
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* AIDE A LA MISE EN PLACE D'INSTRUCTIONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* wide = étendue de la future instruction. [OUT] *
+* care = la lecture de l'instr. veut-elle les opcodes ? [OUT] *
+* *
+* Description : Recherche l'identifiant de la prochaine instruction. *
+* *
+* Retour : Identifiant de la prochaine instruction à tenter de charger. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+JvmOpcodes jvm_guess_next_instruction(const bin_t *data, off_t *pos, off_t len, bool *wide, bool *care)
+{
+ JvmOpcodes result; /* Identifiant à retourner */
+ bin_t opcode; /* Opcode à trouver */
+
+ *wide = (data[*pos] == 0xc4);
+
+ if (*wide && (*pos + 1) == len) return JOP_COUNT;
+
+ opcode = data[*pos + (*wide ? 1 : 0)];
+
+ for (result = 0; result < JOP_COUNT; result++)
+ {
+ if (*wide && !_instructions[result].can_wide) continue;
+
+ if (_instructions[result].opcode == opcode)
+ {
+ *care = _instructions[result].care_of_data;
+ break;
+ }
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction à traiter. *
+* format = format du binaire manipulé. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit une instruction en version humainement lisible. *
+* *
+* Retour : Chaîne de caractères à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static const char *jvm_get_instruction_text(const GJvmInstruction *instr, const exe_format *format, AsmSyntax syntax)
+{
+ return _instructions[instr->type].keyword;
+
+}
diff --git a/src/arch/jvm/instruction.h b/src/arch/jvm/instruction.h
new file mode 100644
index 0000000..36f2230
--- /dev/null
+++ b/src/arch/jvm/instruction.h
@@ -0,0 +1,149 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * instruction.h - prototypes pour la gestion des instructions JVM
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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_JVM_INSTRUCTION_H
+#define _ARCH_JVM_INSTRUCTION_H
+
+
+#include "../instruction.h"
+
+
+
+
+
+/* Enumération de tous les opcodes */
+typedef enum _JvmOpcodes
+{
+ JOP_NOP, /* nop (0x00) */
+ JOP_ACONST_NULL, /* aconst_null (0x01) */
+ JOP_ICONST_M1, /* iconst_m1 (0x02) */
+ JOP_ICONST_0, /* iconst_0 (0x03) */
+ JOP_ICONST_1, /* iconst_1 (0x04) */
+ JOP_ICONST_2, /* iconst_2 (0x05) */
+ JOP_ICONST_3, /* iconst_3 (0x06) */
+ JOP_ICONST_4, /* iconst_4 (0x07) */
+ JOP_ICONST_5, /* iconst_5 (0x08) */
+
+
+ JOP_POP, /* pop (0x57) */
+ JOP_POP2, /* pop2 (0x58) */
+ JOP_DUP, /* dup (0x59) */
+ JOP_DUP_X1, /* dup_x1 (0x5a) */
+ JOP_DUP_X2, /* dup_x2 (0x5b) */
+ JOP_DUP2, /* dup2 (0x5c) */
+ JOP_DUP2_X1, /* dup2_x1 (0x5d) */
+ JOP_DUP2_X2, /* dup2_x2 (0x5e) */
+
+
+ JOP_IADD, /* iadd (0x60) */
+
+
+ JOP_I2L, /* i2l (0x85) */
+ JOP_I2F, /* i2f (0x86) */
+ JOP_I2D, /* i2d (0x87) */
+ JOP_L2I, /* l2i (0x88) */
+ JOP_L2F, /* l2f (0x89) */
+ JOP_L2D, /* l2d (0x8a) */
+ JOP_F2I, /* f2i (0x8b) */
+ JOP_F2L, /* f2l (0x8c) */
+ JOP_F2D, /* f2d (0x8d) */
+ JOP_D2I, /* d2i (0x8e) */
+ JOP_D2L, /* d2l (0x8f) */
+ JOP_D2F, /* d2f (0x90) */
+ JOP_I2B, /* i2b (0x91) */
+ JOP_I2C, /* i2c (0x92) */
+ JOP_I2S, /* i2s (0x93) */
+
+
+
+
+ JOP_ILOAD_0, /* iload_0 (0x1a) */
+ JOP_ILOAD_1, /* iload_1 (0x1b) */
+ JOP_ILOAD_2, /* iload_2 (0x1c) */
+ JOP_ILOAD_3, /* iload_3 (0x1d) */
+
+
+
+
+ JOP_ALOAD_0, /* aload_0 (0x2a) */
+ JOP_ALOAD_1, /* aload_1 (0x2b) */
+ JOP_ALOAD_2, /* aload_2 (0x2c) */
+ JOP_ALOAD_3, /* aload_3 (0x2d) */
+
+
+ JOP_ISTORE_0, /* istore_0 (0x3b) */
+ JOP_ISTORE_1, /* istore_1 (0x3c) */
+ JOP_ISTORE_2, /* istore_2 (0x3d) */
+ JOP_ISTORE_3, /* istore_3 (0x3e) */
+
+
+ JOP_IRETURN, /* ireturn (0xac) */
+ JOP_LRETURN, /* lreturn (0xad) */
+ JOP_FRETURN, /* freturn (0xae) */
+ JOP_DRETURN, /* dreturn (0xaf) */
+ JOP_ARETURN, /* areturn (0xb0) */
+ JOP_RETURN, /* return (0xb1) */
+ JOP_GETSTATIC, /* getstatic (0xb2) */
+
+ JOP_INVOKE_VIRTUAL, /* invokevirtual (0xb6) */
+ JOP_INVOKE_SPECIAL, /* invokespecial (0xb7) */
+ JOP_INVOKE_STATIC, /* invokestatic (0xb8) */
+
+ JOP_MONITOR_ENTER, /* monitorenter (0xc2) */
+ JOP_MONITOR_EXIT, /* monitorexit (0xc3) */
+
+ JOP_COUNT
+
+} JvmOpcodes;
+
+
+#define G_TYPE_JVM_INSTRUCTION g_jvm_instruction_get_type()
+#define G_JVM_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_jvm_instruction_get_type(), GJvmInstruction))
+#define G_IS_JVM_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_jvm_instruction_get_type()))
+#define G_JVM_INSTRUCTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_jvm_instruction_get_type(), GJvmInstructionIface))
+
+
+/* Définition générique d'une instruction d'architecture JVM (instance) */
+typedef struct _GJvmInstruction GJvmInstruction;
+
+/* Définition générique d'une instruction d'architecture JVM (classe) */
+typedef struct _GJvmInstructionClass GJvmInstructionClass;
+
+
+/* Indique le type défini pour une instruction d'architecture JVM. */
+GType g_jvm_instruction_get_type(void);
+
+/* Crée une instruction pour l'architecture JVM. */
+GArchInstruction *g_jvm_instruction_new(JvmOpcodes);
+
+
+
+/* --------------------- AIDE A LA MISE EN PLACE D'INSTRUCTIONS --------------------- */
+
+
+/* Recherche l'identifiant de la prochaine instruction. */
+JvmOpcodes jvm_guess_next_instruction(const bin_t *, off_t *, off_t, bool *, bool *);
+
+
+
+#endif /* _ARCH_JVM_INSTRUCTION_H */
diff --git a/src/arch/jvm/op_add.c b/src/arch/jvm/op_add.c
new file mode 100644
index 0000000..63a5c9e
--- /dev/null
+++ b/src/arch/jvm/op_add.c
@@ -0,0 +1,55 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_add.c - décodage des additions
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'iadd'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_iadd(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_IADD);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_const.c b/src/arch/jvm/op_const.c
new file mode 100644
index 0000000..9d5c2c4
--- /dev/null
+++ b/src/arch/jvm/op_const.c
@@ -0,0 +1,87 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_const.c - décodage des empilements de valeurs prédéfinies
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'aconst_null'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_aconst_null(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_ACONST_NULL);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'iconst_n'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_iconst_n(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ JvmOpcodes opcode; /* Instruction effective */
+
+ opcode = JOP_ICONST_M1 + (data[*pos] - 0x02);
+
+ (*pos)++;
+
+ result = g_jvm_instruction_new(opcode);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_convert.c b/src/arch/jvm/op_convert.c
new file mode 100644
index 0000000..c0f55da
--- /dev/null
+++ b/src/arch/jvm/op_convert.c
@@ -0,0 +1,433 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_convert.c - décodage des conversions entre types de base
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'd2f'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_d2f(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_D2F);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'd2i'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_d2i(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_D2I);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'd2l'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_d2l(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_D2L);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'f2d'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_f2d(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_F2D);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'f2i'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_f2i(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_F2I);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'f2l'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_f2l(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_F2L);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'i2b'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_i2b(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_I2B);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'i2c'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_i2c(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_I2C);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'i2d'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_i2d(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_I2D);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'i2f'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_i2f(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_I2F);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'i2l'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_i2l(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_I2L);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'i2s'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_i2s(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_I2S);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'l2d'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_l2d(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_L2D);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'l2i'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_l2i(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_L2I);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'l2f'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_l2f(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_L2F);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_dup.c b/src/arch/jvm/op_dup.c
new file mode 100644
index 0000000..2011aa8
--- /dev/null
+++ b/src/arch/jvm/op_dup.c
@@ -0,0 +1,190 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_dup.c - décodage des duplications d'étages de la pile
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dup'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dup(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DUP);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dup_x1'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dup_x1(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DUP_X1);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dup_x2'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dup_x2(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DUP_X2);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dup2'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dup2(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DUP2);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dup2_x1'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dup2_x1(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DUP2_X1);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dup2_x2'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dup2_x2(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DUP2_X2);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_getput.c b/src/arch/jvm/op_getput.c
new file mode 100644
index 0000000..0aaf950
--- /dev/null
+++ b/src/arch/jvm/op_getput.c
@@ -0,0 +1,62 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_getput.c - décodage des fonctions (get|put)*
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+#include "operand.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'getstatic'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_getstatic(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_GETSTATIC);
+
+ if (!jvm_read_one_operand(result, data, pos, len, JOT_FIELD_REF))
+ {
+ /*free(result); FIXME */
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_invoke.c b/src/arch/jvm/op_invoke.c
new file mode 100644
index 0000000..8b74179
--- /dev/null
+++ b/src/arch/jvm/op_invoke.c
@@ -0,0 +1,128 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_invoke.c - décodage des fonctions (get|put)*
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+#include "operand.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'invokespecial'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_invokespecial(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_INVOKE_SPECIAL);
+
+ if (!jvm_read_one_operand(result, data, pos, len, JOT_METHOD_REF))
+ {
+ /*free(result); FIXME */
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'invokestatic'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_invokestatic(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_INVOKE_STATIC);
+
+ if (!jvm_read_one_operand(result, data, pos, len, JOT_METHOD_REF))
+ {
+ /*free(result); FIXME */
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'invokevirtual'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_invokevirtual(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_INVOKE_VIRTUAL);
+
+ if (!jvm_read_one_operand(result, data, pos, len, JOT_METHOD_REF))
+ {
+ /*free(result); FIXME */
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_load.c b/src/arch/jvm/op_load.c
new file mode 100644
index 0000000..c4193b1
--- /dev/null
+++ b/src/arch/jvm/op_load.c
@@ -0,0 +1,92 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_load.c - décodage des instructions de chargement
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'aload_n'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_aload_n(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ JvmOpcodes opcode; /* Instruction effective */
+
+ opcode = JOP_ALOAD_0 + (data[*pos] - 0x2a);
+
+ (*pos)++;
+
+ result = g_jvm_instruction_new(opcode);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'iload_n'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_iload_n(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ JvmOpcodes opcode; /* Instruction effective */
+
+ opcode = JOP_ILOAD_0 + (data[*pos] - 0x1a);
+
+ (*pos)++;
+
+ result = g_jvm_instruction_new(opcode);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_monitor.c b/src/arch/jvm/op_monitor.c
new file mode 100644
index 0000000..691546f
--- /dev/null
+++ b/src/arch/jvm/op_monitor.c
@@ -0,0 +1,82 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_monitor.c - décodage des outils pour réaliser des sémaphores sur les objets
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'monitorenter'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_monitorenter(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_MONITOR_ENTER);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'monitorexit'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_monitorexit(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_MONITOR_EXIT);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_nop.c b/src/arch/jvm/op_nop.c
new file mode 100644
index 0000000..0df4f8f
--- /dev/null
+++ b/src/arch/jvm/op_nop.c
@@ -0,0 +1,55 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_nop.c - décodage des absences d'opération
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'nop'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_nop(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_NOP);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_pop.c b/src/arch/jvm/op_pop.c
new file mode 100644
index 0000000..fc00b6f
--- /dev/null
+++ b/src/arch/jvm/op_pop.c
@@ -0,0 +1,82 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_pop.c - décodage des dépilements de pile dans le vide
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'pop'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_pop(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_POP);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'pop2'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_pop2(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_POP);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_ret.c b/src/arch/jvm/op_ret.c
new file mode 100644
index 0000000..190d7b4
--- /dev/null
+++ b/src/arch/jvm/op_ret.c
@@ -0,0 +1,184 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_ret.c - décodage des ordres de retour
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'areturn'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_areturn(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_ARETURN);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'dreturn'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_dreturn(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_DRETURN);
+
+ return result;
+
+}
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'freturn'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_freturn(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_FRETURN);
+
+ return result;
+
+}
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'ireturn'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_ireturn(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_IRETURN);
+
+ return result;
+
+}
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'lreturn'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_lreturn(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_LRETURN);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'return'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_return(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+
+ result = g_jvm_instruction_new(JOP_RETURN);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/op_store.c b/src/arch/jvm/op_store.c
new file mode 100644
index 0000000..b247fca
--- /dev/null
+++ b/src/arch/jvm/op_store.c
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_store.c - décodage des instructions d'enregistrement
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "opcodes.h"
+
+
+#include "instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'istore_n'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *jvm_read_instr_istore_n(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GJvmProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ JvmOpcodes opcode; /* Instruction effective */
+
+ opcode = JOP_ISTORE_0 + (data[*pos] - 0x3b);
+
+ (*pos)++;
+
+ result = g_jvm_instruction_new(opcode);
+
+ return result;
+
+}
diff --git a/src/arch/jvm/opcodes.h b/src/arch/jvm/opcodes.h
new file mode 100644
index 0000000..cf13536
--- /dev/null
+++ b/src/arch/jvm/opcodes.h
@@ -0,0 +1,160 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * opcodes.h - prototypes pour la liste de tous les opcodes de l'architecture JVM
+ *
+ * Copyright (C) 2008 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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_JVM_OPCODES_H
+#define _ARCH_JVM_OPCODES_H
+
+
+#include "processor.h"
+
+
+
+/* Décode une instruction de type 'aconst_null'. */
+GArchInstruction *jvm_read_instr_aconst_null(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'aload_n'. */
+GArchInstruction *jvm_read_instr_aload_n(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'areturn'. */
+GArchInstruction *jvm_read_instr_areturn(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'd2f'. */
+GArchInstruction *jvm_read_instr_d2f(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'd2i'. */
+GArchInstruction *jvm_read_instr_d2i(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'd2l'. */
+GArchInstruction *jvm_read_instr_d2l(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dreturn'. */
+GArchInstruction *jvm_read_instr_dreturn(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dup'. */
+GArchInstruction *jvm_read_instr_dup(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dup_x1'. */
+GArchInstruction *jvm_read_instr_dup_x1(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dup_x2'. */
+GArchInstruction *jvm_read_instr_dup_x2(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dup2'. */
+GArchInstruction *jvm_read_instr_dup2(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dup2_x1'. */
+GArchInstruction *jvm_read_instr_dup2_x1(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'dup2_x2'. */
+GArchInstruction *jvm_read_instr_dup2_x2(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'f2d'. */
+GArchInstruction *jvm_read_instr_f2d(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'f2i'. */
+GArchInstruction *jvm_read_instr_f2i(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'f2l'. */
+GArchInstruction *jvm_read_instr_f2l(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'freturn'. */
+GArchInstruction *jvm_read_instr_freturn(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'getstatic'. */
+GArchInstruction *jvm_read_instr_getstatic(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'i2b'. */
+GArchInstruction *jvm_read_instr_i2b(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'i2c'. */
+GArchInstruction *jvm_read_instr_i2c(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'i2d'. */
+GArchInstruction *jvm_read_instr_i2d(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'i2f'. */
+GArchInstruction *jvm_read_instr_i2f(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'i2l'. */
+GArchInstruction *jvm_read_instr_i2l(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'i2s'. */
+GArchInstruction *jvm_read_instr_i2s(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'iadd'. */
+GArchInstruction *jvm_read_instr_iadd(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'iconst_n'. */
+GArchInstruction *jvm_read_instr_iconst_n(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'iload_n'. */
+GArchInstruction *jvm_read_instr_iload_n(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'invokespecial'. */
+GArchInstruction *jvm_read_instr_invokespecial(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'invokestatic'. */
+GArchInstruction *jvm_read_instr_invokestatic(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'invokevirtual'. */
+GArchInstruction *jvm_read_instr_invokevirtual(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'istore_n'. */
+GArchInstruction *jvm_read_instr_istore_n(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'ireturn'. */
+GArchInstruction *jvm_read_instr_ireturn(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'lreturn'. */
+GArchInstruction *jvm_read_instr_lreturn(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'l2d'. */
+GArchInstruction *jvm_read_instr_l2d(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'l2i'. */
+GArchInstruction *jvm_read_instr_l2i(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'l2f'. */
+GArchInstruction *jvm_read_instr_l2f(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'monitorenter'. */
+GArchInstruction *jvm_read_instr_monitorenter(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'monitorexit'. */
+GArchInstruction *jvm_read_instr_monitorexit(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'nop'. */
+GArchInstruction *jvm_read_instr_nop(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'pop'. */
+GArchInstruction *jvm_read_instr_pop(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'pop2'. */
+GArchInstruction *jvm_read_instr_pop2(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+/* Décode une instruction de type 'return'. */
+GArchInstruction *jvm_read_instr_return(const bin_t *, off_t *, off_t, vmpa_t, const GJvmProcessor *);
+
+
+
+#endif /* _ARCH_JVM_OPCODES_H */
diff --git a/src/arch/jvm/operand.c b/src/arch/jvm/operand.c
new file mode 100644
index 0000000..7e9b08f
--- /dev/null
+++ b/src/arch/jvm/operand.c
@@ -0,0 +1,331 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * operand.c - gestion des operandes de l'architecture JVM
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "operand.h"
+
+
+#include "../operand-int.h"
+#include "../../common/endianness.h"
+#include "../../format/java/pool.h"
+
+
+
+/* ---------------------- COQUILLE VIDE POUR LES OPERANDES JVM ---------------------- */
+
+
+/* Définition d'un opérande de la JVM (instance) */
+struct _GJvmOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+};
+
+
+/* Définition d'un opérande de la JVM (classe) */
+struct _GJvmOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des opérandes JVM de base. */
+static void g_jvm_operand_class_init(GJvmOperandClass *);
+
+/* Initialise une instance d'opérande de base pour la JVM. */
+static void g_jvm_operand_init(GJvmOperand *);
+
+
+
+/* --------------------- OPERANDES RENVOYANT VERS UNE REFERENCE --------------------- */
+
+
+/* Définition d'un opérande de référence de la JVM (instance) */
+struct _GJvmRefOperand
+{
+ GJvmOperand parent; /* Instance parente */
+
+ JvmOperandType type; /* Type de référence attendue */
+ uint16_t index; /* Indice dans la table Java */
+
+};
+
+
+/* Définition d'un opérande de référence de la JVM (classe) */
+struct _GJvmRefOperandClass
+{
+ GJvmOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des opérandes de référence JVM. */
+static void g_jvm_ref_operand_class_init(GJvmRefOperandClass *);
+
+/* Initialise une instance d'opérande de référence pour la JVM. */
+static void g_jvm_ref_operand_init(GJvmRefOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static char *g_jvm_ref_operand_get_text(const GJvmRefOperand *, const exe_format *, AsmSyntax);
+
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* COQUILLE VIDE POUR LES OPERANDES JVM */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini par la GLib pour un opérande de JVM. */
+G_DEFINE_TYPE(GJvmOperand, g_jvm_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des opérandes JVM de base. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_operand_class_init(GJvmOperandClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = instance à initialiser. *
+* *
+* Description : Initialise une instance d'opérande de base pour la JVM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_operand_init(GJvmOperand *proc)
+{
+
+}
+
+
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* OPERANDES RENVOYANT VERS UNE REFERENCE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini par la GLib pour un opérande de référence de JVM. */
+G_DEFINE_TYPE(GJvmRefOperand, g_jvm_ref_operand, G_TYPE_JVM_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des opérandes de référence JVM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_ref_operand_class_init(GJvmRefOperandClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = instance à initialiser. *
+* *
+* Description : Initialise une instance d'opérande de référence pour la JVM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_ref_operand_init(GJvmRefOperand *operand)
+{
+ GArchOperand *parent; /* Instance parente */
+
+ parent = G_ARCH_OPERAND(operand);
+
+ parent->get_text = (get_operand_text_fc)g_jvm_ref_operand_get_text;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* type = type de l'opérande. *
+* *
+* Description : Crée un opérande de référence pour la JVM. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_jvm_ref_operand_new(const bin_t *data, off_t *pos, off_t len, JvmOperandType type)
+{
+ GJvmRefOperand *result; /* Structure à retourner */
+ uint16_t index; /* Indice dans la table Java */
+
+ if (!read_u16(&index, data, pos, len, SRE_BIG))
+ result = NULL;
+
+ else
+ {
+ result = g_object_new(G_TYPE_JVM_REF_OPERAND, NULL);
+
+ /* FIXME : faire attention au type */
+
+ result->type = type;
+ result->index = index;
+
+ }
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* format = format du binaire manipulé. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : Chaîne de caractères à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_jvm_ref_operand_get_text(const GJvmRefOperand *operand, const exe_format *format, AsmSyntax syntax)
+{
+ char *result; /* Chaîne à retourner */
+
+ switch (operand->type)
+ {
+ case JOT_FIELD_REF:
+ result = build_reference_from_java_pool((const java_format *)format, operand->index, JRT_FIELD);
+ break;
+ case JOT_METHOD_REF:
+ result = build_reference_from_java_pool((const java_format *)format, operand->index, JRT_METHOD);
+ break;
+ default:
+ result = NULL;
+ break;
+ }
+
+ if (result == NULL)
+ result = strdup("&lt;bad_reference&gt;");
+
+ return result;
+
+}
+
+
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* AIDE A LA CREATION D'OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction dont la définition est à compléter. [OUT]*
+* data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* type = type de l'opérande. *
+* ... = éventuelle(s) information(s) complémentaire(s). *
+* *
+* Description : Procède à la lecture d'un opérande donné. *
+* *
+* Retour : Bilan de l'opération : true en cas de succès, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool jvm_read_one_operand(GArchInstruction *instr, const bin_t *data, off_t *pos, off_t len, JvmOperandType type, ...)
+{
+ va_list ap; /* Liste des compléments */
+ GArchOperand *op; /* Opérande unique décodé */
+
+ va_start(ap, type);
+
+ switch (type)
+ {
+ case JOT_FIELD_REF:
+ case JOT_METHOD_REF:
+ op = g_jvm_ref_operand_new(data, pos, len, type);
+ break;
+
+ default:
+ op = NULL;
+ break;
+ }
+
+ va_end(ap);
+
+ if (op == NULL) return false;
+
+ g_arch_instruction_attach_one_operand(instr, op);
+
+ return true;
+
+}
diff --git a/src/arch/jvm/operand.h b/src/arch/jvm/operand.h
new file mode 100644
index 0000000..9d8f8e9
--- /dev/null
+++ b/src/arch/jvm/operand.h
@@ -0,0 +1,107 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * operand.h - prototypes pour la gestion des operandes de l'architecture JVM
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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_JVM_OPERAND_H
+#define _ARCH_JVM_OPERAND_H
+
+
+#include "../instruction.h"
+
+
+
+/* Types d'opérandes supportés */
+typedef enum _JvmOperandType JvmOperandType;
+
+
+
+/* ---------------------- COQUILLE VIDE POUR LES OPERANDES JVM ---------------------- */
+
+
+#define G_TYPE_JVM_OPERAND g_jvm_operand_get_type()
+#define G_JVM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_jvm_operand_get_type(), GJvmOperand))
+#define G_IS_JVM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_jvm_operand_get_type()))
+#define G_JVM_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_jvm_operand_get_type(), GJvmOperandIface))
+
+
+/* Définition d'un opérande de la JVM (instance) */
+typedef struct _GJvmOperand GJvmOperand;
+
+/* Définition d'un opérande de la JVM (classe) */
+typedef struct _GJvmOperandClass GJvmOperandClass;
+
+
+/* Indique le type défini par la GLib pour un opérande de JVM. */
+GType g_jvm_operand_get_type(void);
+
+
+
+
+
+
+
+/* --------------------- OPERANDES RENVOYANT VERS UNE REFERENCE --------------------- */
+
+
+#define G_TYPE_JVM_REF_OPERAND g_jvm_ref_operand_get_type()
+#define G_JVM_REF_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_jvm_ref_operand_get_type(), GJvmRefOperand))
+#define G_IS_JVM_REF_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_jvm_ref_operand_get_type()))
+#define G_JVM_REF_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_jvm_ref_operand_get_type(), GJvmRefOperandIface))
+
+
+/* Définition d'un opérande de référence de la JVM (instance) */
+typedef struct _GJvmRefOperand GJvmRefOperand;
+
+/* Définition d'un opérande de référence de la JVM (classe) */
+typedef struct _GJvmRefOperandClass GJvmRefOperandClass;
+
+
+/* Indique le type défini par la GLib pour un opérande de référence de JVM. */
+GType g_jvm_ref_operand_get_type(void);
+
+/* Crée un opérande de référence pour la JVM. */
+GArchOperand *g_jvm_ref_operand_new(const bin_t *, off_t *, off_t, JvmOperandType);
+
+
+
+
+
+/* ------------------------- AIDE A LA CREATION D'OPERANDES ------------------------- */
+
+
+/* Types d'opérandes supportés */
+enum _JvmOperandType
+{
+ JOT_FIELD_REF, /* Référence vers un champ */
+ JOT_METHOD_REF, /* Référence vers une méthode */
+
+ JOT_COUNT
+
+};
+
+
+/* Procède à la lecture d'un opérande donné. */
+bool jvm_read_one_operand(GArchInstruction *, const bin_t *, off_t *, off_t, JvmOperandType, ...);
+
+
+
+#endif /* _ARCH_JVM_OPERAND_H */
diff --git a/src/arch/jvm/processor.c b/src/arch/jvm/processor.c
new file mode 100644
index 0000000..c7bfcf9
--- /dev/null
+++ b/src/arch/jvm/processor.c
@@ -0,0 +1,346 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * processor.c - manipulation du processeur de la JVM
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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 "processor.h"
+
+
+#include "instruction.h"
+#include "opcodes.h"
+#include "../processor-int.h"
+
+
+
+/* Définition du processeur de la JVM (instance) */
+struct _GJvmProcessor
+{
+ GArchProcessor parent; /* Instance parente */
+
+};
+
+
+/* Définition du processeur de la JVM (classe) */
+struct _GJvmProcessorClass
+{
+ GArchProcessorClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des lignes de descriptions initiales. */
+static void g_jvm_processor_class_init(GJvmProcessorClass *);
+
+/* Initialise la classe des lignes de descriptions initiales. */
+static void g_jvm_processor_init(GJvmProcessor *);
+
+/* Décode une instruction dans un flux de données. */
+static GArchInstruction *g_jvm_processor_decode_instruction(const GJvmProcessor *, const bin_t *, off_t *, off_t, vmpa_t);
+
+
+/* Indique le type défini par la GLib pour le processeur JVM. */
+G_DEFINE_TYPE(GJvmProcessor, g_jvm_processor, G_TYPE_ARCH_PROCESSOR);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des lignes de descriptions initiales. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_processor_class_init(GJvmProcessorClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = instance à initialiser. *
+* *
+* Description : Initialise la classe des lignes de descriptions initiales. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_jvm_processor_init(GJvmProcessor *proc)
+{
+ GArchProcessor *parent; /* Instance parente */
+
+ parent = G_ARCH_PROCESSOR(proc);
+
+ parent->endianness = SRE_BIG;
+
+ parent->decode = (decode_instruction_fc)g_jvm_processor_decode_instruction;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée le support de l'architecture JVM. *
+* *
+* Retour : Architecture mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchProcessor *g_jvm_processor_new(void)
+{
+ GArchProcessor *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_JVM_PROCESSOR, NULL);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = architecture visée par la procédure. *
+* data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* offset = adresse virtuelle de l'instruction. *
+* *
+* Description : Décode une instruction dans un flux de données. *
+* *
+* Retour : Instruction mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchInstruction *g_jvm_processor_decode_instruction(const GJvmProcessor *proc, const bin_t *data, off_t *pos, off_t len, vmpa_t addr)
+{
+ GArchInstruction *result; /* Instruction à renvoyer */
+ bool wide; /* Utilisation d'étendues */
+ bool care; /* Traitement des opcodes */
+ JvmOpcodes id; /* Identifiant d'instruction */
+
+ id = jvm_guess_next_instruction(data, pos, len, &wide, &care);
+
+ if (id != JOP_COUNT && !care)
+ {
+ if (wide) (*pos)++;
+ (*pos)++;
+ }
+
+ switch (id)
+ {
+ case JOP_NOP:
+ result = jvm_read_instr_nop(data, pos, len, addr, proc);
+ break;
+
+ case JOP_ACONST_NULL:
+ result = jvm_read_instr_aconst_null(data, pos, len, addr, proc);
+ break;
+
+ case JOP_ICONST_M1:
+ case JOP_ICONST_0:
+ case JOP_ICONST_1:
+ case JOP_ICONST_2:
+ case JOP_ICONST_3:
+ case JOP_ICONST_4:
+ case JOP_ICONST_5:
+ result = jvm_read_instr_iconst_n(data, pos, len, addr, proc);
+ break;
+
+ case JOP_POP:
+ result = jvm_read_instr_pop(data, pos, len, addr, proc);
+ break;
+
+ case JOP_POP2:
+ result = jvm_read_instr_pop2(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DUP:
+ result = jvm_read_instr_dup(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DUP_X1:
+ result = jvm_read_instr_dup_x1(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DUP_X2:
+ result = jvm_read_instr_dup_x2(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DUP2:
+ result = jvm_read_instr_dup2(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DUP2_X1:
+ result = jvm_read_instr_dup2_x1(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DUP2_X2:
+ result = jvm_read_instr_dup2_x2(data, pos, len, addr, proc);
+ break;
+
+ case JOP_IADD:
+ result = jvm_read_instr_iadd(data, pos, len, addr, proc);
+ break;
+
+ case JOP_I2L:
+ result = jvm_read_instr_i2l(data, pos, len, addr, proc);
+ break;
+
+ case JOP_I2F:
+ result = jvm_read_instr_i2f(data, pos, len, addr, proc);
+ break;
+
+ case JOP_I2D:
+ result = jvm_read_instr_i2d(data, pos, len, addr, proc);
+ break;
+
+ case JOP_L2I:
+ result = jvm_read_instr_l2i(data, pos, len, addr, proc);
+ break;
+
+ case JOP_L2F:
+ result = jvm_read_instr_l2f(data, pos, len, addr, proc);
+ break;
+
+ case JOP_L2D:
+ result = jvm_read_instr_l2d(data, pos, len, addr, proc);
+ break;
+
+ case JOP_F2I:
+ result = jvm_read_instr_f2i(data, pos, len, addr, proc);
+ break;
+
+ case JOP_F2L:
+ result = jvm_read_instr_f2l(data, pos, len, addr, proc);
+ break;
+
+ case JOP_F2D:
+ result = jvm_read_instr_f2d(data, pos, len, addr, proc);
+ break;
+
+ case JOP_D2I:
+ result = jvm_read_instr_d2i(data, pos, len, addr, proc);
+ break;
+
+ case JOP_D2L:
+ result = jvm_read_instr_d2l(data, pos, len, addr, proc);
+ break;
+
+ case JOP_D2F:
+ result = jvm_read_instr_d2f(data, pos, len, addr, proc);
+ break;
+
+ case JOP_I2B:
+ result = jvm_read_instr_i2b(data, pos, len, addr, proc);
+ break;
+
+ case JOP_I2C:
+ result = jvm_read_instr_i2c(data, pos, len, addr, proc);
+ break;
+
+ case JOP_I2S:
+ result = jvm_read_instr_i2s(data, pos, len, addr, proc);
+ break;
+
+ case JOP_ILOAD_0:
+ case JOP_ILOAD_1:
+ case JOP_ILOAD_2:
+ case JOP_ILOAD_3:
+ result = jvm_read_instr_iload_n(data, pos, len, addr, proc);
+ break;
+
+ case JOP_ALOAD_0:
+ case JOP_ALOAD_1:
+ case JOP_ALOAD_2:
+ case JOP_ALOAD_3:
+ result = jvm_read_instr_aload_n(data, pos, len, addr, proc);
+ break;
+
+ case JOP_ISTORE_0:
+ case JOP_ISTORE_1:
+ case JOP_ISTORE_2:
+ case JOP_ISTORE_3:
+ result = jvm_read_instr_istore_n(data, pos, len, addr, proc);
+ break;
+
+ case JOP_IRETURN:
+ result = jvm_read_instr_ireturn(data, pos, len, addr, proc);
+ break;
+
+ case JOP_LRETURN:
+ result = jvm_read_instr_lreturn(data, pos, len, addr, proc);
+ break;
+
+ case JOP_FRETURN:
+ result = jvm_read_instr_freturn(data, pos, len, addr, proc);
+ break;
+
+ case JOP_DRETURN:
+ result = jvm_read_instr_dreturn(data, pos, len, addr, proc);
+ break;
+
+ case JOP_ARETURN:
+ result = jvm_read_instr_areturn(data, pos, len, addr, proc);
+ break;
+
+ case JOP_RETURN:
+ result = jvm_read_instr_return(data, pos, len, addr, proc);
+ break;
+
+ case JOP_GETSTATIC:
+ result = jvm_read_instr_getstatic(data, pos, len, addr, proc);
+ break;
+
+ case JOP_INVOKE_VIRTUAL:
+ result = jvm_read_instr_invokevirtual(data, pos, len, addr, proc);
+ break;
+
+ case JOP_INVOKE_SPECIAL:
+ result = jvm_read_instr_invokespecial(data, pos, len, addr, proc);
+ break;
+
+ case JOP_INVOKE_STATIC:
+ result = jvm_read_instr_invokestatic(data, pos, len, addr, proc);
+ break;
+
+ default:
+ result = NULL;
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/src/arch/jvm/processor.h b/src/arch/jvm/processor.h
new file mode 100644
index 0000000..93bcad3
--- /dev/null
+++ b/src/arch/jvm/processor.h
@@ -0,0 +1,53 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * processor.h - prototypes pour la manipulation du processeur de la JVM
+ *
+ * Copyright (C) 2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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_JVM_PROCESSOR_H
+#define _ARCH_JVM_PROCESSOR_H
+
+
+#include "../processor.h"
+
+
+
+#define G_TYPE_JVM_PROCESSOR g_jvm_processor_get_type()
+#define G_JVM_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_jvm_processor_get_type(), GJvmProcessor))
+#define G_IS_JVM_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_jvm_processor_get_type()))
+#define G_JVM_PROCESSOR_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_jvm_processor_get_type(), GJvmProcessorIface))
+
+
+/* Définition du processeur de la JVM (instance) */
+typedef struct _GJvmProcessor GJvmProcessor;
+
+/* Définition du processeur de la JVM (classe) */
+typedef struct _GJvmProcessorClass GJvmProcessorClass;
+
+
+/* Indique le type défini par la GLib pour le processeur JVM. */
+GType g_jvm_processor_get_type(void);
+
+/* Crée le support de l'architecture JVM. */
+GArchProcessor *g_jvm_processor_new(void);
+
+
+
+#endif /* _ARCH_JVM_PROCESSOR_H */
diff --git a/src/arch/operand-int.h b/src/arch/operand-int.h
index 000700c..4a515c3 100644
--- a/src/arch/operand-int.h
+++ b/src/arch/operand-int.h
@@ -28,6 +28,9 @@
#include <stdint.h>
+#include "operand.h"
+
+
/* Types d'opérandes rencontrables */
typedef enum _AsmOperandType
@@ -80,4 +83,43 @@ struct _asm_operand
+
+
+
+
+/* Traduit un opérande en version humainement lisible. */
+typedef char * (* get_operand_text_fc) (const GArchOperand *, const exe_format *, AsmSyntax);
+
+
+/* Définition générique d'un opérande d'architecture (instance) */
+struct _GArchOperand
+{
+ GObject parent; /* A laisser en premier */
+
+ get_operand_text_fc get_text; /* Texte humain équivalent */
+
+};
+
+
+
+
+
+
+
+/* Définition générique d'un opérande d'architecture (classe) */
+struct _GArchOperandClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+
+
+
+
+
+
+
#endif /* _ARCH_OPERAND_INT_H */
diff --git a/src/arch/operand.c b/src/arch/operand.c
index 6f7cdc4..9d6fa28 100644
--- a/src/arch/operand.c
+++ b/src/arch/operand.c
@@ -811,3 +811,86 @@ void print_imm_operand(const asm_operand *operand, char *buffer, size_t len, Asm
}
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* Initialise la classe générique des opérandes. */
+static void g_arch_operand_class_init(GArchOperandClass *);
+
+/* Initialise une instance d'opérande d'architecture. */
+static void g_arch_operand_init(GArchOperand *);
+
+
+
+/* Indique le type défini pour un opérande d'architecture. */
+G_DEFINE_TYPE(GArchOperand, g_arch_operand, G_TYPE_OBJECT);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe générique des opérandes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arch_operand_class_init(GArchOperandClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance d'opérande d'architecture. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arch_operand_init(GArchOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* format = format du binaire manipulé. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : Chaîne de caractères à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *g_arch_operand_get_text(const GArchOperand *operand, const exe_format *format, AsmSyntax syntax)
+{
+ return operand->get_text(operand, format, syntax);
+
+}
diff --git a/src/arch/operand.h b/src/arch/operand.h
index fab1344..e083668 100644
--- a/src/arch/operand.h
+++ b/src/arch/operand.h
@@ -98,4 +98,33 @@ void print_imm_operand(const asm_operand *, char *, size_t, AsmSyntax);
+
+#include <glib-object.h>
+
+
+#include "../format/exe_format.h"
+
+
+
+#define G_TYPE_ARCH_OPERAND g_arch_operand_get_type()
+#define G_ARCH_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_arch_operand_get_type(), GArchOperand))
+#define G_IS_ARCH_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_arch_operand_get_type()))
+#define G_ARCH_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_arch_operand_get_type(), GArchOperandIface))
+
+
+/* Définition générique d'un opérande d'architecture (instance) */
+typedef struct _GArchOperand GArchOperand;
+
+/* Définition générique d'un opérande d'architecture (classe) */
+typedef struct _GArchOperandClass GArchOperandClass;
+
+
+/* Indique le type défini pour un opérande d'architecture. */
+GType g_arch_operand_get_type(void);
+
+/* Traduit un opérande en version humainement lisible. */
+char *g_arch_operand_get_text(const GArchOperand *, const exe_format *, AsmSyntax);
+
+
+
#endif /* _ARCH_OPERAND_H */
diff --git a/src/arch/processor-int.h b/src/arch/processor-int.h
index 6ceb7df..873ec72 100644
--- a/src/arch/processor-int.h
+++ b/src/arch/processor-int.h
@@ -25,6 +25,12 @@
#define _ARCH_PROCESSOR_INT_H
+
+
+
+
+
+
#include <stdint.h>
#include <sys/types.h>
@@ -38,11 +44,12 @@
+
/* Décode une instruction dans un flux de données. */
-typedef asm_instr * (* fetch_instruction) (const asm_processor *, const uint8_t *, off_t *, off_t, uint64_t);
+typedef asm_instr * (* fetch_instruction_) (const asm_processor *, const uint8_t *, off_t *, off_t, uint64_t);
/* Traduit une instruction en version humainement lisible. */
-typedef void (* print_instruction) (const asm_processor *, const exe_format *, const asm_instr *, char *, size_t, AsmSyntax);
+typedef void (* print_instruction_) (const asm_processor *, const exe_format *, const asm_instr *, char *, size_t, AsmSyntax);
@@ -50,9 +57,9 @@ typedef void (* print_instruction) (const asm_processor *, const exe_format *, c
struct _asm_processor
{
- fetch_instruction fetch_instr; /* Lecture d'une instruction */
+ fetch_instruction_ fetch_instr; /* Lecture d'une instruction */
- print_instruction print_instr; /* Version lisible d'une instr.*/
+ print_instruction_ print_instr; /* Version lisible d'une instr.*/
};
@@ -68,4 +75,42 @@ char *escape_crlf_bin_string(char *);
+
+
+/* Décode une instruction dans un flux de données. */
+typedef GArchInstruction * (* decode_instruction_fc) (const GArchProcessor *, const bin_t *, off_t *, off_t, vmpa_t);
+
+
+/* Définition générique d'un processeur d'architecture (instance) */
+struct _GArchProcessor
+{
+ GObject parent; /* A laisser en premier */
+
+ SourceEndian endianness; /* Boutisme de l'architecture */
+
+ decode_instruction_fc decode; /* Traduction en instructions */
+
+};
+
+
+
+
+
+
+
+/* Définition générique d'un processeur d'architecture (classe) */
+struct _GArchProcessorClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+
+
+
+
+
+
#endif /* _ARCH_PROCESSOR_INT_H */
diff --git a/src/arch/processor.c b/src/arch/processor.c
index a67986d..fb8b4de 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -26,6 +26,8 @@
+
+
#include "instruction-int.h"
#include "processor-int.h"
@@ -33,13 +35,99 @@
#include "x86/processor.h"
-asm_processor *create_processor(void)
+
+
+
+
+
+
+
+#include "artificial.h"
+#include "jvm/processor.h"
+
+
+
+
+
+
+
+/* Initialise la classe générique des processeurs. */
+static void g_arch_processor_class_init(GArchProcessorClass *);
+
+/* Initialise une instance de processeur d'architecture. */
+static void g_arch_processor_init(GArchProcessor *);
+
+
+
+/* ------------------------ ARCHITECTURES DANS LEUR ENSEMBLE ------------------------ */
+
+
+static GArchProcessor *_processors_list[APT_COUNT];
+
+
+
+
+
+
+/* Indique le type défini pour un processeur d'architecture. */
+G_DEFINE_TYPE(GArchProcessor, g_arch_processor, G_TYPE_OBJECT);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe générique des processeurs. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arch_processor_class_init(GArchProcessorClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = instance à initialiser. *
+* *
+* Description : Initialise une instance de processeur d'architecture. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arch_processor_init(GArchProcessor *proc)
{
- return create_x86_processor();
}
+/******************************************************************************
+* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
+* Description : Fournit le boustime du processeur d'une architecture. *
+* *
+* Retour : Boutisme associé au processeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+SourceEndian g_arch_processor_get_endianness(const GArchProcessor *proc)
+{
+ return proc->endianness;
+
+}
+
/******************************************************************************
* *
@@ -47,6 +135,7 @@ asm_processor *create_processor(void)
* data = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
* len = taille totale des données à analyser. *
+* base = position physique du bloc de code courant. *
* offset = adresse virtuelle de l'instruction. *
* *
* Description : Décode une instruction dans un flux de données. *
@@ -57,36 +146,23 @@ asm_processor *create_processor(void)
* *
******************************************************************************/
-asm_instr *decode_instruction(const asm_processor *proc, const uint8_t *data, off_t *pos, off_t len, off_t off, uint64_t offset)
+GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *proc, const bin_t *data, off_t *pos, off_t len, off_t base, vmpa_t addr)
{
- asm_instr *result; /* Représentation à renvoyer */
-
+ GArchInstruction *result; /* Instruction à renvoyer */
off_t old_pos; /* Sauvegarde de la position */
-
old_pos = *pos;
-
- result = proc->fetch_instr(proc, data, pos, len, offset);
-
-
-#define NULL ((void *)0) /* FIXME */
-
+ result = proc->decode(proc, data, pos, len, addr);
if (result == NULL)
{
*pos = old_pos;
-
- //printf("err while decoding opcode 0x%02hhx at 0x%08llx\n", data[*pos], offset);
- result = create_db_instruction(data, pos, len);
+ printf("ERRerr while decoding opcode 0x%02hhx at 0x%08llx\n", data[*pos], addr);
+ result = g_db_instruction_new_from_data(data, pos, len, base, proc);
}
-
- result->vaddress = offset;
-
- result->offset = off + old_pos;
- result->length = *pos - old_pos;
-
+ g_arch_instruction_set_location(result, base + old_pos, *pos - old_pos, addr);
return result;
@@ -94,27 +170,46 @@ asm_instr *decode_instruction(const asm_processor *proc, const uint8_t *data, of
+/* ---------------------------------------------------------------------------------- */
+/* ARCHITECTURES DANS LEUR ENSEMBLE */
+/* ---------------------------------------------------------------------------------- */
+
+
/******************************************************************************
* *
-* Paramètres : proc = architecture visée par la procédure. *
-* format = format du binaire manipulé. *
-* instr = instruction à traiter. *
-* buffer = tampon de sortie mis à disposition. [OUT] *
-* len = taille de ce tampon. *
-* syntax = type de représentation demandée. *
+* Paramètres : - *
* *
-* Description : Traduit une instruction en version humainement lisible. *
+* Description : Procède au chargement des différentes architectures. *
* *
-* Retour : - *
+* Retour : Toujours true. *
* *
* Remarques : - *
* *
******************************************************************************/
-void print_hinstruction(const asm_processor *proc, const exe_format *format, const asm_instr *instr, char *buffer, size_t len, AsmSyntax syntax)
+bool init_all_processors(void)
{
- proc->print_instr(proc, format, instr, buffer, len, syntax);
+ _processors_list[APT_JVM] = g_jvm_processor_new();
+
+ return true;
}
+/******************************************************************************
+* *
+* Paramètres : type = sorte de processeur recherché. *
+* *
+* Description : Fournit le processeur d'architecture correspondant à un type.*
+* *
+* Retour : Processeur d'architecture trouvé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchProcessor *get_arch_processor_for_type(ArchProcessorType type)
+{
+ return _processors_list[type];
+
+}
diff --git a/src/arch/processor.h b/src/arch/processor.h
index 6c65e95..0c6d852 100644
--- a/src/arch/processor.h
+++ b/src/arch/processor.h
@@ -30,7 +30,6 @@
#include "operand.h" /* AsmSyntax */
#include "instruction.h"
-#include "../format/exe_format.h"
@@ -57,12 +56,57 @@ asm_processor *create_processor(void);
+
+
+#include <glib-object.h>
+
+
+#include "../common/endianness.h"
+
+
+
+#define G_TYPE_ARCH_PROCESSOR g_arch_processor_get_type()
+#define G_ARCH_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_arch_processor_get_type(), GArchProcessor))
+#define G_IS_ARCH_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_arch_processor_get_type()))
+#define G_ARCH_PROCESSOR_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_arch_processor_get_type(), GArchProcessorIface))
+
+
+/* Ligne de représentation générique (instance) */
+typedef struct _GArchProcessor GArchProcessor;
+
+/* Ligne de représentation générique (classe) */
+typedef struct _GArchProcessorClass GArchProcessorClass;
+
+
+/* Indique le type défini pour un processeur d'architecture. */
+GType g_arch_processor_get_type(void);
+
+/* Fournit le boustime du processeur d'une architecture. */
+SourceEndian g_arch_processor_get_endianness(const GArchProcessor *);
+
/* Décode une instruction dans un flux de données. */
-asm_instr *decode_instruction(const asm_processor *, const uint8_t *, off_t *, off_t, off_t, uint64_t);
+GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *, const bin_t *, off_t *, off_t, off_t, vmpa_t);
+
+
+
+/* ------------------------ ARCHITECTURES DANS LEUR ENSEMBLE ------------------------ */
+
+
+/* Type de processeurs disponibles */
+typedef enum _ArchProcessorType
+{
+ APT_JVM, /* Java Virtual Machine */
+
+ APT_COUNT
+
+} ArchProcessorType;
+
-/* Traduit une instruction en version humainement lisible. */
-void print_hinstruction(const asm_processor *, const exe_format *, const asm_instr *, char *, size_t, AsmSyntax);
+/* Procède au chargement des différentes architectures. */
+bool init_all_processors(void);
+/* Fournit le processeur d'architecture correspondant à un type. */
+GArchProcessor *get_arch_processor_for_type(ArchProcessorType);
diff --git a/src/arch/x86/Makefile.am b/src/arch/x86/Makefile.am
index 95298b9..8f49e54 100644
--- a/src/arch/x86/Makefile.am
+++ b/src/arch/x86/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libarchx86.la
+noinst_LTLIBRARIES = libarchx86.la
libarchx86_la_SOURCES = \
instruction.h \
diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c
index 9187926..dfb2f12 100644
--- a/src/arch/x86/processor.c
+++ b/src/arch/x86/processor.c
@@ -168,8 +168,8 @@ asm_processor *create_x86_processor(void)
x86_register_instructions(result);
- ASM_PROCESSOR(result)->fetch_instr = (fetch_instruction)x86_fetch_instruction;
- ASM_PROCESSOR(result)->print_instr = (print_instruction)x86_print_instruction;
+ ASM_PROCESSOR(result)->fetch_instr = (fetch_instruction_)x86_fetch_instruction;
+ ASM_PROCESSOR(result)->print_instr = (print_instruction_)x86_print_instruction;
return ASM_PROCESSOR(result);
diff --git a/src/common/endianness.c b/src/common/endianness.c
index 202262a..17ee252 100755
--- a/src/common/endianness.c
+++ b/src/common/endianness.c
@@ -45,7 +45,7 @@
* *
******************************************************************************/
-bool read_u8(uint8_t *target, const uint8_t *data, off_t *pos, off_t len, SourceEndian endian)
+bool read_u8(uint8_t *target, const bin_t *data, off_t *pos, off_t len, SourceEndian endian)
{
if ((len - *pos) < 1) return false;
@@ -74,7 +74,7 @@ bool read_u8(uint8_t *target, const uint8_t *data, off_t *pos, off_t len, Source
* *
******************************************************************************/
-bool read_u16(uint16_t *target, const uint8_t *data, off_t *pos, off_t len, SourceEndian endian)
+bool read_u16(uint16_t *target, const bin_t *data, off_t *pos, off_t len, SourceEndian endian)
{
if ((len - *pos) < 2) return false;
@@ -127,7 +127,7 @@ bool read_u16(uint16_t *target, const uint8_t *data, off_t *pos, off_t len, Sour
* *
******************************************************************************/
-bool read_u32(uint32_t *target, const uint8_t *data, off_t *pos, off_t len, SourceEndian endian)
+bool read_u32(uint32_t *target, const bin_t *data, off_t *pos, off_t len, SourceEndian endian)
{
if ((len - *pos) < 4) return false;
diff --git a/src/common/endianness.h b/src/common/endianness.h
index 7ae9575..b4c3975 100755
--- a/src/common/endianness.h
+++ b/src/common/endianness.h
@@ -26,10 +26,13 @@
#include <stdbool.h>
-#include <stdint.h>
#include <sys/types.h>
+#include "../arch/archbase.h"
+
+
+
/* Type de boutismes existants */
typedef enum _SourceEndian
{
@@ -41,13 +44,13 @@ typedef enum _SourceEndian
/* Lit un nombre non signé sur un octet. */
-bool read_u8(uint8_t *, const uint8_t *, off_t *, off_t, SourceEndian );
+bool read_u8(uint8_t *, const bin_t *, off_t *, off_t, SourceEndian);
/* Lit un nombre non signé sur deux octets. */
-bool read_u16(uint16_t *, const uint8_t *, off_t *, off_t, SourceEndian);
+bool read_u16(uint16_t *, const bin_t *, off_t *, off_t, SourceEndian);
/* Lit un nombre non signé sur quatre octets. */
-bool read_u32(uint32_t *, const uint8_t *, off_t *, off_t, SourceEndian);
+bool read_u32(uint32_t *, const bin_t *, off_t *, off_t, SourceEndian);
diff --git a/src/common/extstr.c b/src/common/extstr.c
index 5187567..5b2dfd8 100644
--- a/src/common/extstr.c
+++ b/src/common/extstr.c
@@ -120,9 +120,73 @@ int strrcmp(const char *str1, const char *str2)
/******************************************************************************
* *
+* Paramètres : haystack = botte de foin à fouiller. *
+* needle1 = aiguille à trouver et remplacer. *
+* needle2 = aiguille de remplacement. *
+* *
+* Description : Remplace des éléments d'une chaîne par d'autres. *
+* *
+* Retour : Adresse de la chaîne de caractères modifiée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *strrpl(char *haystack, const char *needle1, const char *needle2)
+{
+ size_t inlen; /* Taille en entrée */
+ size_t len1; /* Taille de l'aiguille n°1 */
+ size_t len2; /* Taille de l'aiguille n°2 */
+ regex_t preg; /* Expression régulière */
+ int ret; /* Bilan de l'appel */
+ size_t curpos; /* Point de recherche */
+ regmatch_t pmatch; /* Résultats remontés */
+
+ inlen = strlen(haystack) + 1;
+ len1 = strlen(needle1);
+ len2 = strlen(needle2);
+
+ ret = regcomp(&preg, needle1, REG_EXTENDED | REG_ICASE);
+ /* TODO: ret */
+
+ for (curpos = 0; regexec(&preg, &haystack[curpos], 1, &pmatch, 0) != REG_NOMATCH; )
+ {
+ if (len1 != len2)
+ {
+ if (len2 > len1)
+ inlen += len2 - len1;
+
+ else
+ inlen -= len1 - len2;
+
+ haystack = (char *)realloc(haystack, inlen * sizeof(char *));
+
+ if (len2 > len1)
+ memmove(&haystack[curpos + pmatch.rm_eo + len2 - len1], &haystack[curpos + pmatch.rm_eo],
+ inlen - (len2 - len1) - curpos - pmatch.rm_eo);
+
+ else
+ memmove(&haystack[curpos + pmatch.rm_eo + len1 - len2], &haystack[curpos + pmatch.rm_eo],
+ inlen - (len1 - len2) - curpos - pmatch.rm_eo);
+
+ }
+
+ memcpy(&haystack[curpos + pmatch.rm_so], needle2, len2);
+
+ curpos += pmatch.rm_eo + len2;
+
+ }
+
+ return haystack;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : input = chaîne de caractères à traiter. *
* *
-* Description : S'assure qu'une chaîne de caractère tient sur une ligne. *
+* Description : S'assure qu'une chaîne de caractères tient sur une ligne. *
* *
* Retour : Adresse de la chaîne de caractères modifiée. *
* *
diff --git a/src/common/extstr.h b/src/common/extstr.h
index 2ce0257..3e27608 100644
--- a/src/common/extstr.h
+++ b/src/common/extstr.h
@@ -35,7 +35,10 @@ char *strprep(char *, const char *);
/* Compare deux chaînes de caractères en partant de la fin. */
int strrcmp(const char *, const char *);
-/* S'assure qu'une chaîne de caractère tient sur une ligne. */
+/* Remplace des éléments d'une chaîne par d'autres. */
+char *strrpl(char *, const char *, const char *);
+
+/* S'assure qu'une chaîne de caractères tient sur une ligne. */
char *escape_crlf(char *);
diff --git a/src/editor.c b/src/editor.c
index c975da6..ff1217b 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -183,6 +183,7 @@ int main(int argc, char **argv)
add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps");
/* Initialisation du programme */
+ init_all_processors();
init_all_demanglers();
init_all_exe_formats();
diff --git a/src/format/Makefile.am b/src/format/Makefile.am
index cad15c5..92a774b 100644
--- a/src/format/Makefile.am
+++ b/src/format/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libformat.la
+noinst_LTLIBRARIES = libformat.la
libformat_la_SOURCES = \
exe_format.h exe_format.c \
@@ -7,6 +7,13 @@ libformat_la_SOURCES = \
dbg_format.h dbg_format.c \
dbg_format-int.h
+libformat_la_LIBADD = \
+ dwarf/libformatdwarf.la \
+ elf/libformatelf.la \
+ java/libformatjava.la \
+ mangling/libformatmangling.la \
+ pe/libformatpe.la
+
libformat_la_LDFLAGS =
diff --git a/src/format/dwarf/Makefile.am b/src/format/dwarf/Makefile.am
index d5853c3..6bfccf0 100644
--- a/src/format/dwarf/Makefile.am
+++ b/src/format/dwarf/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libformatdwarf.la
+noinst_LTLIBRARIES = libformatdwarf.la
libformatdwarf_la_SOURCES = \
abbrev.h abbrev.c \
diff --git a/src/format/elf/Makefile.am b/src/format/elf/Makefile.am
index 680afd7..ce23fb4 100644
--- a/src/format/elf/Makefile.am
+++ b/src/format/elf/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libformatelf.la
+noinst_LTLIBRARIES = libformatelf.la
libformatelf_la_SOURCES = \
e_elf.h e_elf.c \
diff --git a/src/format/elf/symbol.c b/src/format/elf/symbol.c
index c80ceb4..f1c320f 100644
--- a/src/format/elf/symbol.c
+++ b/src/format/elf/symbol.c
@@ -483,7 +483,7 @@ asm_instr **decode_elf_relocations(elf_format *format, size_t *count)
off_t pos; /* Tête de lecture */
uint64_t offset; /* Adresse virtuelle courante */
asm_instr *instr; /* Instruction décodée */
-
+#if 0
asm_processor *proc; /* TODO : remove me ! */
proc = create_x86_processor();
@@ -519,6 +519,10 @@ asm_instr **decode_elf_relocations(elf_format *format, size_t *count)
result[*count - 1] = instr;
}
+#endif
+
+ result = NULL;
+ *count = 0;
return result;
diff --git a/src/format/exe_format-int.h b/src/format/exe_format-int.h
index 3bba821..bb96ea5 100644
--- a/src/format/exe_format-int.h
+++ b/src/format/exe_format-int.h
@@ -51,6 +51,9 @@ struct _bin_part
/* Fournit l'adresse mémoire du point d'entrée du programme. */
typedef uint64_t (* get_entry_point_fc) (const exe_format *);
+/* Indique le type d'architecture visée par le format. */
+typedef FormatTargetMachine (* get_target_machine_fc) (const exe_format *);
+
/* Fournit les références aux zones de code à analyser. */
typedef bin_part ** (* get_def_parts_fc) (const exe_format *, size_t *);
@@ -77,6 +80,7 @@ struct _exe_format
off_t length; /* Taille de ce contenu */
get_entry_point_fc get_entry_point; /* Obtention du point d'entrée */
+ get_target_machine_fc get_target_machine; /* Architecture ciblée */
get_def_parts_fc get_def_parts; /* Liste des parties de code */
find_section_fc find_section; /* Recherche d'une section */
get_symbols_fc get_symbols; /* Liste des symboles présents */
diff --git a/src/format/exe_format.c b/src/format/exe_format.c
index 2b8f893..aeeaea3 100644
--- a/src/format/exe_format.c
+++ b/src/format/exe_format.c
@@ -346,6 +346,25 @@ const uint8_t *get_exe_content(const exe_format *format, off_t *length)
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* *
+* Description : Indique le type d'architecture visée par le format. *
+* *
+* Retour : Identifiant de l'architecture ciblée par le format. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+FormatTargetMachine get_exe_target_machine(const exe_format *format)
+{
+ return format->get_target_machine(format);
+
+}
+
+
diff --git a/src/format/exe_format.h b/src/format/exe_format.h
index 13a37ee..1b359ff 100644
--- a/src/format/exe_format.h
+++ b/src/format/exe_format.h
@@ -89,6 +89,17 @@ exe_format *load_new_exe_format(const uint8_t *, off_t);
+/* Architectures de destination des formats */
+typedef enum _FormatTargetMachine
+{
+ FTM_JVM, /* Java Virtual Machine */
+
+ FTM_COUNT
+
+} FormatTargetMachine;
+
+
+
/* Types de symbole */
typedef enum _SymbolType
@@ -117,6 +128,11 @@ uint64_t get_exe_entry_point(const exe_format *);
+/* Indique le type d'architecture visée par le format. */
+FormatTargetMachine get_exe_target_machine(const exe_format *);
+
+
+
/* Recherche une section donnée au sein de binaire. */
bool find_exe_section(const exe_format *, const char *, off_t *, off_t *, uint64_t *);
diff --git a/src/format/java/Makefile.am b/src/format/java/Makefile.am
index 133eae0..46bee9e 100755
--- a/src/format/java/Makefile.am
+++ b/src/format/java/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libformatjava.la
+noinst_LTLIBRARIES = libformatjava.la
libformatjava_la_SOURCES = \
attribute.h attribute.c \
diff --git a/src/format/java/e_java.c b/src/format/java/e_java.c
index e2f8fbf..18300e8 100755
--- a/src/format/java/e_java.c
+++ b/src/format/java/e_java.c
@@ -37,6 +37,23 @@
+
+/* Indique le type d'architecture visée par le format. */
+FormatTargetMachine get_java_target_machine(const java_format *);
+
+
+
+/* Fournit les références aux zones de code à analyser. */
+bin_part **get_java_default_code_parts(const java_format *, size_t *);
+
+
+/* Fournit le prototype de toutes les routines détectées. */
+bin_routine **get_all_java_routines(const java_format *, size_t *);
+
+
+
+
+
/******************************************************************************
* *
* Paramètres : content = contenu binaire à parcourir. *
@@ -89,6 +106,10 @@ exe_format *load_java(const uint8_t *content, off_t length)
EXE_FORMAT(result)->content = content;
EXE_FORMAT(result)->length = length;
+ EXE_FORMAT(result)->get_target_machine = (get_target_machine_fc)get_java_target_machine;
+ EXE_FORMAT(result)->get_def_parts = (get_def_parts_fc)get_java_default_code_parts;
+ EXE_FORMAT(result)->get_all_routines = (get_all_routines_fc)get_all_java_routines;
+
pos = 0;
if (!read_u32(&magic, content, &pos, length, SRE_BIG))
@@ -171,3 +192,93 @@ void unload_java(java_format *format)
free(format);
}
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* *
+* Description : Indique le type d'architecture visée par le format. *
+* *
+* Retour : Identifiant de l'architecture ciblée par le format. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+FormatTargetMachine get_java_target_machine(const java_format *format)
+{
+ return FTM_JVM;
+
+}
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* count = quantité de zones listées. [OUT] *
+* *
+* Description : Fournit les références aux zones de code à analyser. *
+* *
+* Retour : Zones de code à analyser. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bin_part **get_java_default_code_parts(const java_format *format, size_t *count)
+{
+ bin_part **result; /* Tableau à retourner */
+ uint16_t i; /* Boucle de parcours */
+ off_t offset; /* Position physique */
+ off_t size; /* Taille de la partie */
+ bin_part *part; /* Partie à intégrer à la liste*/
+
+ result = NULL;
+ *count = 0;
+
+ for (i = 0; i < format->methods_count; i++)
+ if (find_java_method_code_part(&format->methods[i], &offset, &size))
+ {
+ part = create_bin_part();
+
+ set_bin_part_values(part, offset, size, offset);
+
+ result = (bin_part **)realloc(result, ++(*count) * sizeof(bin_part *));
+ result[*count - 1] = part;
+
+ }
+
+ return result;
+
+}
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* count = taille du tableau créé. [OUT] *
+* *
+* Description : Fournit le prototype de toutes les routines détectées. *
+* *
+* Retour : Tableau créé ou NULL si aucun symbole de routine trouvé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bin_routine **get_all_java_routines(const java_format *format, size_t *count)
+{
+ *count = 0;
+
+ return NULL;
+
+}
diff --git a/src/format/java/method.c b/src/format/java/method.c
index bf927a1..ec4aa85 100644
--- a/src/format/java/method.c
+++ b/src/format/java/method.c
@@ -28,7 +28,6 @@
#include "attribute.h"
-#include "java-int.h"
#include "../../common/endianness.h"
@@ -155,3 +154,34 @@ void unload_java_method(java_format *format, java_method *method)
unload_java_attributes(format, method->attributes, method->attributes_count);
}
+
+
+/******************************************************************************
+* *
+* Paramètres : method = élément à traiter. *
+* offset = position physique du code de la méthode. [OUT] *
+* size = taille du code de la méthode. [OUT] *
+* *
+* Description : Retrouve le code binaire correspondant à une méthode. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool find_java_method_code_part(const java_method *method, off_t *offset, off_t *size)
+{
+ uint16_t i; /* Boucle de parcours */
+
+ for (i = 0; i < method->attributes_count; i++)
+ if (method->attributes[i].type == JAT_CODE)
+ {
+ *offset = method->attributes[i].info.code.content;
+ *size = method->attributes[i].info.code.code_length;
+ break;
+ }
+
+ return (i < method->attributes_count);
+
+}
diff --git a/src/format/java/method.h b/src/format/java/method.h
index 01cef95..96ed8de 100644
--- a/src/format/java/method.h
+++ b/src/format/java/method.h
@@ -26,6 +26,7 @@
#include "e_java.h"
+#include "java-int.h"
@@ -35,6 +36,9 @@ bool load_java_methods(java_format *, off_t *);
/* Décharge les méthodes d'un binaire Java. */
void unload_java_methods(java_format *);
+/* Retrouve le code binaire correspondant à une méthode. */
+bool find_java_method_code_part(const java_method *method, off_t *, off_t *);
+
#endif /* _FORMAT_JAVA_METHOD_H */
diff --git a/src/format/java/pool.c b/src/format/java/pool.c
index f735819..eec2918 100755
--- a/src/format/java/pool.c
+++ b/src/format/java/pool.c
@@ -30,12 +30,16 @@
#include "java-int.h"
#include "../../common/endianness.h"
+#include "../../common/extstr.h"
/* Charge les propriétés d'une constante du réservoir. */
bool load_java_pool_entry(java_format *, constant_pool_entry *, off_t *);
+/* Fournit une entrée donnée du réservoir de constantes. */
+const constant_pool_entry *get_java_pool_entry(const java_format *, uint16_t, ConstantPoolTag);
+
/******************************************************************************
@@ -319,36 +323,150 @@ bool load_java_pool_entry(java_format *format, constant_pool_entry *entry, off_t
/******************************************************************************
* *
-* Paramètres : format = description de l'exécutable à compléter. *
+* Paramètres : format = description de l'exécutable à consulter. *
* index = indice de l'élément dont la valeur est à recupérer. *
-* str = adresse où placer la chaîne de caractères trouvée. *
+* expected = type de l'élément à trouver à l'indice donné. *
* *
-* Description : Recherche une chaîne de caractères dans le réservoir. *
+* Description : Fournit une entrée donnée du réservoir de constantes. *
* *
-* Retour : true si l'opération s'est bien déroulée, false sinon. *
+* Retour : Entrée du réservoir de constantes ou NULL en cas d'erreur. *
* *
* Remarques : - *
* *
******************************************************************************/
-bool get_java_pool_ut8_string(java_format *format, uint16_t index, const char **str)
+const constant_pool_entry *get_java_pool_entry(const java_format *format, uint16_t index, ConstantPoolTag expected)
{
- bool result; /* Bilan à renvoyer */
+ const constant_pool_entry *result; /* Entrée à retourner */
constant_pool_entry *entry; /* Entrée du réservoir visée */
- result = (index <= format->pool_len);
+ result = NULL;
- if (result)
+ if (/*index < 0 && FIXME */index <= format->pool_len);
{
entry = &format->pool[index - 1];
- result = (entry->tag == CONSTANT_UTF8);
+ if (entry->tag == expected)
+ result = entry;
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à consulter. *
+* index = indice de l'élément de la table à recupérer. *
+* expected = type de l'élément à trouver à l'indice donné. *
+* *
+* Description : Construit une version humaine de référence. *
+* *
+* Retour : Référence construite ou NULL en cas de problème. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *build_reference_from_java_pool(const java_format *format, uint16_t index, JavaRefType expected)
+{
+ char *result; /* Chaîne humaine à retourner */
+ const constant_pool_entry *entry; /* Entrée du réservoir visée 1 */
+ const constant_pool_entry *subentry; /* Entrée du réservoir visée 2 */
+ const char *tmp; /* Copie de chaîne intouchable */
- if (result)
- (*str) = entry->info.utf8.bytes;
+ result = NULL;
+ switch (expected)
+ {
+ case JRT_FIELD:
+ entry = get_java_pool_entry(format, index, CONSTANT_FIELD_REF);
+ break;
+ case JRT_METHOD:
+ entry = get_java_pool_entry(format, index, CONSTANT_METHOD_REF);
+ break;
+ case JRT_INTERFACE_METHOD:
+ entry = get_java_pool_entry(format, index, CONSTANT_INTERFACE_METHOD_REF);
+ break;
+ default:
+ entry = NULL;
+ break;
}
+ if (entry == NULL)
+ goto brfjp_error;
+
+ /* Lieu parent où trouver la référence */
+
+ subentry = get_java_pool_entry(format, entry->info.ref.class_index, CONSTANT_CLASS);
+
+ if (subentry == NULL)
+ goto brfjp_error;
+
+ if (!get_java_pool_ut8_string(format, subentry->info.class.name_index, &tmp))
+ goto brfjp_error;
+
+ result = strdup(tmp);
+
+ /* Champ proprement dit */
+
+ subentry = get_java_pool_entry(format, entry->info.ref.name_and_type_index, CONSTANT_NAME_AND_TYPE);
+
+ if (subentry == NULL)
+ goto brfjp_error;
+
+ if (!get_java_pool_ut8_string(format, subentry->info.name_type.name_index, &tmp))
+ goto brfjp_error;
+
+ result = stradd(result, ".");
+ result = stradd(result, tmp);
+
+ /* Petites retouches finales */
+
+ result = strrpl(result, "/", ".");
+ result = strrpl(result, "<", "&lt;");
+ result = strrpl(result, ">", "&gt;");
+
+ return result;
+
+ brfjp_error:
+
+ if (result != NULL)
+ free(result);
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à consulter. *
+* index = indice de l'élément dont la valeur est à recupérer. *
+* str = adresse où placer la chaîne de caractères trouvée. *
+* *
+* Description : Recherche une chaîne de caractères dans le réservoir. *
+* *
+* Retour : true si l'opération s'est bien déroulée, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool get_java_pool_ut8_string(const java_format *format, uint16_t index, const char **str)
+{
+ bool result; /* Bilan à renvoyer */
+ const constant_pool_entry *entry; /* Entrée du réservoir visée */
+
+ entry = get_java_pool_entry(format, index, CONSTANT_UTF8);
+
+ result = (entry != NULL);
+
+ if (result)
+ (*str) = entry->info.utf8.bytes;
+
return result;
}
diff --git a/src/format/java/pool.h b/src/format/java/pool.h
index 49d66a7..62d8a84 100755
--- a/src/format/java/pool.h
+++ b/src/format/java/pool.h
@@ -29,14 +29,28 @@
+/* Types de référence Java */
+typedef enum _JavaRefType
+{
+ JRT_FIELD, /* Champ */
+ JRT_METHOD, /* Méthode */
+ JRT_INTERFACE_METHOD /* Méthode d'interface */
+
+} JavaRefType;
+
+
/* Charge le réservoir de constantes d'un binaire Java. xs*/
bool load_java_pool(java_format *, off_t *);
/* Décharge le réservoir de constantes d'un binaire Java. */
void unload_java_pool(java_format *);
+/* Construit une version humaine de référence. */
+char *build_reference_from_java_pool(const java_format *, uint16_t, JavaRefType);
+
/* Recherche une chaîne de caractères dans le réservoir. */
-bool get_java_pool_ut8_string(java_format *, uint16_t, const char **);
+bool get_java_pool_ut8_string(const java_format *, uint16_t, const char **);
+
#endif /* _FORMAT_JAVA_POOL_H */
diff --git a/src/format/mangling/Makefile.am b/src/format/mangling/Makefile.am
index a52a174..80c0757 100644
--- a/src/format/mangling/Makefile.am
+++ b/src/format/mangling/Makefile.am
@@ -3,7 +3,7 @@ BUILT_SOURCES = itanium_gram.h
AM_YFLAGS = -d
-lib_LTLIBRARIES = libformatmangling.la
+noinst_LTLIBRARIES = libformatmangling.la
libformatmangling_la_SOURCES = \
demangler.h demangler.c \
diff --git a/src/format/pe/Makefile.am b/src/format/pe/Makefile.am
index c70a80f..7fb0d91 100755
--- a/src/format/pe/Makefile.am
+++ b/src/format/pe/Makefile.am
@@ -1,5 +1,5 @@
-lib_LTLIBRARIES = libformatpe.la
+noinst_LTLIBRARIES = libformatpe.la
libformatpe_la_SOURCES = \
e_pe.h e_pe.c \
diff --git a/src/gtkext/Makefile.am b/src/gtkext/Makefile.am
index 4df0ffe..021a061 100644
--- a/src/gtkext/Makefile.am
+++ b/src/gtkext/Makefile.am
@@ -1,7 +1,7 @@
BUILT_SOURCES = iodamarshal.h iodamarshal.c
-lib_LTLIBRARIES = libgtkext.la
+noinst_LTLIBRARIES = libgtkext.la
libgtkext_la_SOURCES = \
easygtk.h easygtk.c \
diff --git a/src/panel/Makefile.am b/src/panel/Makefile.am
index c69e2ca..f53a841 100755
--- a/src/panel/Makefile.am
+++ b/src/panel/Makefile.am
@@ -1,13 +1,12 @@
-lib_LTLIBRARIES = libpanel.la
+noinst_LTLIBRARIES = libpanel.la
libpanel_la_SOURCES = \
log.h log.c \
panels.h panels.c \
registers.h registers.c
-libpanel_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBPYTHON_LIBS) \
- -L../gtkext/.libs -lgtkext
+libpanel_la_LDFLAGS =
INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index f6ceef2..36fc9b4 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -8,9 +8,7 @@ libplugins_la_SOURCES = \
libplugins_la_CFLAGS = $(AM_CFLAGS)
-libpyoida_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS) $(LIBPYTHON_LIBS) \
- -L../common/.libs -lcommon \
- -L../format/.libs -lformat
+libplugins_la_LDFLAGS =
INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
@@ -19,4 +17,4 @@ AM_CPPFLAGS =
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = overjump pyoida
+SUBDIRS = #overjump pyoida
diff --git a/src/plugins/overjump/overjump.c b/src/plugins/overjump/overjump.c
index f712979..e654040 100644
--- a/src/plugins/overjump/overjump.c
+++ b/src/plugins/overjump/overjump.c
@@ -29,7 +29,6 @@
-typedef uint64_t vmpa_t;