Small ChangeLog tweak.
[official-gcc.git] / gcc / ada / a-interr.adb
blobf01ac1ae49da7c614ab185c1b59685227c3c1bfd
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- A D A . I N T E R R U P T S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1991-1994, Florida State University --
10 -- Copyright (C) 1995-2015, AdaCore --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
22 -- --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
27 -- --
28 -- GNARL was developed by the GNARL team at Florida State University. --
29 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
30 -- --
31 ------------------------------------------------------------------------------
33 with Ada.Unchecked_Conversion;
35 package body Ada.Interrupts is
37 package SI renames System.Interrupts;
39 function To_System is new Ada.Unchecked_Conversion
40 (Parameterless_Handler, SI.Parameterless_Handler);
42 function To_Ada is new Ada.Unchecked_Conversion
43 (SI.Parameterless_Handler, Parameterless_Handler);
45 --------------------
46 -- Attach_Handler --
47 --------------------
49 procedure Attach_Handler
50 (New_Handler : Parameterless_Handler;
51 Interrupt : Interrupt_ID)
53 begin
54 SI.Attach_Handler
55 (To_System (New_Handler), SI.Interrupt_ID (Interrupt), False);
56 end Attach_Handler;
58 ---------------------
59 -- Current_Handler --
60 ---------------------
62 function Current_Handler
63 (Interrupt : Interrupt_ID) return Parameterless_Handler
65 begin
66 return To_Ada (SI.Current_Handler (SI.Interrupt_ID (Interrupt)));
67 end Current_Handler;
69 --------------------
70 -- Detach_Handler --
71 --------------------
73 procedure Detach_Handler (Interrupt : Interrupt_ID) is
74 begin
75 SI.Detach_Handler (SI.Interrupt_ID (Interrupt), False);
76 end Detach_Handler;
78 ----------------------
79 -- Exchange_Handler --
80 ----------------------
82 procedure Exchange_Handler
83 (Old_Handler : out Parameterless_Handler;
84 New_Handler : Parameterless_Handler;
85 Interrupt : Interrupt_ID)
87 H : SI.Parameterless_Handler;
89 begin
90 SI.Exchange_Handler
91 (H, To_System (New_Handler),
92 SI.Interrupt_ID (Interrupt), False);
93 Old_Handler := To_Ada (H);
94 end Exchange_Handler;
96 -------------
97 -- Get_CPU --
98 -------------
100 function Get_CPU
101 (Interrupt : Interrupt_ID) return System.Multiprocessors.CPU_Range
103 pragma Unreferenced (Interrupt);
105 begin
106 -- The underlying operating system does not indicate the processor on
107 -- which the handler for Interrupt is executed.
109 return System.Multiprocessors.Not_A_Specific_CPU;
110 end Get_CPU;
112 -----------------
113 -- Is_Attached --
114 -----------------
116 function Is_Attached (Interrupt : Interrupt_ID) return Boolean is
117 begin
118 return SI.Is_Handler_Attached (SI.Interrupt_ID (Interrupt));
119 end Is_Attached;
121 -----------------
122 -- Is_Reserved --
123 -----------------
125 function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is
126 begin
127 return SI.Is_Reserved (SI.Interrupt_ID (Interrupt));
128 end Is_Reserved;
130 ---------------
131 -- Reference --
132 ---------------
134 function Reference (Interrupt : Interrupt_ID) return System.Address is
135 begin
136 return SI.Reference (SI.Interrupt_ID (Interrupt));
137 end Reference;
139 end Ada.Interrupts;