source: rtems/c/src/exec/score/cpu/m68k/cpu.c @ 5072b07

4.104.114.84.95
Last change on this file since 5072b07 was 637df35, checked in by Joel Sherrill <joel.sherrill@…>, on 07/12/95 at 19:47:25

Ada95, gnat, go32

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  Motorola MC68020 Dependent Source
3 *
4 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
5 *  On-Line Applications Research Corporation (OAR).
6 *  All rights assigned to U.S. Government, 1994.
7 *
8 *  This material may be reproduced by or for the U.S. Government pursuant
9 *  to the copyright license under the clause at DFARS 252.227-7013.  This
10 *  notice must appear in all copies of this file and its derivatives.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/fatal.h>
17#include <rtems/isr.h>
18
19/*  _CPU_Initialize
20 *
21 *  This routine performs processor dependent initialization.
22 *
23 *  INPUT PARAMETERS:
24 *    cpu_table       - CPU table to initialize
25 *    thread_dispatch - entry pointer to thread dispatcher
26 *
27 *  OUTPUT PARAMETERS: NONE
28 */
29
30void _CPU_Initialize(
31  rtems_cpu_table  *cpu_table,
32  void      (*thread_dispatch)      /* ignored on this CPU */
33)
34{
35
36  if ( cpu_table == NULL )
37    rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED );
38
39  _CPU_Table = *cpu_table;
40
41}
42
43/*PAGE
44 *
45 *  _CPU_ISR_install_raw_handler
46 */
47 
48void _CPU_ISR_install_raw_handler(
49  unsigned32  vector,
50  proc_ptr    new_handler,
51  proc_ptr   *old_handler
52)
53{
54  proc_ptr *interrupt_table = NULL;
55
56  m68k_get_vbr( interrupt_table );
57
58  *old_handler = interrupt_table[ vector ];
59
60  interrupt_table[ vector ] = new_handler;
61}
62
63/*PAGE
64 *
65 *  _CPU_ISR_install_vector
66 *
67 *  This kernel routine installs the RTEMS handler for the
68 *  specified vector.
69 *
70 *  Input parameters:
71 *    vector      - interrupt vector number
72 *    new_handler - replacement ISR for this vector number
73 *    old_handler - former ISR for this vector number
74 *
75 *  Output parameters:  NONE
76 */
77
78void _CPU_ISR_install_vector(
79  unsigned32  vector,
80  proc_ptr    new_handler,
81  proc_ptr   *old_handler
82)
83{
84  proc_ptr ignored;
85
86  *old_handler = _ISR_Vector_table[ vector ];
87
88  _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
89
90  _ISR_Vector_table[ vector ] = new_handler;
91}
92
93
94/*PAGE
95 *
96 *  _CPU_Install_interrupt_stack
97 */
98
99void _CPU_Install_interrupt_stack( void )
100{
101#if ( M68K_HAS_SEPARATE_STACKS == 1 )
102  void *isp = _CPU_Interrupt_stack_high;
103
104  asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) );
105#else
106#warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!"
107#endif
108}
109
110#if ( M68K_HAS_BFFFO != 1 )
111/*
112 * Returns log2(x)  0<x<256
113 */
114const unsigned char __log2table[256] = {
115    0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
116    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
117    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
118    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
119    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
120    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
121    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
122    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
123    7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
124    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
125    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
126    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
127    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
128    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
129    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
130    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
131};
132#endif
Note: See TracBrowser for help on using the repository browser.