with Ada.Task_Identification;
with Ada.Exceptions;
with System.Task_Primitives;
with System.Interrupt_Management;
with System.Interrupt_Management.Operations;
pragma Elaborate_All (System.Interrupt_Management.Operations);
with System.Task_Primitives.Operations;
with System.Task_Primitives.Interrupt_Operations;
with System.Storage_Elements;
with System.Tasking;
with System.Tasking.Utilities;
with System.Tasking.Rendezvous;
pragma Elaborate_All (System.Tasking.Rendezvous);
with System.Tasking.Initialization;
with System.Parameters;
with Unchecked_Conversion;
package body System.Interrupts is
use Parameters;
use Tasking;
use Ada.Exceptions;
package PRI renames System.Task_Primitives;
package POP renames System.Task_Primitives.Operations;
package PIO renames System.Task_Primitives.Interrupt_Operations;
package IMNG renames System.Interrupt_Management;
package IMOP renames System.Interrupt_Management.Operations;
function To_System is new Unchecked_Conversion
(Ada.Task_Identification.Task_Id, Task_ID);
task Interrupt_Manager is
entry Detach_Interrupt_Entries (T : Task_ID);
entry Initialize (Mask : IMNG.Interrupt_Mask);
entry Attach_Handler
(New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean;
Restoration : in Boolean := False);
entry Exchange_Handler
(Old_Handler : out Parameterless_Handler;
New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean);
entry Detach_Handler
(Interrupt : in Interrupt_ID;
Static : in Boolean);
entry Bind_Interrupt_To_Entry
(T : Task_ID;
E : Task_Entry_Index;
Interrupt : Interrupt_ID);
entry Block_Interrupt (Interrupt : Interrupt_ID);
entry Unblock_Interrupt (Interrupt : Interrupt_ID);
entry Ignore_Interrupt (Interrupt : Interrupt_ID);
entry Unignore_Interrupt (Interrupt : Interrupt_ID);
pragma Interrupt_Priority (System.Interrupt_Priority'Last);
end Interrupt_Manager;
task type Server_Task (Interrupt : Interrupt_ID) is
pragma Priority (System.Interrupt_Priority'Last);
end Server_Task;
type Server_Task_Access is access Server_Task;
type Entry_Assoc is record
T : Task_ID;
E : Task_Entry_Index;
end record;
type Handler_Assoc is record
H : Parameterless_Handler;
Static : Boolean; end record;
User_Handler : array (Interrupt_ID'Range) of Handler_Assoc :=
(others => (null, Static => False));
pragma Volatile_Components (User_Handler);
User_Entry : array (Interrupt_ID'Range) of Entry_Assoc :=
(others => (T => Null_Task, E => Null_Task_Entry));
pragma Volatile_Components (User_Entry);
Blocked : array (Interrupt_ID'Range) of Boolean := (others => False);
pragma Volatile_Components (Blocked);
Ignored : array (Interrupt_ID'Range) of Boolean := (others => False);
pragma Volatile_Components (Ignored);
Last_Unblocker :
array (Interrupt_ID'Range) of Task_ID := (others => Null_Task);
pragma Volatile_Components (Last_Unblocker);
Server_ID : array (Interrupt_ID'Range) of Task_ID :=
(others => Null_Task);
pragma Atomic_Components (Server_ID);
type Registered_Handler;
type R_Link is access all Registered_Handler;
type Registered_Handler is record
H : System.Address := System.Null_Address;
Next : R_Link := null;
end record;
Registered_Handler_Head : R_Link := null;
Registered_Handler_Tail : R_Link := null;
Access_Hold : Server_Task_Access;
function Is_Registered (Handler : Parameterless_Handler) return Boolean;
procedure Attach_Handler
(New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean := False)
is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Attach_Handler (New_Handler, Interrupt, Static);
end Attach_Handler;
procedure Bind_Interrupt_To_Entry
(T : Task_ID;
E : Task_Entry_Index;
Int_Ref : System.Address)
is
Interrupt : constant Interrupt_ID :=
Interrupt_ID (Storage_Elements.To_Integer (Int_Ref));
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Bind_Interrupt_To_Entry (T, E, Interrupt);
end Bind_Interrupt_To_Entry;
procedure Block_Interrupt (Interrupt : Interrupt_ID) is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Block_Interrupt (Interrupt);
end Block_Interrupt;
function Current_Handler
(Interrupt : Interrupt_ID)
return Parameterless_Handler
is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return User_Handler (Interrupt).H;
end Current_Handler;
procedure Detach_Handler
(Interrupt : in Interrupt_ID;
Static : in Boolean := False)
is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Detach_Handler (Interrupt, Static);
end Detach_Handler;
procedure Detach_Interrupt_Entries (T : Task_ID) is
begin
Interrupt_Manager.Detach_Interrupt_Entries (T);
end Detach_Interrupt_Entries;
procedure Exchange_Handler
(Old_Handler : out Parameterless_Handler;
New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean := False)
is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Exchange_Handler
(Old_Handler, New_Handler, Interrupt, Static);
end Exchange_Handler;
procedure Finalize (Object : in out Static_Interrupt_Protection) is
begin
if not Interrupt_Manager'Terminated then
for N in reverse Object.Previous_Handlers'Range loop
Interrupt_Manager.Attach_Handler
(New_Handler => Object.Previous_Handlers (N).Handler,
Interrupt => Object.Previous_Handlers (N).Interrupt,
Static => Object.Previous_Handlers (N).Static,
Restoration => True);
end loop;
end if;
Tasking.Protected_Objects.Entries.Finalize
(Tasking.Protected_Objects.Entries.Protection_Entries (Object));
end Finalize;
function Has_Interrupt_Or_Attach_Handler
(Object : access Dynamic_Interrupt_Protection) return Boolean is
begin
return True;
end Has_Interrupt_Or_Attach_Handler;
function Has_Interrupt_Or_Attach_Handler
(Object : access Static_Interrupt_Protection)
return Boolean
is
begin
return True;
end Has_Interrupt_Or_Attach_Handler;
procedure Ignore_Interrupt (Interrupt : Interrupt_ID) is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Ignore_Interrupt (Interrupt);
end Ignore_Interrupt;
procedure Install_Handlers
(Object : access Static_Interrupt_Protection;
New_Handlers : in New_Handler_Array)
is
begin
for N in New_Handlers'Range loop
Object.Previous_Handlers (N).Interrupt := New_Handlers (N).Interrupt;
Object.Previous_Handlers (N).Static := User_Handler
(New_Handlers (N).Interrupt).Static;
Exchange_Handler
(Old_Handler => Object.Previous_Handlers (N).Handler,
New_Handler => New_Handlers (N).Handler,
Interrupt => New_Handlers (N).Interrupt,
Static => True);
end loop;
end Install_Handlers;
function Is_Blocked (Interrupt : Interrupt_ID) return Boolean is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return Blocked (Interrupt);
end Is_Blocked;
function Is_Entry_Attached (Interrupt : Interrupt_ID) return Boolean is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return User_Entry (Interrupt).T /= Null_Task;
end Is_Entry_Attached;
function Is_Handler_Attached (Interrupt : Interrupt_ID) return Boolean is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return User_Handler (Interrupt).H /= null;
end Is_Handler_Attached;
function Is_Ignored (Interrupt : Interrupt_ID) return Boolean is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return Ignored (Interrupt);
end Is_Ignored;
function Is_Registered (Handler : Parameterless_Handler) return Boolean is
type Fat_Ptr is record
Object_Addr : System.Address;
Handler_Addr : System.Address;
end record;
function To_Fat_Ptr is new Unchecked_Conversion
(Parameterless_Handler, Fat_Ptr);
Ptr : R_Link;
Fat : Fat_Ptr;
begin
if Handler = null then
return True;
end if;
Fat := To_Fat_Ptr (Handler);
Ptr := Registered_Handler_Head;
while (Ptr /= null) loop
if Ptr.H = Fat.Handler_Addr then
return True;
end if;
Ptr := Ptr.Next;
end loop;
return False;
end Is_Registered;
function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is
begin
return IMNG.Reserve (IMNG.Interrupt_ID (Interrupt));
end Is_Reserved;
function Reference (Interrupt : Interrupt_ID) return System.Address is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return Storage_Elements.To_Address
(Storage_Elements.Integer_Address (Interrupt));
end Reference;
procedure Register_Interrupt_Handler (Handler_Addr : System.Address) is
New_Node_Ptr : R_Link;
begin
pragma Assert (Handler_Addr /= System.Null_Address);
New_Node_Ptr := new Registered_Handler;
New_Node_Ptr.H := Handler_Addr;
if Registered_Handler_Head = null then
Registered_Handler_Head := New_Node_Ptr;
Registered_Handler_Tail := New_Node_Ptr;
else
Registered_Handler_Tail.Next := New_Node_Ptr;
Registered_Handler_Tail := New_Node_Ptr;
end if;
end Register_Interrupt_Handler;
procedure Unblock_Interrupt (Interrupt : Interrupt_ID) is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Unblock_Interrupt (Interrupt);
end Unblock_Interrupt;
function Unblocked_By
(Interrupt : Interrupt_ID)
return System.Tasking.Task_ID
is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
return Last_Unblocker (Interrupt);
end Unblocked_By;
procedure Unignore_Interrupt (Interrupt : Interrupt_ID) is
begin
if Is_Reserved (Interrupt) then
Raise_Exception (Program_Error'Identity, "Interrupt" &
Interrupt_ID'Image (Interrupt) & " is reserved");
end if;
Interrupt_Manager.Unignore_Interrupt (Interrupt);
end Unignore_Interrupt;
task body Interrupt_Manager is
Intwait_Mask : aliased IMNG.Interrupt_Mask;
Ret_Interrupt : Interrupt_ID;
Old_Mask : aliased IMNG.Interrupt_Mask;
Self_ID : Task_ID := POP.Self;
Old_Handler : Parameterless_Handler;
procedure Bind_Handler (Interrupt : Interrupt_ID);
procedure Unbind_Handler (Interrupt : Interrupt_ID);
procedure Unprotected_Exchange_Handler
(Old_Handler : out Parameterless_Handler;
New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean;
Restoration : in Boolean := False);
procedure Unprotected_Detach_Handler
(Interrupt : in Interrupt_ID;
Static : in Boolean);
procedure Bind_Handler (Interrupt : Interrupt_ID) is
begin
if not Blocked (Interrupt) then
IMOP.Thread_Block_Interrupt (IMNG.Interrupt_ID (Interrupt));
POP.Wakeup (Server_ID (Interrupt), Interrupt_Server_Idle_Sleep);
end if;
end Bind_Handler;
procedure Unbind_Handler (Interrupt : Interrupt_ID) is
begin
if not Blocked (Interrupt) then
POP.Abort_Task (Server_ID (Interrupt));
Ret_Interrupt :=
Interrupt_ID (IMOP.Interrupt_Wait (Intwait_Mask'Access));
pragma Assert
(Ret_Interrupt = Interrupt_ID (IMNG.Abort_Task_Interrupt));
IMOP.Install_Default_Action (IMNG.Interrupt_ID (Interrupt));
IMOP.Thread_Unblock_Interrupt (IMNG.Interrupt_ID (Interrupt));
else
IMOP.Install_Default_Action (IMNG.Interrupt_ID (Interrupt));
end if;
end Unbind_Handler;
procedure Unprotected_Detach_Handler
(Interrupt : in Interrupt_ID;
Static : in Boolean)
is
Old_Handler : Parameterless_Handler;
begin
if User_Entry (Interrupt).T /= Null_Task then
Raise_Exception (Program_Error'Identity,
"An interrupt entry is already installed");
end if;
if not Static and then User_Handler (Interrupt).Static then
Raise_Exception (Program_Error'Identity,
"Trying to detach a static Interrupt Handler");
end if;
Ignored (Interrupt) := False;
Old_Handler := User_Handler (Interrupt).H;
User_Handler (Interrupt).H := null;
User_Handler (Interrupt).Static := False;
if Old_Handler /= null then
Unbind_Handler (Interrupt);
end if;
end Unprotected_Detach_Handler;
procedure Unprotected_Exchange_Handler
(Old_Handler : out Parameterless_Handler;
New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean;
Restoration : in Boolean := False) is
begin
if User_Entry (Interrupt).T /= Null_Task then
Raise_Exception (Program_Error'Identity,
"An interrupt is already installed");
end if;
if not Restoration and then not Static
and then (User_Handler (Interrupt).Static
or else not Is_Registered (New_Handler))
then
Raise_Exception (Program_Error'Identity,
"Trying to overwrite a static Interrupt Handler with a " &
"dynamic Handler");
end if;
Ignored (Interrupt) := False;
Old_Handler := User_Handler (Interrupt).H;
User_Handler (Interrupt).H := New_Handler;
if New_Handler = null then
User_Handler (Interrupt).Static := False;
else
User_Handler (Interrupt).Static := Static;
end if;
if Server_ID (Interrupt) = Null_Task then
IMOP.Set_Interrupt_Mask
(IMOP.All_Tasks_Mask'Access, Old_Mask'Access);
Access_Hold := new Server_Task (Interrupt);
IMOP.Set_Interrupt_Mask (Old_Mask'Access);
Server_ID (Interrupt) := To_System (Access_Hold.all'Identity);
end if;
if (New_Handler = null) then
if Old_Handler /= null then
Unbind_Handler (Interrupt);
end if;
return;
end if;
if Old_Handler = null then
Bind_Handler (Interrupt);
end if;
end Unprotected_Exchange_Handler;
begin
System.Tasking.Utilities.Make_Independent;
accept Initialize (Mask : IMNG.Interrupt_Mask) do
declare
The_Mask : aliased IMNG.Interrupt_Mask;
begin
IMOP.Copy_Interrupt_Mask (The_Mask, Mask);
IMOP.Set_Interrupt_Mask (The_Mask'Access);
end;
end Initialize;
IMOP.Empty_Interrupt_Mask (Intwait_Mask'Access);
IMOP.Add_To_Interrupt_Mask
(Intwait_Mask'Access, IMNG.Abort_Task_Interrupt);
IMOP.Thread_Block_Interrupt
(IMNG.Abort_Task_Interrupt);
loop
begin
select
accept Attach_Handler
(New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean;
Restoration : in Boolean := False)
do
Unprotected_Exchange_Handler
(Old_Handler, New_Handler, Interrupt, Static, Restoration);
end Attach_Handler;
or
accept Exchange_Handler
(Old_Handler : out Parameterless_Handler;
New_Handler : in Parameterless_Handler;
Interrupt : in Interrupt_ID;
Static : in Boolean)
do
Unprotected_Exchange_Handler
(Old_Handler, New_Handler, Interrupt, Static);
end Exchange_Handler;
or
accept Detach_Handler
(Interrupt : in Interrupt_ID;
Static : in Boolean)
do
Unprotected_Detach_Handler (Interrupt, Static);
end Detach_Handler;
or
accept Bind_Interrupt_To_Entry
(T : Task_ID;
E : Task_Entry_Index;
Interrupt : Interrupt_ID)
do
if User_Handler (Interrupt).H /= null
or else User_Entry (Interrupt).T /= Null_Task
then
Raise_Exception (Program_Error'Identity,
"A binding for this interrupt is already present");
end if;
Ignored (Interrupt) := False;
User_Entry (Interrupt) := Entry_Assoc' (T => T, E => E);
T.Interrupt_Entry := True;
if Server_ID (Interrupt) = Null_Task then
IMOP.Set_Interrupt_Mask
(IMOP.All_Tasks_Mask'Access, Old_Mask'Access);
Access_Hold := new Server_Task (Interrupt);
IMOP.Set_Interrupt_Mask (Old_Mask'Access);
Server_ID (Interrupt) :=
To_System (Access_Hold.all'Identity);
end if;
Bind_Handler (Interrupt);
end Bind_Interrupt_To_Entry;
or
accept Detach_Interrupt_Entries (T : Task_ID) do
for J in Interrupt_ID'Range loop
if not Is_Reserved (J) then
if User_Entry (J).T = T then
Ignored (J) := False;
User_Entry (J) := Entry_Assoc'
(T => Null_Task, E => Null_Task_Entry);
Unbind_Handler (J);
end if;
end if;
end loop;
T.Interrupt_Entry := False;
end Detach_Interrupt_Entries;
or
accept Block_Interrupt (Interrupt : Interrupt_ID) do
if Blocked (Interrupt) then
return;
end if;
Blocked (Interrupt) := True;
Last_Unblocker (Interrupt) := Null_Task;
IMOP.Thread_Block_Interrupt (IMNG.Interrupt_ID (Interrupt));
if User_Handler (Interrupt).H /= null
or else User_Entry (Interrupt).T /= Null_Task
then
POP.Abort_Task (Server_ID (Interrupt));
Ret_Interrupt := Interrupt_ID
(IMOP.Interrupt_Wait (Intwait_Mask'Access));
pragma Assert
(Ret_Interrupt =
Interrupt_ID (IMNG.Abort_Task_Interrupt));
end if;
end Block_Interrupt;
or
accept Unblock_Interrupt (Interrupt : Interrupt_ID) do
if not Blocked (Interrupt) then
return;
end if;
Blocked (Interrupt) := False;
Last_Unblocker (Interrupt) :=
To_System (Unblock_Interrupt'Caller);
if User_Handler (Interrupt).H = null
and then User_Entry (Interrupt).T = Null_Task
then
IMOP.Thread_Unblock_Interrupt
(IMNG.Interrupt_ID (Interrupt));
else
POP.Wakeup (Server_ID (Interrupt),
Interrupt_Server_Blocked_Interrupt_Sleep);
end if;
end Unblock_Interrupt;
or
accept Ignore_Interrupt (Interrupt : Interrupt_ID) do
if Ignored (Interrupt) then
return;
end if;
Ignored (Interrupt) := True;
if User_Handler (Interrupt).H /= null then
Unprotected_Detach_Handler
(Interrupt => Interrupt, Static => True);
elsif User_Entry (Interrupt).T /= Null_Task then
User_Entry (Interrupt) := Entry_Assoc'
(T => Null_Task, E => Null_Task_Entry);
Unbind_Handler (Interrupt);
end if;
IMOP.Install_Ignore_Action (IMNG.Interrupt_ID (Interrupt));
end Ignore_Interrupt;
or
accept Unignore_Interrupt (Interrupt : Interrupt_ID) do
Ignored (Interrupt) := False;
if User_Handler (Interrupt).H /= null then
Unprotected_Detach_Handler
(Interrupt => Interrupt, Static => True);
elsif User_Entry (Interrupt).T /= Null_Task then
User_Entry (Interrupt) := Entry_Assoc'
(T => Null_Task, E => Null_Task_Entry);
Unbind_Handler (Interrupt);
end if;
IMOP.Install_Default_Action (IMNG.Interrupt_ID (Interrupt));
end Unignore_Interrupt;
end select;
exception
when Program_Error =>
null;
when others =>
pragma Assert (False);
null;
end;
end loop;
end Interrupt_Manager;
task body Server_Task is
Intwait_Mask : aliased IMNG.Interrupt_Mask;
Ret_Interrupt : Interrupt_ID;
Self_ID : Task_ID := Self;
Tmp_Handler : Parameterless_Handler;
Tmp_ID : Task_ID;
Tmp_Entry_Index : Task_Entry_Index;
begin
System.Tasking.Utilities.Make_Independent;
IMOP.Install_Default_Action (IMNG.Interrupt_ID (Interrupt));
IMOP.Empty_Interrupt_Mask (Intwait_Mask'Access);
IMOP.Add_To_Interrupt_Mask
(Intwait_Mask'Access, IMNG.Interrupt_ID (Interrupt));
IMOP.Add_To_Interrupt_Mask
(Intwait_Mask'Access, IMNG.Abort_Task_Interrupt);
IMOP.Thread_Block_Interrupt
(IMNG.Abort_Task_Interrupt);
PIO.Set_Interrupt_ID (IMNG.Interrupt_ID (Interrupt), Self_ID);
loop
System.Tasking.Initialization.Defer_Abort (Self_ID);
if Single_Lock then
POP.Lock_RTS;
end if;
POP.Write_Lock (Self_ID);
if User_Handler (Interrupt).H = null
and then User_Entry (Interrupt).T = Null_Task
then
Self_ID.Common.State := Interrupt_Server_Blocked_Interrupt_Sleep;
POP.Sleep (Self_ID, Interrupt_Server_Idle_Sleep);
Self_ID.Common.State := Runnable;
elsif Blocked (Interrupt) then
Self_ID.Common.State := Interrupt_Server_Blocked_Interrupt_Sleep;
POP.Sleep (Self_ID, Interrupt_Server_Blocked_Interrupt_Sleep);
Self_ID.Common.State := Runnable;
else
POP.Unlock (Self_ID);
if Single_Lock then
POP.Unlock_RTS;
end if;
Ret_Interrupt :=
Interrupt_ID (IMOP.Interrupt_Wait (Intwait_Mask'Access));
if Ret_Interrupt = Interrupt_ID (IMNG.Abort_Task_Interrupt) then
POP.Abort_Task (Interrupt_Manager_ID);
if Single_Lock then
POP.Lock_RTS;
end if;
POP.Write_Lock (Self_ID);
else
pragma Assert (Ret_Interrupt = Interrupt);
if Single_Lock then
POP.Lock_RTS;
end if;
POP.Write_Lock (Self_ID);
if User_Handler (Interrupt).H /= null then
Tmp_Handler := User_Handler (Interrupt).H;
POP.Unlock (Self_ID);
if Single_Lock then
POP.Unlock_RTS;
end if;
Tmp_Handler.all;
if Single_Lock then
POP.Lock_RTS;
end if;
POP.Write_Lock (Self_ID);
elsif User_Entry (Interrupt).T /= Null_Task then
Tmp_ID := User_Entry (Interrupt).T;
Tmp_Entry_Index := User_Entry (Interrupt).E;
if Single_Lock then
POP.Unlock_RTS;
end if;
POP.Unlock (Self_ID);
System.Tasking.Rendezvous.Call_Simple
(Tmp_ID, Tmp_Entry_Index, System.Null_Address);
POP.Write_Lock (Self_ID);
if Single_Lock then
POP.Lock_RTS;
end if;
else
IMOP.Interrupt_Self_Process (IMNG.Interrupt_ID (Interrupt));
end if;
end if;
end if;
POP.Unlock (Self_ID);
if Single_Lock then
POP.Unlock_RTS;
end if;
System.Tasking.Initialization.Undefer_Abort (Self_ID);
end loop;
end Server_Task;
begin
Interrupt_Manager_ID := To_System (Interrupt_Manager'Identity);
Interrupt_Manager.Initialize (IMOP.Environment_Mask);
end System.Interrupts;