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

4.104.114.84.9
Last change on this file since 8bc4430b was 8bc4430b, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 31, 2004 at 1:59:32 AM

2004-03-30 Ralf Corsepius <ralf_corsepius@…>

  • m68040/fpsp/rtems_fpsp.c, mcf5206/clock/ckinit.c, mcf5206/console/mcfuart.c, mcf5206/include/mcf5206e.h, mcf5206/include/mcfmbus.h, mcf5206/include/mcfuart.h, mcf5206/mbus/mcfmbus.c, mcf5206/timer/timer.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <rtems/system.h>
6/*
7#include <rtems/score/isr.h>
8*/
9
10/*
11 * User exception handlers
12 */
13proc_ptr M68040FPSPUserExceptionHandlers[9];
14
15/*
16 * Intercept requests to install an exception handler.
17 * FPSP exceptions get special treatment.
18 */
19static int
20FPSP_install_raw_handler (uint32_t   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 */
47void
48M68KFPSPInstallExceptionHandlers (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}
Note: See TracBrowser for help on using the repository browser.