source: rtems/c/src/exec/score/cpu/hppa1.1/cpu.c @ cd3868cd

4.104.114.84.95
Last change on this file since cd3868cd was cd3868cd, checked in by Joel Sherrill <joel.sherrill@…>, on 08/15/96 at 21:09:02

updates from Tony Bennett (tbennett@…)

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2 *  HP PA-RISC Dependent Source
3 *
4 *  COPYRIGHT (c) 1994 by Division Incorporated
5 *
6 *  To anyone who acknowledges that this file is provided "AS IS"
7 *  without any express or implied warranty:
8 *      permission to use, copy, modify, and distribute this file
9 *      for any purpose is hereby granted without fee, provided that
10 *      the above copyright notice and this notice appears in all
11 *      copies, and that the name of Division Incorporated not be
12 *      used in advertising or publicity pertaining to distribution
13 *      of the software without specific, written prior permission.
14 *      Division Incorporated makes no representations about the
15 *      suitability of this software for any purpose.
16 *
17 *  $Id$
18 */
19
20#include <rtems/system.h>
21#include <rtems/score/isr.h>
22void hppa_cpu_halt(unsigned32 the_error);
23
24
25/*PAGE
26 *
27 *  _CPU_ISR_install_raw_handler
28 */
29 
30void _CPU_ISR_install_raw_handler(
31  unsigned32  vector,
32  proc_ptr    new_handler,
33  proc_ptr   *old_handler
34)
35{
36  /*
37   *  This is unsupported.  For HPPA this function is handled by BSP
38   */
39
40  _CPU_Fatal_halt( 0xdeaddead );
41}
42
43
44
45/*
46 * This is the default handler which is called if
47 * _CPU_ISR_install_vector() has not been called for the
48 * specified vector.  It simply forwards onto the spurious
49 * handler defined in the cpu-table.
50 */
51
52static ISR_Handler
53hppa_interrupt_report_spurious(ISR_Vector_number vector,
54                               void* rtems_isr_frame) /* HPPA extension */
55{
56
57    /*
58     * If the CPU table defines a spurious_handler, then
59     * call it.  If the handler returns halt.
60     */
61    if ( _CPU_Table.spurious_handler )
62        _CPU_Table.spurious_handler(vector, rtems_isr_frame);
63   
64    hppa_cpu_halt(vector);
65}
66
67
68/*PAGE
69 *
70 *  _CPU_ISR_Get_level
71 */
72 
73unsigned32 _CPU_ISR_Get_level(void)
74{
75    int level;
76    HPPA_ASM_SSM(0, level);     /* change no bits; just get copy */
77    if (level & HPPA_PSW_I)
78        return 0;
79    return 1;
80}
81
82/*PAGE
83 *
84 *  _CPU_ISR_install_vector
85 *
86 *  This kernel routine installs the RTEMS handler for the
87 *  specified vector.  The handler is a C callable routine.
88 *
89 *  Input parameters:
90 *    vector      - interrupt vector number
91 *    old_handler - former ISR for this vector number
92 *    new_handler - replacement ISR for this vector number
93 *
94 *  Output parameters:  NONE
95 *
96 */
97
98void _CPU_ISR_install_vector(
99  unsigned32  vector,
100  proc_ptr    new_handler,
101  proc_ptr   *old_handler
102)
103{
104    *old_handler = _ISR_Vector_table[vector];
105
106    _ISR_Vector_table[vector] = new_handler;
107}
108
109/*  _CPU_Initialize
110 *
111 *  This routine performs processor dependent initialization.
112 *
113 *  INPUT PARAMETERS:
114 *    cpu_table       - CPU table to initialize
115 *    thread_dispatch - address of disptaching routine
116 *
117 */
118
119void _CPU_Initialize(
120  rtems_cpu_table  *cpu_table,
121  void      (*thread_dispatch)      /* ignored on this CPU */
122)
123{
124    register unsigned8  *fp_context;
125    int i;
126    proc_ptr   old_handler;
127
128    /*
129     * This is the default fp context for all tasks
130     * Set it up so that denormalized results go to zero.
131     */
132
133    fp_context = (unsigned8*) &_CPU_Null_fp_context;
134    for (i=0 ; i<sizeof(Context_Control_fp); i++)
135        *fp_context++ = 0;
136    *((unsigned32 *) &_CPU_Null_fp_context) = HPPA_FPSTATUS_D;
137
138    /*
139     *  Save r27 into _CPU_Default_gr27 so it will hopefully be the correct
140     *  global data pointer for the entire system.
141     */
142
143    asm volatile( "stw   %%r27,%0" : "=m" (_CPU_Default_gr27): );
144
145    /*
146     * Init the 2nd level interrupt handlers
147     */
148
149    for (i=0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++)
150        _CPU_ISR_install_vector(i,
151                                hppa_interrupt_report_spurious,
152                                &old_handler);
153
154    _CPU_Table = *cpu_table;
155   
156}
157
158
159/*
160 * Halt the system.
161 * Called by the _CPU_Fatal_halt macro
162 *
163 * XXX
164 * Later on, this will allow us to return to the prom.
165 * For now, we just ignore 'type_of_halt'
166 *
167 * XXX
168 * NOTE: for gcc, this function must be at the bottom
169 * of the file, that is because if it is at the top
170 * of the file, gcc will inline it's calls.  Since
171 * the function uses the HPPA_ASM_LABEL() macro, when
172 * gcc inlines it, you get two definitions of the same
173 * label name, which is an assembly error.
174 */
175
176
177void
178hppa_cpu_halt(unsigned32 the_error)
179{
180    unsigned32 isrlevel;
181
182    _CPU_ISR_Disable(isrlevel);
183
184    /*
185     * XXXXX NOTE: This label is only needed that that when
186     * the simulator stops, it shows the label name specified
187     */
188    HPPA_ASM_LABEL("_hppa_cpu_halt");
189    HPPA_ASM_BREAK(0, 0);
190}
191
Note: See TracBrowser for help on using the repository browser.