1401
1403
/* Allocate and clear the opcode-table. */
1402
1404
if (opc_table == NULL)
1404
opc_table = malloc (65536 * sizeof (opc_table[0]));
1405
if (opc_table == NULL)
1406
opc_table = qemu_malloc (65536 * sizeof (opc_table[0]));
1408
1408
memset (opc_table, 0, 65536 * sizeof (const struct cris_opcode *));
1411
= malloc (65536 * sizeof (const struct cris_opcode **));
1412
if (dip_prefixes == NULL)
1411
= qemu_malloc (65536 * sizeof (const struct cris_opcode **));
1415
1413
memset (dip_prefixes, 0, 65536 * sizeof (dip_prefixes[0]));
1417
1415
bdapq_m1_prefixes
1418
= malloc (65536 * sizeof (const struct cris_opcode **));
1419
if (bdapq_m1_prefixes == NULL)
1416
= qemu_malloc (65536 * sizeof (const struct cris_opcode **));
1422
1418
memset (bdapq_m1_prefixes, 0, 65536 * sizeof (bdapq_m1_prefixes[0]));
1424
1420
bdapq_m2_prefixes
1425
= malloc (65536 * sizeof (const struct cris_opcode **));
1426
if (bdapq_m2_prefixes == NULL)
1421
= qemu_malloc (65536 * sizeof (const struct cris_opcode **));
1429
1423
memset (bdapq_m2_prefixes, 0, 65536 * sizeof (bdapq_m2_prefixes[0]));
1431
1425
bdapq_m4_prefixes
1432
= malloc (65536 * sizeof (const struct cris_opcode **));
1433
if (bdapq_m4_prefixes == NULL)
1426
= qemu_malloc (65536 * sizeof (const struct cris_opcode **));
1436
1428
memset (bdapq_m4_prefixes, 0, 65536 * sizeof (bdapq_m4_prefixes[0]));
1439
= malloc (65536 * sizeof (const struct cris_opcode **));
1440
if (rest_prefixes == NULL)
1431
= qemu_malloc (65536 * sizeof (const struct cris_opcode **));
1443
1433
memset (rest_prefixes, 0, 65536 * sizeof (rest_prefixes[0]));
2625
2615
If we can't get any data, or we do not get enough data, we print
2626
2616
the error message. */
2628
for (nbytes = MAX_BYTES_PER_CRIS_INSN; nbytes > 0; nbytes -= 2)
2630
status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
2618
nbytes = info->buffer_length;
2619
if (nbytes > MAX_BYTES_PER_CRIS_INSN)
2620
nbytes = MAX_BYTES_PER_CRIS_INSN;
2621
status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
2635
2623
/* If we did not get all we asked for, then clear the rest.
2636
2624
Hopefully this makes a reproducible result in case of errors. */