Rizin
unix-like reverse engineering framework and cli tools
bin_vsf.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2015-2019 riq <ricardoquesada@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 /* VICE Snapshot File loader: http://vice-emu.sourceforge.net/ */
5 
6 #include <rz_bin.h>
7 #include "vsf/vsf_specs.h"
8 
9 static const char VICE_MAGIC[] = "VICE Snapshot File\032";
10 #define VICE_MAGIC_LEN sizeof(VICE_MAGIC) - 1
11 static const char VICE_MAINCPU[] = "MAINCPU";
12 static const char VICE_C64MEM[] = "C64MEM";
13 static const char VICE_C64ROM[] = "C64ROM";
14 static const char VICE_C128MEM[] = "C128MEM";
15 static const char VICE_C128ROM[] = "C128ROM";
16 
17 static const struct {
18  const char *name;
19  const char *desc;
20  const int offset_mem;
21  const int ram_size;
22 } _machines[] = {
23  { "C64", "Commodore 64", rz_offsetof(struct vsf_c64mem, ram), 64 * 1024 },
24  { "C128", "Commodore 128", rz_offsetof(struct vsf_c128mem, ram), 128 * 1024 },
25 };
26 static const int MACHINES_MAX = sizeof(_machines) / sizeof(_machines[0]);
27 
28 static Sdb *get_sdb(RzBinFile *bf) {
29  rz_return_val_if_fail(bf && bf->o && bf->o->bin_obj, NULL);
30  struct rz_bin_vsf_obj *bin = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
31  return bin->kv;
32 }
33 
34 static bool check_buffer(RzBuffer *b) {
35  ut8 magic[VICE_MAGIC_LEN];
36  if (rz_buf_read_at(b, 0, magic, VICE_MAGIC_LEN) == VICE_MAGIC_LEN) {
37  return !memcmp(magic, VICE_MAGIC, VICE_MAGIC_LEN);
38  }
39  return false;
40 }
41 
42 // XXX b vs bf->buf
43 static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *b, Sdb *sdb) {
44  ut64 offset = 0;
45  struct rz_bin_vsf_obj *res = NULL;
46  if (check_buffer(bf->buf)) {
47  int i = 0;
48  if (!(res = RZ_NEW0(struct rz_bin_vsf_obj))) {
49  return false;
50  }
51  offset = rz_offsetof(struct vsf_hdr, machine);
52  if (offset > bf->size) {
53  free(res);
54  return false;
55  }
56  char machine[20];
57  int l = rz_buf_read_at(bf->buf, offset, (ut8 *)machine, sizeof(machine));
58  if (l < 0) {
59  free(res);
60  return false;
61  }
62  for (; i < MACHINES_MAX; i++) {
63  if (offset + strlen(_machines[i].name) > bf->size) {
64  free(res);
65  return false;
66  }
67  if (!strncmp(machine, _machines[i].name, strlen(_machines[i].name))) {
68  res->machine_idx = i;
69  break;
70  }
71  }
72  if (i >= MACHINES_MAX) {
73  eprintf("Unsupported machine type\n");
74  free(res);
75  return false;
76  }
77  // read all VSF modules
78  offset = sizeof(struct vsf_hdr);
79  ut64 sz = rz_buf_size(bf->buf);
80  while (offset < sz) {
81  struct vsf_module module;
82  int read = rz_buf_fread_at(bf->buf, offset, (ut8 *)&module, "16ccci", 1);
83  if (read != sizeof(module)) {
84  eprintf("Truncated Header\n");
85  free(res);
86  return false;
87  }
88 #define CMP_MODULE(x) memcmp(module.module_name, x, sizeof(x) - 1)
89  if (!CMP_MODULE(VICE_C64MEM) && !module.major) {
90  res->mem = offset + read;
91  } else if (!CMP_MODULE(VICE_C64ROM) && !module.major) {
92  res->rom = offset + read;
93  } else if (!CMP_MODULE(VICE_C128MEM) && !module.major) {
94  res->mem = offset + read;
95  } else if (!CMP_MODULE(VICE_C128ROM) && !module.major) {
96  res->rom = offset + read;
97  } else if (!CMP_MODULE(VICE_MAINCPU) && module.major == 1) {
98  res->maincpu = RZ_NEW(struct vsf_maincpu);
99  rz_buf_read_at(bf->buf, offset + read, (ut8 *)res->maincpu, sizeof(*res->maincpu));
100  }
101 #undef CMP_MODULE
102  offset += module.length;
103  if (module.length == 0) {
104  eprintf("Malformed VSF module with length 0\n");
105  break;
106  }
107  }
108  }
109  if (res) {
110  res->kv = sdb_new0();
111  sdb_ns_set(sdb, "info", res->kv);
112  }
113  obj->bin_obj = res;
114  return true;
115 }
116 
117 static RzList *mem(RzBinFile *bf) {
118  // FIXME: What does Mem do? Should I remove it ?
119  struct rz_bin_vsf_obj *vsf_obj = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
120  if (!vsf_obj) {
121  return NULL;
122  }
123  RzList *ret;
124  RzBinMem *m;
125  if (!(ret = rz_list_new())) {
126  return NULL;
127  }
128  ret->free = free;
129  if (!(m = RZ_NEW0(RzBinMem))) {
130  rz_list_free(ret);
131  return NULL;
132  }
133  m->name = strdup("RAM");
134  m->addr = 0; // start address
135  m->size = _machines[vsf_obj->machine_idx].ram_size;
136  m->perms = rz_str_rwx("rwx");
137  rz_list_append(ret, m);
138  return ret;
139 }
140 
141 static RzList *sections(RzBinFile *bf) {
142  struct rz_bin_vsf_obj *vsf_obj = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
143  if (!vsf_obj) {
144  return NULL;
145  }
146 
147  RzList *ret = NULL;
148  RzBinSection *ptr = NULL;
149  if (!(ret = rz_list_new())) {
150  return NULL;
151  }
152  const int m_idx = vsf_obj->machine_idx;
153  // Rizin doesn't support BANK switching.
154  // But by adding the ROM sections first, and then the RAM
155  // it kind of simulate bank switching since users can remove existing sections
156  // and the RAM section won't overwrite the ROM since it was added last.
157  if (vsf_obj->rom) {
158  if (!vsf_obj->machine_idx) {
159  // Commodore 64 ROMS
160  // BASIC (0xa000 - 0xbfff)
161  if (!(ptr = RZ_NEW0(RzBinSection))) {
162  return ret;
163  }
164  ptr->name = strdup("BASIC");
165  ptr->paddr = vsf_obj->rom + rz_offsetof(struct vsf_c64rom, basic);
166  ptr->size = 1024 * 8; // (8k)
167  ptr->vaddr = 0xa000;
168  ptr->vsize = 1024 * 8; // BASIC size (8k)
169  ptr->perm = RZ_PERM_RX;
170  rz_list_append(ret, ptr);
171 
172  // KERNAL (0xe000 - 0xffff)
173  if (!(ptr = RZ_NEW0(RzBinSection))) {
174  return ret;
175  }
176  ptr->name = strdup("KERNAL");
177  ptr->paddr = vsf_obj->rom + rz_offsetof(struct vsf_c64rom, kernal);
178  ptr->size = 1024 * 8; // (8k)
179  ptr->vaddr = 0xe000;
180  ptr->vsize = 1024 * 8; // KERNAL size (8k)
181  ptr->perm = RZ_PERM_RX;
182  rz_list_append(ret, ptr);
183 
184  // CHARGEN section ignored
185  } else {
186  // Commodore 128 ROMS
187  // BASIC (0x4000 - 0xafff)
188  if (!(ptr = RZ_NEW0(RzBinSection))) {
189  return ret;
190  }
191  ptr->name = strdup("BASIC");
192  ptr->paddr = vsf_obj->rom + rz_offsetof(struct vsf_c128rom, basic);
193  ptr->size = 1024 * 28; // (28k)
194  ptr->vaddr = 0x4000;
195  ptr->vsize = 1024 * 28; // BASIC size (28k)
196  ptr->perm = RZ_PERM_RX;
197  rz_list_append(ret, ptr);
198 
199  // MONITOR (0xb000 - 0xbfff)
200  if (!(ptr = RZ_NEW0(RzBinSection))) {
201  return ret;
202  }
203  ptr->name = strdup("MONITOR");
204  // skip first 28kb since "BASIC" and "MONITOR" share the same section in VSF
205  ptr->paddr = vsf_obj->rom + rz_offsetof(struct vsf_c128rom, basic) + 1024 * 28;
206  ptr->size = 1024 * 4; // (4k)
207  ptr->vaddr = 0xb000;
208  ptr->vsize = 1024 * 4; // BASIC size (4k)
209  ptr->perm = RZ_PERM_RX;
210  rz_list_append(ret, ptr);
211 
212  // EDITOR (0xc000 - 0xcfff)
213  if (!(ptr = RZ_NEW0(RzBinSection))) {
214  return ret;
215  }
216  ptr->name = strdup("EDITOR");
217  ptr->paddr = vsf_obj->rom + rz_offsetof(struct vsf_c128rom, editor);
218  ptr->size = 1024 * 4; // (4k)
219  ptr->vaddr = 0xc000;
220  ptr->vsize = 1024 * 4; // BASIC size (4k)
221  ptr->perm = RZ_PERM_RX;
222  rz_list_append(ret, ptr);
223 
224  // KERNAL (0xe000 - 0xffff)
225  if (!(ptr = RZ_NEW0(RzBinSection))) {
226  return ret;
227  }
228  ptr->name = strdup("KERNAL");
229  ptr->paddr = vsf_obj->rom + rz_offsetof(struct vsf_c128rom, kernal);
230  ptr->size = 1024 * 8; // (8k)
231  ptr->vaddr = 0xe000;
232  ptr->vsize = 1024 * 8; // KERNAL size (8k)
233  ptr->perm = RZ_PERM_RX;
234  rz_list_append(ret, ptr);
235 
236  // CHARGEN section ignored
237  }
238  }
239 
240  if (vsf_obj->mem) {
241  int offset = _machines[m_idx].offset_mem;
242  if (!vsf_obj->machine_idx) {
243  // RAM C64 (0x0000 - 0xffff)
244  int size = _machines[m_idx].ram_size;
245  if (!(ptr = RZ_NEW0(RzBinSection))) {
246  return ret;
247  }
248  ptr->name = strdup("RAM");
249  ptr->paddr = vsf_obj->mem + offset;
250  ptr->size = size;
251  ptr->vaddr = 0x0;
252  ptr->vsize = size;
253  ptr->perm = RZ_PERM_RWX;
254  rz_list_append(ret, ptr);
255  } else {
256  // RAM C128 (0x0000 - 0xffff): Bank 0
257  // RAM C128 (0x0000 - 0xffff): Bank 1
258 
259  // size of each bank: 64k
260  int size = 1024 * 64;
261  if (!(ptr = RZ_NEW0(RzBinSection))) {
262  return ret;
263  }
264  ptr->name = strdup("RAM BANK 0");
265  ptr->paddr = vsf_obj->mem + offset;
266  ptr->size = size;
267  ptr->vaddr = 0x0;
268  ptr->vsize = size;
269  ptr->perm = RZ_PERM_RWX;
270  rz_list_append(ret, ptr);
271 
272  if (!(ptr = RZ_NEW0(RzBinSection))) {
273  return ret;
274  }
275  ptr->name = strdup("RAM BANK 1");
276  ptr->paddr = vsf_obj->mem + offset + size;
277  ptr->size = size;
278  ptr->vaddr = 0x0;
279  ptr->vsize = size;
280  ptr->perm = RZ_PERM_RWX;
281  rz_list_append(ret, ptr);
282  }
283  }
284 
285  return ret;
286 }
287 
288 static RzBinInfo *info(RzBinFile *bf) {
289 
290  struct rz_bin_vsf_obj *vsf_obj = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
291  if (!vsf_obj) {
292  return NULL;
293  }
294 
295  const int m_idx = vsf_obj->machine_idx;
296 
297  RzBinInfo *ret = NULL;
298  struct vsf_hdr hdr;
299  memset(&hdr, 0, sizeof(hdr));
300  int read = rz_buf_read_at(bf->buf, 0, (ut8 *)&hdr, sizeof(hdr));
301  if (read != sizeof(hdr)) {
302  eprintf("Truncated Header\n");
303  return NULL;
304  }
305  if (!(ret = RZ_NEW0(RzBinInfo))) {
306  return NULL;
307  }
308  ret->file = strdup(bf->file);
309  ret->type = strdup("Snapshot");
310  ret->machine = strdup(_machines[m_idx].desc);
311  ret->os = strdup(_machines[m_idx].name);
312  ret->arch = strdup("6502");
313  ret->bits = 8;
314  ret->has_va = true;
315 
316  if (!vsf_obj->maincpu) {
317  // safe to return, sdb will not be populated
318  return ret;
319  }
320 
321  sdb_num_set(vsf_obj->kv, "vsf.reg_a", vsf_obj->maincpu->ac, 0);
322  sdb_num_set(vsf_obj->kv, "vsf.reg_x", vsf_obj->maincpu->xr, 0);
323  sdb_num_set(vsf_obj->kv, "vsf.reg_y", vsf_obj->maincpu->yr, 0);
324  sdb_num_set(vsf_obj->kv, "vsf.reg_sp", vsf_obj->maincpu->sp, 0);
325  sdb_num_set(vsf_obj->kv, "vsf.reg_pc", vsf_obj->maincpu->pc, 0);
326  sdb_num_set(vsf_obj->kv, "vsf.reg_st", vsf_obj->maincpu->st, 0);
327  sdb_num_set(vsf_obj->kv, "vsf.clock", vsf_obj->maincpu->clk, 0);
328 
329  return ret;
330 }
331 
332 static RzList *symbols(RzBinFile *bf) {
333 
334  static const struct {
335  const ut16 address;
336  const char *symbol_name;
337  } _symbols[] = {
338  // {0xfffa, "NMI_VECTOR_LSB"},
339  // {0xfffb, "NMI_VECTOR_MSB"},
340  // {0xfffe, "IRQ_VECTOR_LSB"},
341  // {0xffff, "IRQ_VECTOR_MSB"},
342 
343  // Defines taken from c64.inc from cc65
344  // I/O: VIC
345  { 0xd000, "VIC_SPR0_X" },
346  { 0xd001, "VIC_SPR0_Y" },
347  { 0xd002, "VIC_SPR1_X" },
348  { 0xd003, "VIC_SPR1_Y" },
349  { 0xd004, "VIC_SPR2_X" },
350  { 0xd005, "VIC_SPR2_Y" },
351  { 0xd006, "VIC_SPR3_X" },
352  { 0xd007, "VIC_SPR3_Y" },
353  { 0xd008, "VIC_SPR4_X" },
354  { 0xd009, "VIC_SPR4_Y" },
355  { 0xd00a, "VIC_SPR5_X" },
356  { 0xd00b, "VIC_SPR5_Y" },
357  { 0xd00c, "VIC_SPR6_X" },
358  { 0xd00d, "VIC_SPR6_Y" },
359  { 0xd00e, "VIC_SPR7_X" },
360  { 0xd00f, "VIC_SPR7_Y" },
361  { 0xd010, "VIC_SPR_HI_X" },
362  { 0xd015, "VIC_SPR_ENA" },
363  { 0xd017, "VIC_SPR_EXP_Y" },
364  { 0xd01d, "VIC_SPR_EXP_X" },
365  { 0xd01c, "VIC_SPR_MCOLOR" },
366  { 0xd01b, "VIC_SPR_BG_PRzIO" },
367 
368  { 0xd025, "VIC_SPR_MCOLOR0" },
369  { 0xd026, "VIC_SPR_MCOLOR1" },
370 
371  { 0xd027, "VIC_SPR0_COLOR" },
372  { 0xd028, "VIC_SPR1_COLOR" },
373  { 0xd029, "VIC_SPR2_COLOR" },
374  { 0xd02A, "VIC_SPR3_COLOR" },
375  { 0xd02B, "VIC_SPR4_COLOR" },
376  { 0xd02C, "VIC_SPR5_COLOR" },
377  { 0xd02D, "VIC_SPR6_COLOR" },
378  { 0xd02E, "VIC_SPR7_COLOR" },
379 
380  { 0xd011, "VIC_CTRL1" },
381  { 0xd016, "VIC_CTRL2" },
382 
383  { 0xd012, "VIC_HLINE" },
384 
385  { 0xd013, "VIC_LPEN_X" },
386  { 0xd014, "VIC_LPEN_Y" },
387 
388  { 0xd018, "VIC_VIDEO_ADR" },
389 
390  { 0xd019, "VIC_IRR" },
391  { 0xd01a, "VIC_IMR" },
392 
393  { 0xd020, "VIC_BORDERCOLOR" },
394  { 0xd021, "VIC_BG_COLOR0" },
395  { 0xd022, "VIC_BG_COLOR1" },
396  { 0xd023, "VIC_BG_COLOR2" },
397  { 0xd024, "VIC_BG_COLOR3" },
398 
399  // 128 stuff
400  { 0xd02F, "VIC_KBD_128" },
401  { 0xd030, "VIC_CLK_128" },
402 
403  // I/O: SID
404  { 0xD400, "SID_S1Lo" },
405  { 0xD401, "SID_S1Hi" },
406  { 0xD402, "SID_PB1Lo" },
407  { 0xD403, "SID_PB1Hi" },
408  { 0xD404, "SID_Ctl1" },
409  { 0xD405, "SID_AD1" },
410  { 0xD406, "SID_SUR1" },
411 
412  { 0xD407, "SID_S2Lo" },
413  { 0xD408, "SID_S2Hi" },
414  { 0xD409, "SID_PB2Lo" },
415  { 0xD40A, "SID_PB2Hi" },
416  { 0xD40B, "SID_Ctl2" },
417  { 0xD40C, "SID_AD2" },
418  { 0xD40D, "SID_SUR2" },
419 
420  { 0xD40E, "SID_S3Lo" },
421  { 0xD40F, "SID_S3Hi" },
422  { 0xD410, "SID_PB3Lo" },
423  { 0xD411, "SID_PB3Hi" },
424  { 0xD412, "SID_Ctl3" },
425  { 0xD413, "SID_AD3" },
426  { 0xD414, "SID_SUR3" },
427 
428  { 0xD415, "SID_FltLo" },
429  { 0xD416, "SID_FltHi" },
430  { 0xD417, "SID_FltCtl" },
431  { 0xD418, "SID_Amp" },
432  { 0xD419, "SID_ADConv1" },
433  { 0xD41A, "SID_ADConv2" },
434  { 0xD41B, "SID_Noise" },
435  { 0xD41C, "SID_Read3" },
436 
437  // I/O: VDC (128 only)
438  { 0xd600, "VDC_INDEX" },
439  { 0xd601, "VDC_DATA" },
440 
441  // I/O: CIAs
442  { 0xDC00, "CIA1_PRA" },
443  { 0xDC01, "CIA1_PRB" },
444  { 0xDC02, "CIA1_DDRA" },
445  { 0xDC03, "CIA1_DDRB" },
446  { 0xDC08, "CIA1_TOD10" },
447  { 0xDC09, "CIA1_TODSEC" },
448  { 0xDC0A, "CIA1_TODMIN" },
449  { 0xDC0B, "CIA1_TODHR" },
450  { 0xDC0D, "CIA1_ICR" },
451  { 0xDC0E, "CIA1_CRA" },
452  { 0xDC0F, "CIA1_CRB" },
453 
454  { 0xDD00, "CIA2_PRA" },
455  { 0xDD01, "CIA2_PRB" },
456  { 0xDD02, "CIA2_DDRA" },
457  { 0xDD03, "CIA2_DDRB" },
458  { 0xDD08, "CIA2_TOD10" },
459  { 0xDD09, "CIA2_TODSEC" },
460  { 0xDD0A, "CIA2_TODMIN" },
461  { 0xDD0B, "CIA2_TODHR" },
462  { 0xDD0D, "CIA2_ICR" },
463  { 0xDD0E, "CIA2_CRA" },
464  { 0xDD0F, "CIA2_CRB" },
465  };
466  static const int SYMBOLS_MAX = sizeof(_symbols) / sizeof(_symbols[0]);
467  struct rz_bin_vsf_obj *vsf_obj = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
468  if (!vsf_obj) {
469  return NULL;
470  }
471  const int m_idx = vsf_obj->machine_idx;
472  int offset = _machines[m_idx].offset_mem;
473  RzList *ret = NULL;
474  RzBinSymbol *ptr;
475  if (!(ret = rz_list_newf((RzListFree)rz_bin_symbol_free))) {
476  return NULL;
477  }
478 
479  int i;
480  for (i = 0; i < SYMBOLS_MAX; i++) {
481  if (!(ptr = RZ_NEW0(RzBinSymbol))) {
482  return ret;
483  }
484  if (!ptr->name) {
485  ptr->name = calloc(1, RZ_BIN_SIZEOF_STRINGS);
486  }
487  strncpy(ptr->name, _symbols[i].symbol_name, RZ_BIN_SIZEOF_STRINGS);
488  ptr->vaddr = _symbols[i].address;
489  ptr->size = 2;
490  ptr->paddr = vsf_obj->mem + offset + _symbols[i].address;
491  ptr->ordinal = i;
492  rz_list_append(ret, ptr);
493  }
494 
495  return ret;
496 }
497 
498 static void destroy(RzBinFile *bf) {
499  struct rz_bin_vsf_obj *obj = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
500  free(obj->maincpu);
501  free(obj);
502 }
503 
504 static RzList *entries(RzBinFile *bf) {
505  struct rz_bin_vsf_obj *vsf_obj = (struct rz_bin_vsf_obj *)bf->o->bin_obj;
506  if (!vsf_obj) {
507  return NULL;
508  }
509  const int m_idx = vsf_obj->machine_idx;
510 
511  RzList *ret;
512  RzBinAddr *ptr = NULL;
513  if (!(ret = rz_list_new())) {
514  return NULL;
515  }
516  int offset = _machines[m_idx].offset_mem;
517  // PC
518  if (!(ptr = RZ_NEW0(RzBinAddr))) {
519  return ret;
520  }
521  ptr->paddr = vsf_obj->mem + offset;
522  ptr->vaddr = vsf_obj->maincpu ? vsf_obj->maincpu->pc : 0;
523  rz_list_append(ret, ptr);
524 
525  // IRQ: 0xFFFE or 0x0314 ?
526  // if (!(ptr = RZ_NEW0 (RzBinAddr)))
527  // return ret;
528  // ptr->paddr = (vsf_obj->mem + offset) - (void*) bf->buf->buf;
529  // ptr->vaddr = 0x314; // or 0xfffe ?
530  // rz_list_append (ret, ptr);
531 
532  return ret;
533 }
534 
536  .name = "vsf",
537  .desc = "VICE Snapshot File",
538  .license = "LGPL3",
539  .get_sdb = &get_sdb,
540  .load_buffer = &load_buffer,
541  .check_buffer = &check_buffer,
542  .entries = &entries,
544  .sections = sections,
545  .symbols = &symbols,
546  .info = &info,
547  .destroy = &destroy,
548  .mem = &mem,
549 };
550 
551 #ifndef RZ_PLUGIN_INCORE
554  .data = &rz_bin_plugin_vsf,
556 };
557 #endif
lzma_index ** i
Definition: index.h:629
RZ_API void rz_bin_symbol_free(RzBinSymbol *sym)
Definition: bin.c:175
RZ_API RZ_OWN RzList * rz_bin_maps_of_file_sections(RZ_NONNULL RzBinFile *binfile)
Create a list of RzBinMap from RzBinSections queried from the given file.
Definition: bin.c:1040
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *b, Sdb *sdb)
Definition: bin_vsf.c:43
RzBinPlugin rz_bin_plugin_vsf
Definition: bin_vsf.c:535
static RzList * mem(RzBinFile *bf)
Definition: bin_vsf.c:117
static Sdb * get_sdb(RzBinFile *bf)
Definition: bin_vsf.c:28
static RzList * symbols(RzBinFile *bf)
Definition: bin_vsf.c:332
static const int MACHINES_MAX
Definition: bin_vsf.c:26
static const char VICE_C64MEM[]
Definition: bin_vsf.c:12
static const char VICE_MAGIC[]
Definition: bin_vsf.c:9
static const char VICE_MAINCPU[]
Definition: bin_vsf.c:11
static void destroy(RzBinFile *bf)
Definition: bin_vsf.c:498
const int ram_size
Definition: bin_vsf.c:21
const char * desc
Definition: bin_vsf.c:19
RZ_API RzLibStruct rizin_plugin
Definition: bin_vsf.c:552
const int offset_mem
Definition: bin_vsf.c:20
static const char VICE_C128MEM[]
Definition: bin_vsf.c:14
static bool check_buffer(RzBuffer *b)
Definition: bin_vsf.c:34
static const struct @207 _machines[]
const char * name
Definition: bin_vsf.c:18
static RzBinInfo * info(RzBinFile *bf)
Definition: bin_vsf.c:288
#define CMP_MODULE(x)
static const char VICE_C64ROM[]
Definition: bin_vsf.c:13
#define VICE_MAGIC_LEN
Definition: bin_vsf.c:10
static RzList * entries(RzBinFile *bf)
Definition: bin_vsf.c:504
static const char VICE_C128ROM[]
Definition: bin_vsf.c:15
static RzList * sections(RzBinFile *bf)
Definition: bin_vsf.c:141
#define RZ_API
#define NULL
Definition: cris-opc.c:27
uint16_t ut16
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
voidpf uLong offset
Definition: ioapi.h:144
uint8_t ut8
Definition: lh5801.h:11
return memset(p, 0, total)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
Definition: list.c:235
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
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 int sdb_ns_set(Sdb *s, const char *name, Sdb *r)
Definition: ns.c:156
RZ_API int sdb_num_set(Sdb *s, const char *key, ut64 v, ut32 cas)
Definition: num.c:25
#define eprintf(x, y...)
Definition: rlcc.c:7
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_BIN_SIZEOF_STRINGS
Definition: rz_bin.h:40
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
Definition: buf.c:1136
RZ_API st64 rz_buf_fread_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL ut8 *buf, RZ_NONNULL const char *fmt, int n)
...
Definition: buf.c:1001
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
Definition: buf.c:1225
@ RZ_LIB_TYPE_BIN
Definition: rz_lib.h:75
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
RZ_API int rz_str_rwx(const char *str)
Definition: str.c:318
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define RZ_NEW(x)
Definition: rz_types.h:285
#define RZ_PERM_RX
Definition: rz_types.h:97
#define RZ_PERM_RWX
Definition: rz_types.h:98
#define rz_offsetof(type, member)
Definition: rz_types.h:360
#define RZ_VERSION
Definition: rz_version.h:8
RZ_API Sdb * sdb_new0(void)
Definition: sdb.c:43
#define b(i)
Definition: sha256.c:42
Definition: malloc.c:26
Definition: sftypes.h:77
Definition: z80asm.h:102
ut64 vaddr
Definition: rz_bin.h:186
ut64 paddr
Definition: rz_bin.h:187
XX curplugin == o->plugin.
Definition: rz_bin.h:298
RzBinObject * o
Definition: rz_bin.h:305
char * file
Definition: rz_bin.h:299
RzBuffer * buf
Definition: rz_bin.h:303
int has_va
Definition: rz_bin.h:228
char * type
Definition: rz_bin.h:211
char * os
Definition: rz_bin.h:219
char * machine
Definition: rz_bin.h:216
char * file
Definition: rz_bin.h:210
char * arch
Definition: rz_bin.h:214
void * bin_obj
Definition: rz_bin.h:293
char * name
Definition: rz_bin.h:509
char * version
Definition: rz_bin.h:512
char * name
Definition: rz_bin.h:619
char * name
Definition: rz_bin.h:675
ut32 ordinal
Definition: rz_bin.h:692
struct vsf_maincpu * maincpu
Definition: vsf_specs.h:77
RzListFree free
Definition: rz_list.h:21
Definition: sdb.h:63
if(dbg->bits==RZ_SYS_BITS_64)
Definition: windows-arm64.h:4
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
int read(izstream &zs, T *x, Items items)
Definition: zstream.h:115