Rizin
unix-like reverse engineering framework and cli tools
io_private.h File Reference

Go to the source code of this file.

Functions

RzIOMapio_map_new (RzIO *io, int fd, int perm, ut64 delta, ut64 addr, ut64 size)
 
RzIOMapio_map_add (RzIO *io, int fd, int flags, ut64 delta, ut64 addr, ut64 size, bool do_skyline)
 
void io_map_calculate_skyline (RzIO *io)
 

Function Documentation

◆ io_map_add()

RzIOMap* io_map_add ( RzIO io,
int  fd,
int  flags,
ut64  delta,
ut64  addr,
ut64  size,
bool  do_skyline 
)

◆ io_map_calculate_skyline()

void io_map_calculate_skyline ( RzIO io)

Definition at line 14 of file io_map.c.

14  {
16  // Last map has highest priority (it shadows previous maps)
17  void **it;
18  rz_pvector_foreach (&io->maps, it) {
19  RzIOMap *map = (RzIOMap *)*it;
20  rz_skyline_add(&io->map_skyline, map->itv, map);
21  }
22 }
size_t map(int syms, int left, int len)
Definition: enough.c:237
static void rz_skyline_clear(RzSkyline *skyline)
Definition: rz_skyline.h:29
RZ_API bool rz_skyline_add(RzSkyline *skyline, RzInterval itv, void *user)
Definition: skyline.c:12
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
RzPVector maps
Definition: rz_io.h:73
RzSkyline map_skyline
Definition: rz_io.h:74

References map(), rz_io_t::map_skyline, rz_io_t::maps, rz_pvector_foreach, rz_skyline_add(), and rz_skyline_clear().

Referenced by rz_io_map_cleanup(), rz_io_map_del(), rz_io_map_del_for_fd(), rz_io_map_depriorize(), rz_io_map_priorize_for_fd(), rz_io_map_remap(), rz_io_map_reset(), rz_io_map_resize(), and rz_io_update().

◆ io_map_new()

RzIOMap* io_map_new ( RzIO io,
int  fd,
int  perm,
ut64  delta,
ut64  addr,
ut64  size 
)

XXX: this is leaking a map!!!

Definition at line 24 of file io_map.c.

24  {
25  if (!io || !io->map_ids) {
26  return NULL;
27  }
29  if (!map || !io->map_ids || !rz_id_pool_grab_id(io->map_ids, &map->id)) {
30  free(map);
31  return NULL;
32  }
33  map->fd = fd;
34  map->delta = delta;
35  if (size && (UT64_MAX - size + 1) < addr) {
37  io_map_new(io, fd, perm, delta - addr, 0LL, size + addr);
38  size = -(st64)addr;
39  }
40  // RzIOMap describes an interval of addresses (map->from; map->to)
41  map->itv = (RzInterval){ addr, size };
42  map->perm = perm;
43  map->delta = delta;
44  // new map lives on the top, being top the list's tail
45  rz_pvector_push(&io->maps, map);
46  rz_skyline_add(&io->map_skyline, map->itv, map);
47  return map;
48 }
#define NULL
Definition: cris-opc.c:27
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RzIOMap * io_map_new(RzIO *io, int fd, int perm, ut64 delta, ut64 addr, ut64 size)
Definition: io_map.c:24
voidpf void uLong size
Definition: ioapi.h:138
RZ_API bool rz_id_pool_grab_id(RzIDPool *pool, ut32 *grabber)
Definition: idpool.c:34
struct rz_interval_t RzInterval
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define st64
Definition: rz_types_base.h:10
#define UT64_MAX
Definition: rz_types_base.h:86
static void ** rz_pvector_push(RzPVector *vec, void *x)
Definition: rz_vector.h:300
RzIDPool * map_ids
Definition: rz_io.h:72
static st64 delta
Definition: vmenus.c:2425
static const z80_opcode fd[]
Definition: z80_tab.h:997
static int addr
Definition: z80asm.c:58

References addr, delta, fd, free(), map(), rz_io_t::map_ids, rz_io_t::map_skyline, rz_io_t::maps, NULL, rz_id_pool_grab_id(), RZ_NEW0, rz_pvector_push(), rz_skyline_add(), st64, and UT64_MAX.

Referenced by io_map_add(), rz_io_map_new(), and rz_io_open_at().