Rizin
unix-like reverse engineering framework and cli tools
asm-arm.h File Reference
#include <rz_types_base.h>

Go to the source code of this file.

Functions

int armass_assemble (const char *str, ut64 off, int thumb)
 

Function Documentation

◆ armass_assemble()

int armass_assemble ( const char *  str,
ut64  off,
int  thumb 
)

Definition at line 6209 of file armass.c.

6209  {
6210  int i, j;
6211  char buf[128];
6212  ArmOpcode aop = { .off = off };
6213  for (i = j = 0; i < sizeof(buf) - 1 && str[j]; i++, j++) {
6214  if (str[j] == '#') {
6215  i--;
6216  continue;
6217  }
6218  buf[i] = tolower((const ut8)str[j]);
6219  }
6220  buf[i] = 0;
6221  arm_opcode_parse(&aop, buf);
6222  aop.off = off;
6223  if (thumb < 0 || thumb > 1) {
6224  return -1;
6225  }
6226  if (assemble[thumb](&aop, off, buf) <= 0) {
6227  // RZ_LOG_ERROR("armass: Unknown opcode (%s)\n", buf);
6228  return -1;
6229  }
6230  return aop.o;
6231 }
lzma_index ** i
Definition: index.h:629
static AssembleFunction assemble[2]
Definition: armass.c:6207
static void arm_opcode_parse(ArmOpcode *ao, const char *str)
Definition: armass.c:1099
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
int off
Definition: pal.c:13
#define tolower(c)
Definition: safe-ctype.h:149
ut64 off
Definition: armass.c:14
ut32 o
the assembled instruction
Definition: armass.c:15

References arm_opcode_parse(), assemble, i, ArmOpcode::o, ArmOpcode::off, off, cmd_descs_generate::str, and tolower.

Referenced by assemble().