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

4.104.114.84.9
Last change on this file since 6ba9c27 was 6ba9c27, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 27, 2002 at 9:21:45 PM

2002-06-27 Joel Sherrill <joel@…>

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