- if ((startsegment != endsegment) && !((endsegment == (startsegment + 1)) && endoffset == 0))
- {
- (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: Unimplemented support for transfers across unified memory segment boundaries\n");
- return (0);
- }
- if (!State.umem[startsegment])
- {
+ case 0x11: /* On-chip insn memory */
+ {
+ addr &= ((1 << IMEM_SIZE) - 1);
+ if ((addr + size) > (1 << IMEM_SIZE))
+ {
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: instruction address 0x%x is outside range 0-0x%x.\n",
+ addr + size - 1, (1 << IMEM_SIZE) - 1);
+ return (0);
+ }
+ memory = State.imem + addr;
+ }
+
+ case 0x12: /* Unified memory */
+ {
+ int startsegment, startoffset; /* Segment and offset within segment where xfer starts */
+ int endsegment, endoffset; /* Segment and offset within segment where xfer ends */
+
+ startsegment = addr >> UMEM_SIZE;
+ startoffset = addr & ((1 << UMEM_SIZE) - 1);
+ endsegment = (addr + size) >> UMEM_SIZE;
+ endoffset = (addr + size) & ((1 << UMEM_SIZE) - 1);
+
+ /* FIXME: We do not currently implement xfers across segments,
+ so detect this case and fail gracefully. */
+
+ if ((startsegment != endsegment) && !((endsegment == (startsegment + 1)) && endoffset == 0))
+ {
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: Unimplemented support for transfers across unified memory segment boundaries\n");
+ return (0);
+ }
+ if (!State.umem[startsegment])
+ {