Esempio n. 1
0
  // Verifies that the given index of the given segment is valid.
  private void checkSegmentIndex(MemorySegment segment, int segmentCode, int index)
      throws ProgramException {
    short loc = (short) (index + segment.getStartAddress());

    if (segmentCode == HVMInstructionSet.THIS_SEGMENT_CODE) {
      if (loc < Definitions.HEAP_START_ADDRESS || loc > Definitions.HEAP_END_ADDRESS)
        error("Out of segment space");
    } else {
      int[] range = segment.getEnabledRange();
      if (loc < range[0] || loc > range[1]) {
        error("Out of segment space");
      }
    }
  }