57 return (*
c ==
'(' || *
c ==
')' || *
c ==
'[' || *
c ==
']' || *
c ==
'{' || *
c ==
'}' || *
c ==
',' || *
c ==
'.' || *
c ==
'#' || *
c ==
':' || *
c ==
' ' ||
58 (
c[0] ==
'|' &&
c[1] ==
'|') ||
59 (
c[0] ==
'=' &&
c[1] ==
'=') ||
60 (
c[0] ==
'<' &&
c[1] ==
'=') ||
61 (
c[0] ==
':' &&
c[1] ==
':'));
68 return (*
c ==
'+' || *
c ==
'-' || *
c ==
'/' || *
c ==
'>' || *
c ==
'<' || *
c ==
'*' || *
c ==
'%' || *
c ==
'|' || *
c ==
'&' || *
c ==
'=' || *
c ==
'!');
79 if (regset[
i].ht_regs) {
90 ".include",
".error",
".warning",
91 ".echo",
".if",
".ifeq",
".endif",
92 ".else",
".set",
".get",
NULL
139 RZ_LOG_ERROR(
"Unsupported bits (%s) value for the selected asm plugin.\n",
input);
154 if (
n != 8 && s64 >> (
n * 8)) {
155 RZ_LOG_ERROR(
"Cannot write a number that does not fit within a int%d type.\n", (
n * 8));
198 for (
i = 0;
i <
len;
i++) {
228 size_t bytes_read = 0;
257 if (
a->cur &&
a->cur->fini && !
a->cur->fini(
a->plugin_data)) {
258 RZ_LOG_ERROR(
"asm plugin '%s' failed to terminate.\n",
a->cur->name);
328 ht_pp_free(
a->flags);
355 rz_list_foreach (
a->plugins,
iter,
h) {
356 if (!strcmp(
h->name,
name)) {
368 rz_list_foreach (
a->plugins,
iter,
h) {
369 if (
h->assemble && !strcmp(
h->name,
name)) {
392 rz_list_foreach_iter(pcfg->nodes, it) {
395 RZ_LOG_WARN(
"Failed to add \"%s\" to the global config.\n",
n->name)
412 rz_list_foreach_iter(pcfg->nodes, it) {
415 RZ_LOG_WARN(
"Failed to remove \"%s\" from the global config.",
n->name)
436 if (
a->cur && !strcmp(
a->cur->arch,
name)) {
439 rz_list_foreach (
a->plugins,
iter,
h) {
440 if (
h->arch &&
h->name && !strcmp(
h->name,
name)) {
441 if (!
a->cur || (
a->cur && strcmp(
a->cur->arch,
h->arch))) {
453 if (
h->init && !
h->init(&
a->plugin_data)) {
454 RZ_LOG_ERROR(
"asm plugin '%s' failed to initialize.\n",
h->name);
458 if (
a->cur &&
a->cur->get_config && core) {
463 if (
h->get_config && core) {
485 return (
h &&
h->bits && (
bits &
h->bits));
498 a->big_endian =
false;
499 switch (
a->cur->endian) {
506 a->big_endian =
false;
509 a->big_endian =
true;
512 RZ_LOG_DEBUG(
"The asm plugin doesn't specify endianness.\n");
515 return a->big_endian;
540 return (buf_asm && *buf_asm && !strcmp(buf_asm,
"invalid"));
550 int ret =
op->payload = 0;
555 const int mod =
a->pc %
a->pcalign;
557 op->size =
a->pcalign -
mod;
562 if (
a->cur &&
a->cur->disassemble) {
564 if (
a->bitshift > 0) {
578 if (
op->bitsize > 0) {
579 op->size =
op->bitsize / 8;
580 a->bitshift +=
op->bitsize % 8;
581 int count =
a->bitshift / 8;
613 if (!
a || !
h->arch || !
h->assemble || !
has_bits(
h,
a->bits)) {
616 return (!strncmp(
a->cur->arch,
h->arch, strlen(
a->cur->arch)));
623 if (
a->acur &&
a->acur->assemble) {
624 return a->acur->assemble;
626 rz_list_foreach (
a->plugins,
iter,
h) {
629 if (strstr(
h->name, kw)) {
644 bool changes =
false;
647 p = strstr(q, token);
650 char *nl = strchr(
p,
'\n');
715 if (!
a->cur->assemble) {
725 ase =
a->cur->assemble;
751 const size_t addrbytes =
a->core ? ((
RzCore *)
a->core)->io->addrbytes : 1;
765 for (
idx = 0;
idx + addrbytes <=
len;
idx += (addrbytes * ret)) {
811 return (
void *)
strdup((
char *)
v);
815 int num, stage, ret,
idx, ctr,
i, linenum = 0;
816 char *lbuf =
NULL, *ptr2, *ptr =
NULL, *ptr_start =
NULL;
817 const char *asmcpu =
NULL;
822 char *buf_token =
NULL;
823 size_t tokens_size = 32;
824 char **tokens =
calloc(
sizeof(
char *), tokens_size);
832 ht_pp_free(
a->flags);
857 char *nl = strchr(lbuf,
'\n');
859 if (strchr(nl + 1,
'\n')) {
873 char *aa, *
p = strstr(lbuf,
"$sys.");
886 p = strstr(
p + 5,
"$sys.");
889 bool labels = !!strchr(lbuf,
':');
892 for (tokens[0] = lbuf, ctr = 0;
893 ((ptr = strchr(tokens[ctr],
';')) ||
894 (ptr = strchr(tokens[ctr],
'\n')) ||
895 (ptr = strchr(tokens[ctr],
'\r')));) {
896 if (ctr + 1 >= tokens_size) {
897 const size_t new_tokens_size = tokens_size * 2;
898 if (
sizeof(
char *) * new_tokens_size <=
sizeof(
char *) * tokens_size) {
900 RZ_LOG_ERROR(
"Too many tokens while assembling (overflow).\n");
903 char **new_tokens =
realloc(tokens,
sizeof(
char *) * new_tokens_size);
905 RZ_LOG_ERROR(
"Cannot reallocate meory for tokens while assembling.\n");
908 tokens_size = new_tokens_size;
913 tokens[ctr] = ptr + 1;
916 #define isavrseparator(x) ((x) == ' ' || (x) == '\t' || (x) == '\n' || (x) == '\r' || (x) == ' ' || \
917 (x) == ',' || (x) == ';' || (x) == '[' || (x) == ']' || \
918 (x) == '(' || (x) == ')' || (x) == '{' || (x) == '}')
925 bool inComment =
false;
926 for (stage = 0; stage <
STAGES; stage++) {
927 if (stage < 2 && !labels) {
932 for (
idx = ret =
i = 0;
i <= ctr;
i++,
idx += ret) {
933 buf_token = tokens[
i];
938 if (!strncmp(ptr_start,
"*/", 2)) {
944 if (!strncmp(
a->cur->arch,
"avr", 3)) {
945 for (ptr_start = buf_token; *ptr_start &&
isavrseparator(*ptr_start); ptr_start++)
948 for (ptr_start = buf_token; *ptr_start &&
IS_SEPARATOR(*ptr_start); ptr_start++)
951 if (!strncmp(ptr_start,
"/*", 2)) {
952 if (!strstr(ptr_start + 2,
"*/")) {
958 bool likely_comment =
true;
959 char *cptr = strchr(ptr_start,
',');
960 ptr = strchr(ptr_start,
'#');
963 if (cptr && ptr && cptr < ptr) {
964 likely_comment =
false;
965 for (cptr += 1; cptr < ptr; cptr += 1) {
967 likely_comment =
true;
974 likely_comment = likely_comment && ptr && !
RZ_BETWEEN(
'0', ptr[1],
'9') && ptr[1] !=
'-';
975 if (likely_comment) {
987 if (labels && (ptr = strchr(ptr_start,
':'))) {
988 bool is_a_label =
true;
999 if (ptr_start[1] && ptr_start[1] !=
' ') {
1007 ht_pp_insert(
a->flags, ptr_start, food);
1013 ptr_start = ptr + 1;
1020 if (*ptr_start ==
'.') {
1024 if (!strncmp(ptr,
".intel_syntax", 13)) {
1026 }
else if (!strncmp(ptr,
".att_syntax", 11)) {
1028 }
else if (!strncmp(ptr,
".endian", 7)) {
1030 }
else if (!strncmp(ptr,
".big_endian", 7 + 4)) {
1032 }
else if (!strncmp(ptr,
".lil_endian", 7 + 4) || !strncmp(ptr,
"little_endian", 7 + 6)) {
1034 }
else if (!strncmp(ptr,
".asciz", 6)) {
1037 }
else if (!strncmp(ptr,
".string ", 8)) {
1042 }
else if (!strncmp(ptr,
".ascii", 6)) {
1044 }
else if (!strncmp(ptr,
".align", 6)) {
1046 }
else if (!strncmp(ptr,
".arm", 4)) {
1050 }
else if (!strncmp(ptr,
".thumb", 6)) {
1054 }
else if (!strncmp(ptr,
".arch ", 6)) {
1056 }
else if (!strncmp(ptr,
".bits ", 6)) {
1058 }
else if (!strncmp(ptr,
".fill ", 6)) {
1060 }
else if (!strncmp(ptr,
".kernel ", 8)) {
1062 }
else if (!strncmp(ptr,
".cpu ", 5)) {
1064 }
else if (!strncmp(ptr,
".os ", 4)) {
1066 }
else if (!strncmp(ptr,
".hex ", 5)) {
1068 }
else if ((!strncmp(ptr,
".int16 ", 7)) || !strncmp(ptr,
".short ", 7)) {
1070 }
else if (!strncmp(ptr,
".int32 ", 7)) {
1072 }
else if (!strncmp(ptr,
".int64 ", 7)) {
1074 }
else if (!strncmp(ptr,
".size", 5)) {
1076 }
else if (!strncmp(ptr,
".section", 8)) {
1078 }
else if ((!strncmp(ptr,
".byte ", 6)) || (!strncmp(ptr,
".int8 ", 6))) {
1080 }
else if (!strncmp(ptr,
".glob", 5)) {
1081 RZ_LOG_DEBUG(
".global directive not yet implemented\n");
1084 }
else if (!strncmp(ptr,
".equ ", 5)) {
1085 ptr2 = strchr(ptr + 5,
',');
1087 ptr2 = strchr(ptr + 5,
'=');
1090 ptr2 = strchr(ptr + 5,
' ');
1096 RZ_LOG_ERROR(
"Invalid syntax for '.equ': Use '.equ <word> <word>'\n");
1098 }
else if (!strncmp(ptr,
".org ", 5)) {
1101 RZ_LOG_ERROR(
"Invalid use of the .offset directory. This directive is only supported in rizin -c 'waf'.\n");
1102 }
else if (!strncmp(ptr,
".text", 5)) {
1104 }
else if (!strncmp(ptr,
".data", 5)) {
1106 }
else if (!strncmp(ptr,
".incbin", 7)) {
1107 if (ptr[7] !=
' ') {
1108 RZ_LOG_ERROR(
"Invalid syntax for '.incbin': Use '.incbin <filename>'\n");
1120 RZ_LOG_ERROR(
"Something went wrong when handling the directive '%s'.\n", ptr);
1124 char *
str = ptr_start;
1144 if (stage ==
STAGES - 1) {
1146 RZ_LOG_ERROR(
"Cannot assemble '%s' at line %d\n", ptr_start, linenum);
1181 if (
a &&
a->binb.bin &&
a->binb.get_offset) {
1182 return a->binb.get_offset(
a->binb.bin,
type,
idx);
1205 char *buf_asm =
code->assembly;
1229 if (!strcmp(
name,
"regnum")) {
1232 if (!strcmp(
name,
"jz")) {
1235 if (!strcmp(
name,
"intel")) {
1238 if (!strcmp(
name,
"masm")) {
1241 if (!strcmp(
name,
"att")) {
1249 if (
a->cur->mnemonics) {
1250 return a->cur->mnemonics(
a,
id, json);
1257 if (
a->cur->mnemonics) {
1259 for (
i = 0;
i < 1024;
i++) {
1260 char *
n =
a->cur->mnemonics(
a,
i,
false);
1261 if (
n && !strcmp(
n,
name)) {
1324 newt->
op_type = toks->op_type;
1385 RZ_LOG_WARN(
"Failed to create token. Asm strings will be flawed.\n");
1409 if (!(
s > y ||
e <
x)) {
1418 if (
a->start <
b->start) {
1420 }
else if (
a->start >
b->start) {
1436 ut32 ci, cj, pi, pj;
1445 pi = prev ? prev->
start : 0;
1446 pj = prev ? prev->
start + prev->
len : 0;
1633 bool mnemonic_parsed =
false;
1639 bool prefix_less_hex =
false;
1669 }
else if (mnemonic_parsed) {
1672 if (param &&
is_register(op_name, param->reg_sets)) {
1674 }
else if (prefix_less_hex) {
1683 mnemonic_parsed =
true;
1685 if (*(
str +
i + l) !=
' ') {
1748 ts->
op_type = param ? param->ana_op_type : 0;
RZ_API void * rz_asm_code_free(RzAsmCode *acode)
RZ_API bool rz_asm_code_set_equ(RzAsmCode *code, const char *key, const char *value)
RZ_API RzAsmCode * rz_asm_code_new(void)
RZ_API char * rz_asm_code_equ_replace(RzAsmCode *code, char *str)
RZ_API void rz_asm_op_fini(RzAsmOp *op)
RZ_API void rz_asm_op_set_buf(RzAsmOp *op, const ut8 *buf, int len)
RZ_API void rz_asm_op_init(RzAsmOp *op)
RZ_API int rz_asm_op_set_hex(RzAsmOp *op, const char *str)
RZ_API void rz_asm_op_set_asm(RzAsmOp *op, const char *str)
static bool overlaps_with_token(RZ_BORROW RzVector *toks, const size_t s, const size_t e)
Checks if indicies s, e overlap with other tokens start/end.
static RZ_OWN RzAsmToken * asm_token_create(const size_t start, const size_t len, const RzAsmTokenType type, const ut64 val)
Creates a token and returns it.
static char * directives[]
RZ_API int rz_asm_mnemonics_byname(RzAsm *a, const char *name)
static int rz_asm_pseudo_byte(RzAsmOp *op, char *input)
RZ_API char * rz_asm_to_string(RzAsm *a, ut64 addr, const ut8 *b, int l)
RZ_API RzAsmCode * rz_asm_mdisassemble(RzAsm *a, const ut8 *buf, int len)
RZ_API RZ_OWN RzAsmTokenString * rz_asm_tokenize_asm_regex(RZ_BORROW RzStrBuf *asm_str, RzPVector *patterns)
Splits an asm string into tokens by using the given regex patterns.
static bool is_separator(const char *c)
static bool is_num(const char *c)
Checks if the first character of c is a digit character OR if the first two chars are a hex prefix.
RZ_API bool rz_asm_add(RzAsm *a, RzAsmPlugin *p)
RZ_API void rz_asm_list_directives(void)
static bool is_alpha_num(const char *c)
Checks if the first character of c is an alphanumeric character OR if it is a hex prefix.
static int rz_asm_pseudo_bits(RzAsm *a, char *input)
static char * replace_directives(char *str)
RZ_API void rz_asm_free(RzAsm *a)
static int rz_asm_pseudo_string(RzAsmOp *op, char *input, int zero)
static bool has_bits(RzAsmPlugin *h, int bits)
RZ_API int rz_asm_syntax_from_string(const char *name)
static int rz_asm_pseudo_arch(RzAsm *a, char *input)
RZ_API bool rz_asm_set_big_endian(RzAsm *a, bool b)
RZ_API bool rz_asm_is_valid(RzAsm *a, const char *name)
static void set_plugin_configs(RZ_BORROW RzAsm *rz_asm, RZ_BORROW RzConfig *pcfg)
Copies all config nodes in pcfg to the config in rz_asm.
RZ_API RzAsm * rz_asm_new(void)
RZ_API void rz_asm_token_pattern_free(void *p)
static RzAsmPlugin * asm_static_plugins[]
static void * __dup_val(const void *v)
static void __flag_free_kv(HtPPKv *kv)
RZ_DEPRECATE RZ_API int rz_asm_set_bits(RzAsm *a, int bits)
RZ_API RZ_OWN RzAsmParseParam * rz_asm_get_parse_param(RZ_NULLABLE const RzReg *reg, ut32 ana_op_type)
Does all kinds of NULL checks on the parameters and returns an initialized RzAsmParseParam or NULL on...
RZ_API bool rz_asm_setup(RzAsm *a, const char *arch, int bits, int big_endian)
static void check_token_coverage(RzAsmTokenString *toks)
#define isavrseparator(x)
RZ_API char * rz_asm_describe(RzAsm *a, const char *str)
static void unset_plugins_config(RZ_BORROW RzAsm *rz_asm, RZ_BORROW RzConfig *pcfg)
Deletes all copies of pcfg nodes in the RzConfig from rz_asm.
static void plugin_fini(RzAsm *a)
static size_t seek_to_end_of_token(const char *str, size_t i, RzAsmTokenType type)
Seeks to the end of the token at str + i and returns the length of it.
RZ_API int rz_asm_assemble(RzAsm *a, RzAsmOp *op, const char *buf)
RZ_API RzAsmCode * rz_asm_rasm_assemble(RzAsm *a, const char *buf, bool use_spp)
int(* Ase)(RzAsm *a, RzAsmOp *op, const char *buf)
static Ase findAssembler(RzAsm *a, const char *kw)
RZ_API bool rz_asm_set_syntax(RzAsm *a, int syntax)
RZ_DEPRECATE RZ_API RZ_OWN RzStrBuf * rz_asm_colorize_asm_str(RZ_BORROW RzStrBuf *asm_str, RZ_BORROW RzPrint *p, RZ_NULLABLE const RzAsmParseParam *param, RZ_NULLABLE const RzAsmTokenString *toks)
Colors a given asm string and returns it. If toks is not NULL it uses the tokens to color the asm str...
RZ_API char * rz_asm_mnemonics(RzAsm *a, int id, bool json)
RZ_DEPRECATE RZ_API void rz_asm_set_cpu(RzAsm *a, const char *cpu)
static int cmp_tokens(const RzAsmToken *a, const RzAsmToken *b)
RZ_API int rz_asm_set_pc(RzAsm *a, ut64 pc)
RZ_API RZ_OWN RzAsmTokenString * rz_asm_token_string_new(const char *asm_str)
RZ_API RzAsmCode * rz_asm_massemble(RzAsm *a, const char *assembly)
RZ_API bool rz_asm_use(RzAsm *a, const char *name)
Puts an Asm plugin in use and disables the previous one.
static void parseHeap(RzParse *p, RzStrBuf *s)
static bool assemblerMatches(RzAsm *a, RzAsmPlugin *h)
static void add_token(RZ_OUT RzAsmTokenString *toks, const size_t i, const size_t l, const RzAsmTokenType type, const ut64 token_val)
Creates a token and adds it to the token string vector toks.
static int rz_asm_pseudo_intN(RzAsm *a, RzAsmOp *op, char *input, int n)
RZ_API bool rz_asm_set_arch(RzAsm *a, const char *name, int bits)
RZ_API RzAsmCode * rz_asm_mdisassemble_hexstr(RzAsm *a, RzParse *p, const char *hexstr)
static int rz_asm_pseudo_int64(RzAsm *a, RzAsmOp *op, char *input)
RZ_API int rz_asm_sub_names_input(RzAsm *a, const char *f)
static int rz_asm_pseudo_int16(RzAsm *a, RzAsmOp *op, char *input)
static int rz_asm_pseudo_fill(RzAsmOp *op, char *input)
RZ_API RzList * rz_asm_get_plugins(RzAsm *a)
static bool is_operator(const char *c)
RZ_DEPRECATE RZ_API RZ_OWN RzAsmTokenString * rz_asm_tokenize_asm_string(RZ_BORROW RzStrBuf *asm_str, RZ_NULLABLE const RzAsmParseParam *param)
Parses an asm string generically. It parses the string like: <mnemmonic> <op>, <op>....
RZ_API int rz_asm_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
RZ_API int rz_asm_del(RzAsm *a, const char *name)
static char * replace_directives_for(char *str, char *token)
static int rz_asm_pseudo_incbin(RzAsmOp *op, char *input)
RZ_API RZ_OWN RzAsmTokenString * rz_asm_token_string_clone(RZ_OWN RZ_NONNULL RzAsmTokenString *toks)
static bool is_register(const char *name, RZ_BORROW const RzRegSet *regset)
static bool __isInvalid(RzAsmOp *op)
RZ_API bool rz_asm_use_assembler(RzAsm *a, const char *name)
RZ_API int rz_asm_sub_names_output(RzAsm *a, const char *f)
RZ_API ut8 * rz_asm_from_string(RzAsm *a, ut64 addr, const char *b, int *l)
static int rz_asm_pseudo_align(RzAsmCode *acode, RzAsmOp *op, char *input)
RZ_API void rz_asm_token_string_free(RZ_OWN RzAsmTokenString *toks)
static RZ_OWN RzAsmTokenString * tokenize_asm_generic(RZ_BORROW RzStrBuf *asm_str, RZ_NULLABLE const RzAsmParseParam *param)
Parses an asm string into tokens.
static int rz_asm_pseudo_org(RzAsm *a, char *input)
static int rz_asm_pseudo_int32(RzAsm *a, RzAsmOp *op, char *input)
RZ_API int rz_asm_get_offset(RzAsm *a, int type, int idx)
int bits(struct state *s, int need)
const lzma_allocator const uint8_t size_t uint8_t * out
#define RZ_ASM_STATIC_PLUGINS
RZ_API bool rz_config_rm(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API bool rz_config_add_node(RZ_BORROW RzConfig *cfg, RZ_OWN RzConfigNode *node)
Appends the given node to the config cfg.
RZ_API void rz_config_lock(RzConfig *cfg, int l)
RZ_API RZ_OWN RzConfigNode * rz_config_node_clone(RzConfigNode *n)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
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 static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
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 static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
static int is_number(const ut8 *buf, int size)
RZ_API char * sdb_fmt(const char *fmt,...)
void skip(file *in, unsigned n)
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API const KEY_TYPE bool * found
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API void rz_parse_free(RzParse *p)
RZ_API char * rz_parse_pseudocode(RzParse *p, const char *assembly)
Converts the assembly line into pseudocode.
RZ_API RzParse * rz_parse_new(void)
RZ_API bool rz_parse_use(RzParse *p, const char *name)
RZ_API RZ_OWN RzStrBuf * rz_print_colorize_asm_str(RZ_BORROW RzPrint *p, const RzAsmTokenString *toks)
Colorizes a tokenized asm string.
static void repeat(struct parse *, sopno, int, int)
#define rz_warn_if_reached()
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
RZ_API RZ_OWN RzBuffer * rz_buf_new_with_string(RZ_NONNULL const char *msg)
Creates a new buffer from a string.
RZ_API void rz_buf_free(RzBuffer *b)
Free all internal data hold by the buffer and the buffer.
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
RZ_API RZ_OWN char * rz_buf_to_string(RZ_NONNULL RzBuffer *b)
Stringify the buffer.
static ut16 rz_read_le16(const void *src)
static ut32 rz_read_le32(const void *src)
static void rz_write_ble32(void *dest, ut32 val, bool big_endian)
static void rz_write_ble64(void *dest, ut64 val, bool big_endian)
static void rz_write_ble16(void *dest, ut16 val, bool big_endian)
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
#define RZ_LOG_WARN(fmtstr,...)
#define RZ_LOG_DEBUG(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API void rz_mem_copybits_delta(ut8 *dst, int doff, const ut8 *src, int soff, int bits)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API bool rz_num_is_hex_prefix(const char *p)
Checks if the first two chars of p equal "0x".
RZ_API RZ_OWN char * rz_path_system(RZ_NULLABLE const char *path)
Return the full system path of the given subpath path.
RZ_API int rz_regex_exec(const RzRegex *preg, const char *string, size_t nmatch, RzRegexMatch __pmatch[], int eflags)
RZ_API void rz_regex_free(RzRegex *)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
RZ_API int rz_str_word_count(const char *string)
RZ_API void rz_str_case(char *str, bool up)
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t n)
Secure string copy with null terminator.
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
RZ_API int rz_str_word_set0(char *str)
RZ_API void rz_str_trim(RZ_NONNULL RZ_INOUT char *str)
Removes whitespace characters (space, tab, newline etc.) from the beginning and end of a string.
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
RZ_API int rz_str_replace_char(char *s, int a, int b)
RZ_API int rz_str_unescape(char *buf)
RZ_API const char * rz_str_word_get0(const char *str, int idx)
RZ_API const char * rz_str_closer_chr(const char *b, const char *s)
RZ_API RZ_OWN char * rz_strbuf_drain(RzStrBuf *sb)
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API void rz_strbuf_free(RzStrBuf *sb)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API void rz_strbuf_init(RzStrBuf *sb)
RZ_API bool rz_strbuf_is_empty(RzStrBuf *sb)
RZ_API int rz_strbuf_length(RzStrBuf *sb)
#define RZ_SYS_ENDIAN_BIG
#define RZ_SYS_ENDIAN_LITTLE
#define RZ_SYS_ENDIAN_NONE
#define RZ_BETWEEN(x, y, z)
RZ_API void * rz_vector_push(RzVector *vec, void *x)
#define rz_vector_foreach(vec, it)
RZ_API void rz_vector_free(RzVector *vec)
RZ_API RzVector * rz_vector_clone(RzVector *vec)
RZ_API RzVector * rz_vector_new(size_t elem_size, RzVectorFree free, void *free_user)
static size_t rz_vector_len(const RzVector *vec)
int(* RzVectorComparator)(const void *a, const void *b)
RZ_API void rz_vector_sort(RzVector *vec, RzVectorComparator cmp, bool reverse)
Sort function for RzVector.
#define rz_pvector_foreach(vec, it)
RZ_API Sdb * sdb_new(const char *path, const char *name, int lock)
RZ_API char * sdb_get(Sdb *s, const char *key, ut32 *cas)
RZ_API bool sdb_free(Sdb *s)
S_API void spp_eval(char *buf, Output *out)
S_API void spp_proc_set(SppProc *p, const char *arg, int fail)
ut32 ana_op_type
Analysis op type (see: _RzAnalysisOpType) of the token string to parse.
const RzRegSet * reg_sets
Array of reg sets used to lookup register names during parsing.
Pattern for a asm string token.
ut32 op_type
RzAnalysisOpType. Mnemonic color depends on this.
A token of an asm string holding meta data.
union RzAsmToken::@310 val
RZ_API void rz_syscall_free(RzSyscall *s)
Frees an RzSyscall type.
RZ_API int rz_syscall_get_num(RzSyscall *s, const char *str)
RZ_API bool rz_syscall_setup(RzSyscall *s, const char *arch, int bits, const char *cpu, const char *os)
void error(const char *msg)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)