source: rtems/bsps/m68k/shared/fpsp/rtems_fpsp.c @ 3cf2bf63

Last change on this file since 3cf2bf63 was 3cf2bf63, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 26, 2018 at 10:17:06 AM

bsps/m68k: Move fpsp support to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 2.3 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 (uint32_t   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 *  Exception handlers provided by FPSP package.
39 */
40extern void _fpspEntry_fline(void);
41extern void _fpspEntry_bsun(void);
42extern void _fpspEntry_inex(void);
43extern void _fpspEntry_dz(void);
44extern void _fpspEntry_unfl(void);
45extern void _fpspEntry_ovfl(void);
46extern void _fpspEntry_operr(void);
47extern void _fpspEntry_snan(void);
48extern void _fpspEntry_unsupp(void);
49
50/*
51 * Attach floating point exception vectors to M68040FPSP entry points
52 *
53 *  NOTE: Uses M68K rather than M68040 in the name so all CPUs having
54 *        an FPSP can share the same code in RTEMS proper.
55 */
56void
57M68KFPSPInstallExceptionHandlers (void)
58{
59  static struct {
60    int  vector_number;
61    void  (*handler)(void);
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.