summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-16 07:07:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-16 07:07:15 (GMT)
commit635640a32fecbb9b8a5ddf239b819c022c4b9977 (patch)
treef8fc69a2c2db411000996146536ca5cc4f54d417 /src/format
parentbf879f2562545ab7de23f9d38364b7bd4b43fb2c (diff)
Added a basic support for Mobicore truslets.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@472 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format')
-rw-r--r--src/format/elf/elf-int.c6
-rw-r--r--src/format/elf/symbols.c108
-rw-r--r--src/format/format-int.h1
-rw-r--r--src/format/format.c1
4 files changed, 59 insertions, 57 deletions
diff --git a/src/format/elf/elf-int.c b/src/format/elf/elf-int.c
index a2ef9b2..4fd65df 100644
--- a/src/format/elf/elf-int.c
+++ b/src/format/elf/elf-int.c
@@ -31,9 +31,9 @@
/******************************************************************************
* *
* Paramètres : format = informations chargées à consulter. *
-* header = en-tête à déterminer. [OUT] *
-* is_32b = indique si le format est en 32 ou 64 bits. [OUT] *
-* endian = boutisme reconnu dans le format. [OUT] *
+* header = en-tête à déterminer. [OUT] *
+* is_32b = indique si le format est en 32 ou 64 bits. [OUT] *
+* endian = boutisme reconnu dans le format. [OUT] *
* *
* Description : Procède à la lecture de l'en-tête d'un contenu binaire ELF. *
* *
diff --git a/src/format/elf/symbols.c b/src/format/elf/symbols.c
index c09c429..1c3da14 100644
--- a/src/format/elf/symbols.c
+++ b/src/format/elf/symbols.c
@@ -544,7 +544,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* ELFMAG (0) */
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 4, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 4, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 1, IOD_CHAR);
SET_IMM_DISPLAY(instr, operand, 2, IOD_CHAR);
@@ -570,7 +570,7 @@ static bool annotate_elf_header(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -594,7 +594,7 @@ static bool annotate_elf_header(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -615,7 +615,7 @@ static bool annotate_elf_header(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -672,7 +672,7 @@ static bool annotate_elf_header(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -680,7 +680,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* EI_ABIVERSION (8) */
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -688,7 +688,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Padding */
- instr = g_raw_instruction_new_array(content, MDS_8_BITS, 7, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_8_BITS, 7, pos, length, format->endian);
g_raw_instruction_mark_as_padding(G_RAW_INSTRUCTION(instr), true);
@@ -724,7 +724,7 @@ static bool annotate_elf_header(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -815,7 +815,7 @@ static bool annotate_elf_header(GElfFormat *format)
default: text = _("Architecture: unknown"); break;
}
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -823,7 +823,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_version" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -833,19 +833,19 @@ static bool annotate_elf_header(GElfFormat *format)
{
/* Champ "e_entry" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Entry point virtual address"));
/* Champ "e_phoff" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Program header table file offset"));
/* Champ "e_shoff" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section header table file offset"));
@@ -855,19 +855,19 @@ static bool annotate_elf_header(GElfFormat *format)
{
/* Champ "e_entry" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Entry point virtual address"));
/* Champ "e_phoff" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Program header table file offset"));
/* Champ "e_shoff" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section header table file offset"));
@@ -877,7 +877,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_flags" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
//SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -885,7 +885,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_ehsize" */
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -893,7 +893,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_phentsize" */
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -901,7 +901,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_phnum" */
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -909,7 +909,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_shentsize" */
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -917,7 +917,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_shnum" */
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -925,7 +925,7 @@ static bool annotate_elf_header(GElfFormat *format)
/* Champ "e_shstrndx" */
- instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_16_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -1049,7 +1049,7 @@ static bool annotate_elf_program_header_table(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, disp);
@@ -1059,31 +1059,31 @@ static bool annotate_elf_program_header_table(GElfFormat *format)
{
/* Champ "p_offset" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment file offset"));
/* Champ "p_vaddr" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment virtual address"));
/* Champ "p_paddr" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment physical address"));
/* Champ "p_filesz" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment size in file"));
/* Champ "p_memsz" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment size in memory"));
@@ -1119,7 +1119,7 @@ static bool annotate_elf_program_header_table(GElfFormat *format)
if (!filled)
dtext = stradd(dtext, _("none"));
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, dtext);
@@ -1127,7 +1127,7 @@ static bool annotate_elf_program_header_table(GElfFormat *format)
/* Champ "p_align" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment alignment"));
@@ -1166,7 +1166,7 @@ static bool annotate_elf_program_header_table(GElfFormat *format)
if (!filled)
dtext = stradd(dtext, _("none"));
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, dtext);
@@ -1174,37 +1174,37 @@ static bool annotate_elf_program_header_table(GElfFormat *format)
/* Champ "p_offset" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment file offset"));
/* Champ "p_vaddr" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment virtual address"));
/* Champ "p_paddr" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment physical address"));
/* Champ "p_filesz" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment size in file"));
/* Champ "p_memsz" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment size in memory"));
/* Champ "p_align" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Segment alignment"));
@@ -1280,7 +1280,7 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
dtext = stradd(dtext, "'");
}
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -1406,7 +1406,7 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
break;
}
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, disp);
@@ -1460,7 +1460,7 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
{
/* Champ "sh_flags" (suite) */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, dtext);
@@ -1468,19 +1468,19 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
/* Champ "sh_addr" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section virtual addr at execution"));
/* Champ "sh_offset" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section file offset"));
/* Champ "sh_size" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -1491,7 +1491,7 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
{
/* Champ "sh_flags" (suite) */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, dtext);
@@ -1499,19 +1499,19 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
/* Champ "sh_addr" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section virtual addr at execution"));
/* Champ "sh_offset" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section file offset"));
/* Champ "sh_size" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -1521,13 +1521,13 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
/* Champ "sh_link" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Link to another section"));
/* Champ "sh_info" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Additional section information"));
@@ -1535,13 +1535,13 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
{
/* Champ "sh_addralign" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section alignment"));
/* Champ "sh_entsize" */
- instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_32_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
@@ -1552,13 +1552,13 @@ static bool annotate_elf_section_header_table(GElfFormat *format)
{
/* Champ "sh_addralign" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
ADD_RAW_AS_SYM(format, symbol, pos, instr, comment, _("Section alignment"));
/* Champ "sh_entsize" */
- instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, pos, length, format->endian);
+ instr = g_raw_instruction_new_array_old(content, MDS_64_BITS, 1, pos, length, format->endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
diff --git a/src/format/format-int.h b/src/format/format-int.h
index 22b0c0f..96ff081 100644
--- a/src/format/format-int.h
+++ b/src/format/format-int.h
@@ -41,6 +41,7 @@ struct _GBinFormat
{
GObject parent; /* A laisser en premier */
+ GBinContent *conten_; /* Contenu binaire à étudier */
const bin_t *content; /* Contenu binaire à étudier */
off_t length; /* Taille de ce contenu */
diff --git a/src/format/format.c b/src/format/format.c
index c779947..fa00856 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -105,6 +105,7 @@ static void g_binary_format_init(GBinFormat *format)
void g_binary_format_set_content(GBinFormat *format, GBinContent *content)
{
+ format->conten_ = content;
format->content = g_binary_content_get(content, &format->length);