Changeset 5624


Ignore:
Timestamp:
Dec 16, 2006, 4:25:59 AM (18 years ago)
Author:
Gary Byers
Message:

Handle (some) unimplemented instructions, notably fsqrt/fqrts, which
are optional and not implemented on some PPC machines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/ppc-exceptions.c

    r5622 r5624  
    11571157int
    11581158altivec_present = 1;
    1159                  
    1160 
     1159
     1160
     1161/* This only tries to implement the "optional" fsqrt and fsqrts
     1162   instructions, which were generally implemented on IBM hardware
     1163   but generally not available on Motorola/Freescale systems.
     1164*/               
     1165OSStatus
     1166handle_unimplemented_instruction(ExceptionInformation *xp,
     1167                                 opcode instruction,
     1168                                 TCR *tcr)
     1169{
     1170  (void) zero_fpscr(tcr);
     1171  enable_fp_exceptions();
     1172  /* the rc bit (bit 0 in the instruction) is supposed to cause
     1173     some FPSCR bits to be copied to CR1.  OpenMCL doesn't generate
     1174     fsqrt. or fsqrts.
     1175  */
     1176  if (((major_opcode_p(instruction,major_opcode_FPU_DOUBLE)) ||
     1177       (major_opcode_p(instruction,major_opcode_FPU_SINGLE))) &&
     1178      ((instruction & ((1 << 6) -2)) == (22<<1))) {
     1179      double b, d;
     1180
     1181      b = xpFPR(xp,RB_field(instruction));
     1182      d = sqrt(b);
     1183      xpFPSCR(xp) = ((xpFPSCR(xp) & ~_FPU_RESERVED) |
     1184                     (get_fpscr() & _FPU_RESERVED));
     1185      xpFPR(xp,RT_field(instruction)) = d;
     1186      adjust_exception_pc(xp,4);
     1187      return 0;
     1188  }
     1189
     1190  return -1;
     1191}
    11611192
    11621193OSStatus
     
    11921223    } else if (is_conditional_trap(instruction)) {
    11931224      status = handle_trap(xp, instruction, program_counter, info);
     1225    } else {
     1226      status = handle_unimplemented_instruction(xp,instruction,tcr);
    11941227    }
    11951228  } else if (xnum == SIGNAL_FOR_PROCESS_INTERRUPT) {
Note: See TracChangeset for help on using the changeset viewer.