static void cpuFrame2(UWO vector_offset, ULO pc)
{
  // save inst address
  cpuSetAReg(7, cpuGetAReg(7) - 4);
  memoryWriteLong(cpuGetOriginalPC(), cpuGetAReg(7));
  cpuFrame4Words(0x2000, vector_offset, pc);
}
Exemple #2
0
void cpuThrowException(ULO vector_offset, ULO pc, BOOLE executejmp)
{
  ULO vector_address;

#ifdef CPU_INSTRUCTION_LOGGING
  cpuCallExceptionLoggingFunc(cpuGetExceptionName(vector_offset), cpuGetOriginalPC(), cpuGetCurrentOpcode());
#endif

  cpuActivateSSP(); 
  cpuStackFrameGenerate((UWO) vector_offset, pc);

  // read a memory position
  vector_address = memoryReadLong(cpuGetVbr() + vector_offset);
  if (cpuGetModelMajor() < 2 && vector_address & 0x1 && vector_offset == 0xc)
  {
    // Avoid endless loop that will crash the emulator.
    // The (odd) address error exception vector contained an odd address.
    cpuCallResetExceptionFunc();
    cpuHardReset();
    cpuSetInstructionTime(132);
  }
  else
  {
    // set supervisor modus
    cpuSetSR(cpuGetSR() | 0x2000); 
    cpuSetSR(cpuGetSR() & 0x3fff);

    // restart cpu, if needed
    cpuSetStop(FALSE);

    cpuInitializeFromNewPC(vector_address);
    cpuSetInstructionTime(40);
  }

  // If the exception happened mid-instruction...
  if (executejmp)
  {
    cpuCallMidInstructionExceptionFunc(); // Supposed to be doing setjmp/longjmp back to machine emulator code
  }
}
Exemple #3
0
void cpuThrowFLineException(void)
{
  // The saved pc points to the f-line instruction
  cpuThrowException(0x2c, cpuGetOriginalPC(), FALSE);
}
Exemple #4
0
void cpuThrowIllegalInstructionException(BOOLE executejmp)
{
  // The saved pc points to the illegal instruction
  cpuThrowException(0x10, cpuGetOriginalPC(), executejmp);
}
Exemple #5
0
void cpuThrowPrivilegeViolationException(void)
{
  // The saved pc points to the instruction causing the violation
  // (And the kickstart excpects pc in the stack frame to be the opcode PC.)
  cpuThrowException(0x20, cpuGetOriginalPC(), FALSE);
}