From 6c9e1b5f7ee0915036d47b83f1e34b87b44b1723 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 4 May 2020 08:34:38 +0200 Subject: Recognized reserved instructions as special cases. --- plugins/pychrysalide/arch/instructions/constants.c | 3 ++- plugins/pychrysalide/arch/instructions/undefined.c | 20 ++++++++++---------- src/arch/instructions/undefined.c | 4 ++++ src/arch/instructions/undefined.h | 1 + 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/plugins/pychrysalide/arch/instructions/constants.c b/plugins/pychrysalide/arch/instructions/constants.c index b5e08e1..af7baa9 100644 --- a/plugins/pychrysalide/arch/instructions/constants.c +++ b/plugins/pychrysalide/arch/instructions/constants.c @@ -96,6 +96,7 @@ bool define_undefined_instruction_constants(PyTypeObject *type) result = add_const_to_group(values, "NOP", IEB_NOP); if (result) result = add_const_to_group(values, "UNDEFINED", IEB_UNDEFINED); if (result) result = add_const_to_group(values, "UNPREDICTABLE", IEB_UNPREDICTABLE); + if (result) result = add_const_to_group(values, "RESERVED", IEB_RESERVED); if (!result) { @@ -103,7 +104,7 @@ bool define_undefined_instruction_constants(PyTypeObject *type) goto exit; } - result = attach_constants_group_to_type(type, false, "InstrExpectedBehavior", values, + result = attach_constants_group_to_type(type, false, "ExpectedBehavior", values, "List of possible behaviors of undefined instructions."); exit: diff --git a/plugins/pychrysalide/arch/instructions/undefined.c b/plugins/pychrysalide/arch/instructions/undefined.c index ee7dc51..66ae4b6 100644 --- a/plugins/pychrysalide/arch/instructions/undefined.c +++ b/plugins/pychrysalide/arch/instructions/undefined.c @@ -145,7 +145,7 @@ static int py_undef_instruction_init(PyObject *self, PyObject *args, PyObject *k " UndefInstruction(behavior)" \ "\n" \ "Where behavior is a" \ - " pychrysalide.arch.instructions.UndefInstruction.InstrExpectedBehavior" \ + " pychrysalide.arch.instructions.UndefInstruction.ExpectedBehavior" \ " constant describing the state of the CPU once the instruction is run." /* Récupération des paramètres */ @@ -197,21 +197,21 @@ static PyObject *py_undef_instruction_get_behavior(PyObject *self, void *closure GUndefInstruction *instr; /* Version native */ InstrExpectedBehavior behavior; /* Comportement attendu */ -#define UNDEF_INSTRUCTION_BEHAVIOR_ATTRIB PYTHON_GET_DEF_FULL \ -( \ - behavior, py_undef_instruction, \ - "Consequence carried by the undefined instruction.\n" \ - "\n" \ - "The result is provided as a" \ - " pychrysalide.arch.instructions.UndefInstruction.InstrExpectedBehavior" \ - " constant." \ +#define UNDEF_INSTRUCTION_BEHAVIOR_ATTRIB PYTHON_GET_DEF_FULL \ +( \ + behavior, py_undef_instruction, \ + "Consequence carried by the undefined instruction.\n" \ + "\n" \ + "The result is provided as a" \ + " pychrysalide.arch.instructions.UndefInstruction.ExpectedBehavior" \ + " constant." \ ) instr = G_UNDEF_INSTRUCTION(pygobject_get(self)); behavior = g_undef_instruction_get_behavior(instr); result = cast_with_constants_group_from_type(get_python_undefined_instruction_type(), - "InstrExpectedBehavior", behavior); + "ExpectedBehavior", behavior); return result; diff --git a/src/arch/instructions/undefined.c b/src/arch/instructions/undefined.c index da2f73e..6d90a1c 100644 --- a/src/arch/instructions/undefined.c +++ b/src/arch/instructions/undefined.c @@ -258,6 +258,10 @@ const char *g_undef_instruction_get_keyword(const GUndefInstruction *instr) result = "unpredictable"; break; + case IEB_RESERVED: + result = "reserved"; + break; + default: assert(false); result = NULL; diff --git a/src/arch/instructions/undefined.h b/src/arch/instructions/undefined.h index 5aa9bec..8f35f35 100644 --- a/src/arch/instructions/undefined.h +++ b/src/arch/instructions/undefined.h @@ -54,6 +54,7 @@ typedef enum _InstrExpectedBehavior IEB_NOP, IEB_UNDEFINED, IEB_UNPREDICTABLE, + IEB_RESERVED, } InstrExpectedBehavior; -- cgit v0.11.2-87-g4458