OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [lib/] [libcpu/] [m68k/] [m68040/] [fpsp/] [rtems_fpsp.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.