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

Go to the source code of this file.

Functions

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

Variables

RzAsmPlugin rz_asm_plugin_msp430
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ disassemble()

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

Definition at line 12 of file asm_msp430.c.

12  {
13  struct msp430_cmd cmd;
14  int ret = msp430_decode_command(buf, len, &cmd);
15  if (ret > 0) {
16  if (cmd.operands[0]) {
17  rz_strbuf_set(&op->buf_asm, sdb_fmt("%s %s", cmd.instr, cmd.operands));
18  } else {
19  rz_strbuf_set(&op->buf_asm, sdb_fmt("%s", cmd.instr));
20  }
21  }
22  if (a->syntax != RZ_ASM_SYNTAX_ATT) {
23  char *ba = (char *)rz_strbuf_get(&op->buf_asm);
24  rz_str_replace_ch(ba, '#', 0, 1);
25  // rz_str_replace_ch (ba, "$", "$$", 1);
26  rz_str_replace_ch(ba, '&', 0, 1);
27  rz_str_replace_ch(ba, '%', 0, 1);
28  }
29 
30  return op->size = ret;
31 }
size_t len
Definition: 6502dis.c:15
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
Definition: sflib.h:79
RZ_API char * sdb_fmt(const char *fmt,...)
Definition: fmt.c:26
voidpf void * buf
Definition: ioapi.h:138
int msp430_decode_command(const ut8 *in, int len, struct msp430_cmd *cmd)
Definition: msp430_disas.c:441
@ RZ_ASM_SYNTAX_ATT
Definition: rz_asm.h:51
RZ_API int rz_str_replace_ch(char *s, char a, char b, bool g)
Definition: str.c:139
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
Definition: strbuf.c:153
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
Definition: strbuf.c:321
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32

References a, cmd, len, msp430_decode_command(), RZ_ASM_SYNTAX_ATT, rz_str_replace_ch(), rz_strbuf_get(), rz_strbuf_set(), and sdb_fmt().

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_msp430
Definition: asm_msp430.c:33
@ 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 44 of file asm_msp430.c.

◆ rz_asm_plugin_msp430

RzAsmPlugin rz_asm_plugin_msp430
Initial value:
= {
.name = "msp430",
.license = "LGPL3",
.desc = "msp430 disassembly plugin",
.arch = "msp430",
.bits = 16,
.disassemble = &disassemble,
}
static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_msp430.c:12
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526

Definition at line 33 of file asm_msp430.c.