source: rtems/c/src/lib/libcpu/m68k/m68040/fpsp/rtems_fpsp.c @ f9b93da

4.104.114.84.95
Last change on this file since f9b93da was f9b93da, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 16, 1997 at 5:33:04 PM

Added the MC68040 Floating Point Support Package. This was ported
to RTEMS by Eric Norum. It is freely distributable and was acquired
from the Motorola WWW site. More info is in the FPSP README.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#include <rtems/system.h>
2/*
3#include <rtems/score/isr.h>
4*/
5
6/*
7 * User exception handlers
8 */
9proc_ptr M68040FPSPUserExceptionHandlers[9];
10
11/*
12 * Intercept requests to install an exception handler.
13 * FPSP exceptions get special treatment.
14 */
15static int
16FPSP_install_raw_handler (unsigned32 vector, proc_ptr new_handler, proc_ptr *old_handler)
17{
18  int fpspVector;
19
20  switch (vector) {
21  default:      return 0;       /* Non-FPSP vector */
22  case 11:      fpspVector = 0; break;  /* F-line */
23  case 48:      fpspVector = 1; break;  /* BSUN */
24  case 49:      fpspVector = 2; break;  /* INEXACT */
25  case 50:      fpspVector = 3; break;  /* DIVIDE-BY-ZERO */
26  case 51:      fpspVector = 4; break;  /* UNDERFLOW */
27  case 52:      fpspVector = 5; break;  /* OPERAND ERROR */
28  case 53:      fpspVector = 6; break;  /* OVERFLOW */
29  case 54:      fpspVector = 7; break;  /* SIGNALLING NAN */
30  case 55:      fpspVector = 8; break;  /* UNIMPLEMENTED DATA TYPE */
31  }
32  *old_handler = M68040FPSPUserExceptionHandlers[fpspVector];
33  M68040FPSPUserExceptionHandlers[fpspVector] = new_handler;
34  return 1;
35}
36
37/*
38 * Attach floating point exception vectors to M68040FPSP entry points
39 *
40 *  NOTE: Uses M68K rather than M68040 in the name so all CPUs having
41 *        an FPSP can share the same code in RTEMS proper.
42 */
43void
44M68KFPSPInstallExceptionHandlers (void)
45{
46  extern void _fpspEntry_fline();
47  extern void _fpspEntry_bsun();
48  extern void _fpspEntry_inex();
49  extern void _fpspEntry_dz();
50  extern void _fpspEntry_unfl();
51  extern void _fpspEntry_ovfl();
52  extern void _fpspEntry_operr();
53  extern void _fpspEntry_snan();
54  extern void _fpspEntry_unsupp();
55  static struct {
56    int  vector_number;
57    void  (*handler)();
58  } fpspHandlers[] = {
59    { 11,  _fpspEntry_fline },
60    { 48,  _fpspEntry_bsun },
61    { 49,  _fpspEntry_inex },
62    { 50,  _fpspEntry_dz },
63    { 51,  _fpspEntry_unfl },
64    { 52,  _fpspEntry_operr },
65    { 53,  _fpspEntry_ovfl },
66    { 54,  _fpspEntry_snan },
67    { 55,  _fpspEntry_unsupp },
68  };
69  int i;
70  proc_ptr oldHandler;
71
72  for (i = 0 ; i < sizeof fpspHandlers / sizeof fpspHandlers[0] ; i++) {
73    _CPU_ISR_install_raw_handler(fpspHandlers[i].vector_number, fpspHandlers[i].handler, &oldHandler);
74      M68040FPSPUserExceptionHandlers[i] = oldHandler;
75  }
76  _FPSP_install_raw_handler = FPSP_install_raw_handler;
77}
Note: See TracBrowser for help on using the repository browser.