1 | /* |
---|
2 | * Support for SuperH Simulator in GDB |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-2008. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #include <rtems/system.h> |
---|
15 | #include <rtems/score/cpu.h> |
---|
16 | #include <rtems/score/isr.h> |
---|
17 | #include <rtems/score/thread.h> |
---|
18 | #include <rtems/score/sh.h> |
---|
19 | |
---|
20 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
---|
21 | unsigned long *_old_stack_ptr; |
---|
22 | #endif |
---|
23 | |
---|
24 | register unsigned long *stack_ptr __asm__ ("r15"); |
---|
25 | |
---|
26 | /* |
---|
27 | * This routine provides the RTEMS interrupt management. |
---|
28 | */ |
---|
29 | |
---|
30 | void __ISR_Handler( uint32_t vector) |
---|
31 | { |
---|
32 | ISR_Level level; |
---|
33 | |
---|
34 | _ISR_Disable( level ); |
---|
35 | |
---|
36 | _Thread_Dispatch_disable_level++; |
---|
37 | |
---|
38 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
---|
39 | if ( _ISR_Nest_level == 0 ) |
---|
40 | { |
---|
41 | /* Install irq stack */ |
---|
42 | _old_stack_ptr = stack_ptr; |
---|
43 | stack_ptr = _CPU_Interrupt_stack_high; |
---|
44 | } |
---|
45 | |
---|
46 | #endif |
---|
47 | |
---|
48 | _ISR_Nest_level++; |
---|
49 | |
---|
50 | _ISR_Enable( level ); |
---|
51 | |
---|
52 | /* call isp */ |
---|
53 | if ( _ISR_Vector_table[ vector]) |
---|
54 | (*_ISR_Vector_table[ vector ])( vector ); |
---|
55 | |
---|
56 | _ISR_Disable( level ); |
---|
57 | |
---|
58 | _Thread_Dispatch_disable_level--; |
---|
59 | |
---|
60 | _ISR_Nest_level--; |
---|
61 | |
---|
62 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
---|
63 | |
---|
64 | if ( _ISR_Nest_level == 0 ) |
---|
65 | /* restore old stack pointer */ |
---|
66 | stack_ptr = _old_stack_ptr; |
---|
67 | #endif |
---|
68 | |
---|
69 | _ISR_Enable( level ); |
---|
70 | |
---|
71 | if ( _ISR_Nest_level ) |
---|
72 | return; |
---|
73 | |
---|
74 | if ( _Thread_Dispatch_disable_level ) { |
---|
75 | return; |
---|
76 | } |
---|
77 | |
---|
78 | if ( _Thread_Dispatch_necessary ) { |
---|
79 | _Thread_Dispatch(); |
---|
80 | } |
---|
81 | } |
---|