static int rabin_delegate(RThread *th) { if (rabin_cmd && r_file_exists (r.file->desc->name)) { char *nptr, *ptr, *cmd = r_sys_cmd_str (rabin_cmd, NULL, NULL); ptr = cmd; if (ptr) { do { if (th) { r_th_lock_enter (th->user); } nptr = strchr (ptr, '\n'); if (nptr) { *nptr = 0; } r_core_cmd (&r, ptr, 0); if (nptr) { ptr = nptr + 1; } if (th) { r_th_lock_leave (th->user); } } while (nptr); } //r_core_cmd (&r, cmd, 0); r_str_free (rabin_cmd); rabin_cmd = NULL; } if (th) eprintf ("rabin2: done\n"); return 0; }
static void map_cpu_memory (RAnal *anal, int entry, ut32 addr, ut32 size, bool force) { RIODesc *desc = mem_map[entry].desc; if (desc && anal->iob.fd_get_name (anal->iob.io, desc->fd)) { if (force || addr != mem_map[entry].addr) { // reallocate mapped memory if address changed anal->iob.fd_remap (anal->iob.io, desc->fd, addr); } } else { // allocate memory for address space char *mstr = r_str_newf ("malloc://%d", size); desc = anal->iob.open_at (anal->iob.io, mstr, R_IO_READ | R_IO_WRITE, 0, addr); r_str_free (mstr); // set 8051 address space as name of mapped memory if (desc && anal->iob.fd_get_name (anal->iob.io, desc->fd)) { RList *maps = anal->iob.fd_get_map (anal->iob.io, desc->fd); RIOMap *current_map; RListIter *iter; r_list_foreach (maps, iter, current_map) { char *cmdstr = r_str_newf ("omni %d %s", current_map->id, mem_map[entry].name); anal->coreb.cmd (anal->coreb.core, cmdstr); r_str_free (cmdstr); } r_list_free (maps); }