Rizin
unix-like reverse engineering framework and cli tools
asm_xap.c File Reference
#include <stdio.h>
#include <rz_types.h>
#include <rz_lib.h>
#include <rz_util.h>
#include <rz_asm.h>
#include "xap/dis.c"

Go to the source code of this file.

Functions

static int arch_xap_disasm (char *str, const unsigned char *buf, ut64 seek)
 
static int disassemble (RzAsm *a, struct rz_asm_op_t *op, const ut8 *buf, int len)
 

Variables

RzAsmPlugin rz_asm_plugin_xap
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ arch_xap_disasm()

static int arch_xap_disasm ( char *  str,
const unsigned char *  buf,
ut64  seek 
)
static

Definition at line 11 of file asm_xap.c.

11  {
12  struct state *s = get_state();
13  struct directive *d;
14  memset(s, 0, sizeof(*s));
15  s->s_buf = buf;
16  s->s_off = seek;
17  s->s_out = NULL;
18  d = next_inst(s);
19  if (d != NULL) {
20  xap_decode(s, d);
21  strcpy(str, d->d_asm);
22  free(d);
23  } else {
24  *str = '\0';
25  }
26 #if 0
27  if (s->s_ff_quirk) {
28  sprintf(d->d_asm, "DC\t0x%x", i2u16(&d->d_inst));
29  s->s_ff_quirk = 0;
30  }
31 #endif
32  return 0;
33 }
#define NULL
Definition: cris-opc.c:27
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void * buf
Definition: ioapi.h:138
sprintf
Definition: kernel.h:365
return memset(p, 0, total)
static RzSocket * s
Definition: rtr.c:28
#define d(i)
Definition: sha256.c:44
Definition: dis.h:26
Definition: dis.h:43
static void xap_decode(struct state *s, struct directive *d)
Definition: dis.c:448
static struct directive * next_inst(struct state *s)
Definition: dis.c:463
static struct state * get_state(void)
Definition: dis.c:18
static uint16_t i2u16(struct instruction *in)
Definition: dis.c:23
static int seek(char *argv[])

References d, free(), get_state(), i2u16(), memset(), next_inst(), NULL, s, seek(), sprintf, cmd_descs_generate::str, and xap_decode().

Referenced by disassemble().

◆ disassemble()

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

Definition at line 34 of file asm_xap.c.

34  {
35  char *buf_asm = rz_strbuf_get(&op->buf_asm);
36  arch_xap_disasm(buf_asm, buf, a->pc);
37  return (op->size = 2);
38 }
static int arch_xap_disasm(char *str, const unsigned char *buf, ut64 seek)
Definition: asm_xap.c:11
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, arch_xap_disasm(), and rz_strbuf_get().

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_xap
Definition: asm_xap.c:40
@ 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 51 of file asm_xap.c.

◆ rz_asm_plugin_xap

RzAsmPlugin rz_asm_plugin_xap
Initial value:
= {
.name = "xap",
.arch = "xap",
.license = "PD",
.bits = 16,
.desc = "XAP4 RISC (CSR)",
.disassemble = &disassemble
}
static int disassemble(RzAsm *a, struct rz_asm_op_t *op, const ut8 *buf, int len)
Definition: asm_xap.c:34
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526

Definition at line 40 of file asm_xap.c.