source: rtems/cpukit/score/cpu/m68k/cpu.c @ 8bdcfc4

4.104.114.84.95
Last change on this file since 8bdcfc4 was 5e9b32b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/26/95 at 19:27:15

posix support initially added

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 *  Motorola MC68xxx 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/score/isr.h>
17
18/*  _CPU_Initialize
19 *
20 *  This routine performs processor dependent initialization.
21 *
22 *  INPUT PARAMETERS:
23 *    cpu_table       - CPU table to initialize
24 *    thread_dispatch - entry pointer to thread dispatcher
25 *
26 *  OUTPUT PARAMETERS: NONE
27 */
28
29void _CPU_Initialize(
30  rtems_cpu_table  *cpu_table,
31  void      (*thread_dispatch)      /* ignored on this CPU */
32)
33{
34  _CPU_Table = *cpu_table;
35}
36
37/*PAGE
38 *
39 *  _CPU_ISR_Get_level
40 */
41 
42unsigned32 _CPU_ISR_Get_level( void )
43{
44  unsigned32 level;
45
46  m68k_get_interrupt_level( level );
47
48  return level;
49}
50
51/*PAGE
52 *
53 *  _CPU_ISR_install_raw_handler
54 */
55 
56void _CPU_ISR_install_raw_handler(
57  unsigned32  vector,
58  proc_ptr    new_handler,
59  proc_ptr   *old_handler
60)
61{
62  proc_ptr *interrupt_table = NULL;
63
64  m68k_get_vbr( interrupt_table );
65
66#if ( M68K_HAS_VBR == 1)
67  *old_handler = interrupt_table[ vector ];
68  interrupt_table[ vector ] = new_handler;
69#else
70  *old_handler = *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10);
71  *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10) = new_handler;
72#endif /* M68K_HAS_VBR */
73}
74
75/*PAGE
76 *
77 *  _CPU_ISR_install_vector
78 *
79 *  This kernel routine installs the RTEMS handler for the
80 *  specified vector.
81 *
82 *  Input parameters:
83 *    vector      - interrupt vector number
84 *    new_handler - replacement ISR for this vector number
85 *    old_handler - former ISR for this vector number
86 *
87 *  Output parameters:  NONE
88 */
89
90void _CPU_ISR_install_vector(
91  unsigned32  vector,
92  proc_ptr    new_handler,
93  proc_ptr   *old_handler
94)
95{
96  proc_ptr ignored;
97
98  *old_handler = _ISR_Vector_table[ vector ];
99
100  _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
101
102  _ISR_Vector_table[ vector ] = new_handler;
103}
104
105
106/*PAGE
107 *
108 *  _CPU_Install_interrupt_stack
109 */
110
111void _CPU_Install_interrupt_stack( void )
112{
113#if ( M68K_HAS_SEPARATE_STACKS == 1 )
114  void *isp = _CPU_Interrupt_stack_high;
115
116  asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) );
117#else
118#warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!"
119#endif
120}
121
122#if ( M68K_HAS_BFFFO != 1 )
123/*
124 * Returns table for duplication of the BFFFO instruction (16 bits only)
125 */
126const unsigned char __BFFFOtable[256] = {
127    8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
128    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
129    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
132    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
133    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
134    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
135    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
136    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
137    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
138    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
139    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
141    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
142    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
143};
144#endif
Note: See TracBrowser for help on using the repository browser.