summaryrefslogtreecommitdiff
path: root/plugins/govm/instruction.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-11-18 22:56:59 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-11-18 22:56:59 (GMT)
commit26d75963fba34d8e5a5b9a6186604110552f3a38 (patch)
tree96c227003d0a1c8f71d2378d8e4477b963909708 /plugins/govm/instruction.h
parent51e5dac69a78930fb05ccd8d9cfe59b9cd51c03a (diff)
Provided a small assembler for the GoVM architecture.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@136 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/govm/instruction.h')
-rw-r--r--plugins/govm/instruction.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/plugins/govm/instruction.h b/plugins/govm/instruction.h
new file mode 100644
index 0000000..c1ef444
--- /dev/null
+++ b/plugins/govm/instruction.h
@@ -0,0 +1,97 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * instruction.h - prototypes pour la gestion des instructions de la machine virtuelle GoVM
+ *
+ * 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 _PLUGINS_GOVM_INSTRUCTION_H
+#define _PLUGINS_GOVM_INSTRUCTION_H
+
+
+#include "../../src/arch/archbase.h"
+
+
+
+/* Enumération de tous les opcodes */
+typedef enum _GoVMOpcodes
+{
+ GOP_SYSCALL, /* syscall (0x00) */
+ GOP_LI, /* li (0x01) */
+ GOP_JMP, /* jmp (0x02) */
+ GOP_JZ, /* jz (0x03) */
+ GOP_LB, /* lb (0x04) */
+ GOP_LW, /* lw (0x05) */
+ GOP_SB, /* sb (0x06) */
+ GOP_SW, /* sw (0x07) */
+ GOP_ADD, /* add (0x08) */
+ GOP_SALLOC, /* salloc (0x09) */
+ GOP_DIV, /* div (0x0a) */
+ GOP_NOR, /* nor (0x0b) */
+ GOP_POP, /* pop (0x0c) */
+ GOP_DUP, /* dup (0x0d) */
+ GOP_ROT, /* rot (0x0e) */
+ GOP_ROT3, /* rot3 (0x0f) */
+ GOP_MOV_A, /* pop (0x10) */
+ GOP_MOV_B, /* pop (0x11) */
+ GOP_MOV_C, /* pop (0x12) */
+ GOP_MOV_D, /* pop (0x13) */
+ GOP_MOV_E, /* pop (0x14) */
+ GOP_MOV_F, /* pop (0x15) */
+ GOP_A_MOV, /* push (0x16) */
+ GOP_B_MOV, /* push (0x17) */
+ GOP_C_MOV, /* push (0x18) */
+ GOP_D_MOV, /* push (0x19) */
+ GOP_E_MOV, /* push (0x1a) */
+ GOP_F_MOV, /* push (0x1b) */
+ GOP_CALL, /* call (0x1c) */
+ GOP_LWS, /* lws (0x1d) */
+ GOP_SWS, /* sws (0x1e) */
+ GOP_SUB, /* sub (0x1f) */
+ GOP_NOT, /* not (0x20) */
+ GOP_EQU, /* equ (0x21) */
+ GOP_LOE, /* loe (0x22) */
+ GOP_GOE, /* goe (0x23) */
+ GOP_LT, /* lt (0x24) */
+ GOP_GT, /* gt (0x25) */
+ GOP_AND, /* and (0x26) */
+ GOP_OR, /* or (0x27) */
+ GOP_SHL, /* shl (0x28) */
+ GOP_SHR, /* shr (0x29) */
+ GOP_MUL, /* mul (0x2a) */
+ GOP_NOP, /* nop (0x2b) */
+ GOP_XOR, /* xor (0x2c) */
+
+ GOP_COUNT
+
+} GoVMOpcodes;
+
+
+
+
+
+/* Fournit de quoi encodée une instruction donnée. */
+bin_t get_govm_instruction_opcode(GoVMOpcodes);
+
+
+
+
+
+
+#endif /* _PLUGINS_GOVM_INSTRUCTION_H */