Rizin
unix-like reverse engineering framework and cli tools
asm_malbolge.c File Reference
#include <rz_asm.h>
#include <rz_types.h>
#include <rz_lib.h>
#include <string.h>

Go to the source code of this file.

Functions

static const char * mal_dis (ut64 c, const ut8 *buf, ut64 len)
 
static int __disassemble (RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
 

Variables

RzAsmPlugin rz_asm_plugin_malbolge
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ __disassemble()

static int __disassemble ( RzAsm a,
RzAsmOp op,
const ut8 buf,
int  len 
)
static

Definition at line 26 of file asm_malbolge.c.

26  {
27  const char *opstr = mal_dis(a->pc, buf, len);
28  return op->size = opstr ? 1 : 0;
29 }
size_t len
Definition: 6502dis.c:15
static const char * mal_dis(ut64 c, const ut8 *buf, ut64 len)
Definition: asm_malbolge.c:10
static int opstr(RzAsm *a, ut8 *data, const Opcode *op)
Definition: asm_x86_nz.c:4054
voidpf void * buf
Definition: ioapi.h:138
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32

References a, len, mal_dis(), and opstr().

◆ mal_dis()

static const char* mal_dis ( ut64  c,
const ut8 buf,
ut64  len 
)
static

Definition at line 10 of file asm_malbolge.c.

10  {
11  if (len) {
12  switch ((buf[0] + c) % 94) {
13  case 4: return "jmp [d]";
14  case 5: return "out a";
15  case 23: return "in a";
16  case 39: return "rotr [d], mov a, [d]";
17  case 40: return "mov d, [d]";
18  case 62: return "crz [d], a, mov a, [d]";
19  case 81: return "end";
20  default: return "nop";
21  }
22  }
23  return NULL;
24 }
#define NULL
Definition: cris-opc.c:27
#define c(i)
Definition: sha256.c:43

References c, len, and NULL.

Referenced by __disassemble().

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_malbolge
Definition: asm_malbolge.c:31
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define RZ_VERSION
Definition: rz_version.h:8
const char * version
Definition: rz_asm.h:133

Definition at line 43 of file asm_malbolge.c.

◆ rz_asm_plugin_malbolge

RzAsmPlugin rz_asm_plugin_malbolge
Initial value:
= {
.name = "malbolge",
.desc = "Malbolge Ternary VM",
.arch = "malbolge",
.author = "condret",
.license = "LGPL3",
.bits = 32,
.endian = RZ_SYS_ENDIAN_NONE,
.disassemble = &__disassemble
}
static int __disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_malbolge.c:26
#define RZ_SYS_ENDIAN_NONE
Definition: rz_types.h:525

Definition at line 31 of file asm_malbolge.c.