summaryrefslogtreecommitdiff
path: root/src/arch/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-05-31 20:58:20 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-05-31 20:58:20 (GMT)
commit8724afdc73e0ddad86f46de1a3fbe0254575a76e (patch)
treede666b66e154c6c6453807d3fa4272efb6877a91 /src/arch/instruction.c
parent0b7d7f26c745ff0f52e9e483a0980351368ca824 (diff)
Supported a new architecture (MIPS).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@67 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r--src/arch/instruction.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 073f55c..21e72b7 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -134,7 +134,7 @@ void g_arch_instruction_get_location(GArchInstruction *instr, off_t *offset, off
* Paramètres : instr = instance à mettre à jour. *
* opererand = instruction à venir associer. *
* *
-* Description : Attache une seule opérande à une instruction. *
+* Description : Attache un seul opérande à un instruction. *
* *
* Retour : - *
* *
@@ -158,7 +158,7 @@ void g_arch_instruction_attach_one_operand(GArchInstruction *instr, GArchOperand
* operand1 = première instruction à venir associer. *
* operand2 = seconde instruction à venir associer. *
* *
-* Description : Attache deux opérandes à une instruction. *
+* Description : Attache deux opérandes à un instruction. *
* *
* Retour : - *
* *
@@ -179,6 +179,60 @@ void g_arch_instruction_attach_two_operands(GArchInstruction *instr, GArchOperan
/******************************************************************************
* *
+* Paramètres : instr = instance à mettre à jour. *
+* opererand = instruction à venir associer. *
+* *
+* Description : Attache un opérande supplémentaire à une instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_arch_instruction_attach_extra_operand(GArchInstruction *instr, GArchOperand *operand)
+{
+ instr->operands_count++;
+ instr->operands = (GArchOperand **)realloc(instr->operands, instr->operands_count * sizeof(GArchOperand *));
+
+ instr->operands[instr->operands_count - 1] = operand;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance à mettre à jour. *
+* opererand = instruction à venir dissocier. *
+* *
+* Description : Détache un opérande liée d'une instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *operand)
+{
+ size_t i; /* Boucle de parcours */
+
+ for (i = 0; i < instr->operands_count; i++)
+ if (instr->operands[i] == operand)
+ break;
+
+ if ((i + 1) < instr->operands_count)
+ memmove(&instr->operands[i], &instr->operands[i + 1],
+ (instr->operands_count - i - 1) * sizeof(GArchOperand *));
+
+ instr->operands_count--;
+ instr->operands = (GArchOperand **)realloc(instr->operands, instr->operands_count * sizeof(GArchOperand *));
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : instr = instruction à traiter. *
* format = format du binaire manipulé. *
* syntax = type de représentation demandée. *