From 231bba8d5c46680281fd3163acb33a961252d56a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 13 Sep 2017 10:28:52 +0000 Subject: [PATCH] s-vxwext__kernel-smp.adb, [...]: New file. * libgnarl/s-vxwext__kernel-smp.adb, libgnarl/s-tpopsp__vxworks-rtp.adb, libgnarl/s-vxwext__noints.adb: New file. From-SVN: r252075 --- gcc/ada/ChangeLog | 6 + gcc/ada/libgnarl/s-tpopsp__vxworks-rtp.adb | 80 +++++++++++++ gcc/ada/libgnarl/s-vxwext__kernel-smp.adb | 113 ++++++++++++++++++ gcc/ada/libgnarl/s-vxwext__noints.adb | 126 +++++++++++++++++++++ 4 files changed, 325 insertions(+) create mode 100644 gcc/ada/libgnarl/s-tpopsp__vxworks-rtp.adb create mode 100644 gcc/ada/libgnarl/s-vxwext__kernel-smp.adb create mode 100644 gcc/ada/libgnarl/s-vxwext__noints.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4f04cc0a138..d16939fe8f1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2017-09-13 Arnaud Charlet + + * libgnarl/s-vxwext__kernel-smp.adb, + libgnarl/s-tpopsp__vxworks-rtp.adb, libgnarl/s-vxwext__noints.adb: + New file. + 2017-09-13 Hristian Kirtchev * einfo.adb: Flag42 is now Is_Controlled_Active. diff --git a/gcc/ada/libgnarl/s-tpopsp__vxworks-rtp.adb b/gcc/ada/libgnarl/s-tpopsp__vxworks-rtp.adb new file mode 100644 index 00000000000..b49c0cf4cf6 --- /dev/null +++ b/gcc/ada/libgnarl/s-tpopsp__vxworks-rtp.adb @@ -0,0 +1,80 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- SYSTEM.TASK_PRIMITIVES.OPERATIONS.SPECIFIC -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is a VxWorks version of this package for RTPs where foreign threads +-- are recognized. The implementation is based on VxWorks tlsLib or oldTlsLib. + +separate (System.Task_Primitives.Operations) +package body Specific is + + ATCB_Key : int := 0; + -- Key used to find the Ada Task_Id associated with a thread + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize is + begin + ATCB_Key := tlsKeyCreate; + pragma Assert (ATCB_Key /= ERROR); + end Initialize; + + ------------------- + -- Is_Valid_Task -- + ------------------- + + function Is_Valid_Task return Boolean is + begin + return tlsValueGet (ATCB_Key) /= System.Null_Address; + end Is_Valid_Task; + + --------- + -- Set -- + --------- + + procedure Set (Self_Id : Task_Id) is + Result : STATUS; + begin + Result := tlsValueSet (ATCB_Key, To_Address (Self_Id)); + pragma Assert (Result /= ERROR); + end Set; + + ---------- + -- Self -- + ---------- + + function Self return Task_Id is + begin + return To_Task_Id (tlsValueGet (ATCB_Key)); + end Self; + +end Specific; diff --git a/gcc/ada/libgnarl/s-vxwext__kernel-smp.adb b/gcc/ada/libgnarl/s-vxwext__kernel-smp.adb new file mode 100644 index 00000000000..8ad39abd01a --- /dev/null +++ b/gcc/ada/libgnarl/s-vxwext__kernel-smp.adb @@ -0,0 +1,113 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . V X W O R K S . E X T -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2008-2017, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides vxworks specific support functions needed +-- by System.OS_Interface. + +-- This is the VxWorks 6 SMP kernel version of this package + +package body System.VxWorks.Ext is + + ERROR : constant := -1; + + -------------- + -- Int_Lock -- + -------------- + + function Int_Lock return int is + begin + return ERROR; + end Int_Lock; + + ---------------- + -- Int_Unlock -- + ---------------- + + function Int_Unlock (Old : int) return int is + pragma Unreferenced (Old); + begin + return ERROR; + end Int_Unlock; + + --------------- + -- semDelete -- + --------------- + + function semDelete (Sem : SEM_ID) return int is + function Os_Sem_Delete (Sem : SEM_ID) return int; + pragma Import (C, Os_Sem_Delete, "semDelete"); + begin + return Os_Sem_Delete (Sem); + end semDelete; + + ------------------------ + -- taskCpuAffinitySet -- + ------------------------ + + function taskCpuAffinitySet (tid : t_id; CPU : int) return int + is + function Set_Affinity (tid : t_id; CPU : int) return int; + pragma Import (C, Set_Affinity, "__gnat_set_affinity"); + begin + return Set_Affinity (tid, CPU); + end taskCpuAffinitySet; + + ------------------------- + -- taskMaskAffinitySet -- + ------------------------- + + function taskMaskAffinitySet (tid : t_id; CPU_Set : unsigned) return int is + function Set_Affinity (tid : t_id; CPU_Set : unsigned) return int; + pragma Import (C, Set_Affinity, "__gnat_set_affinity_mask"); + begin + return Set_Affinity (tid, CPU_Set); + end taskMaskAffinitySet; + + -------------- + -- taskCont -- + -------------- + + function Task_Cont (tid : t_id) return int is + function taskCont (tid : t_id) return int; + pragma Import (C, taskCont, "taskCont"); + begin + return taskCont (tid); + end Task_Cont; + + -------------- + -- taskStop -- + -------------- + + function Task_Stop (tid : t_id) return int is + function taskStop (tid : t_id) return int; + pragma Import (C, taskStop, "taskStop"); + begin + return taskStop (tid); + end Task_Stop; + +end System.VxWorks.Ext; diff --git a/gcc/ada/libgnarl/s-vxwext__noints.adb b/gcc/ada/libgnarl/s-vxwext__noints.adb new file mode 100644 index 00000000000..d20ecfb307d --- /dev/null +++ b/gcc/ada/libgnarl/s-vxwext__noints.adb @@ -0,0 +1,126 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . V X W O R K S . E X T -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2008-2017, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides vxworks specific support functions needed +-- by System.OS_Interface. + +-- This is a version for VxWorks 5 based systems with no interrupts: +-- HI-Ravenscar for VxWorks 5, VxWorks 653 vThreads (not ravenscar-cert) + +package body System.VxWorks.Ext is + + ERROR : constant := -1; + + -------------- + -- Int_Lock -- + -------------- + + function Int_Lock return int is + begin + return ERROR; + end Int_Lock; + + ---------------- + -- Int_Unlock -- + ---------------- + + function Int_Unlock (Old : int) return int is + pragma Unreferenced (Old); + begin + return ERROR; + end Int_Unlock; + + ----------------------- + -- Interrupt_Connect -- + ----------------------- + + function Interrupt_Connect + (Vector : Interrupt_Vector; + Handler : Interrupt_Handler; + Parameter : System.Address := System.Null_Address) return int + is + pragma Unreferenced (Vector, Handler, Parameter); + begin + return ERROR; + end Interrupt_Connect; + + ----------------------- + -- Interrupt_Context -- + ----------------------- + + function Interrupt_Context return int is + begin + -- For VxWorks 653 vThreads, never in an interrupt context + + return 0; + end Interrupt_Context; + + -------------------------------- + -- Interrupt_Number_To_Vector -- + -------------------------------- + + function Interrupt_Number_To_Vector + (intNum : int) return Interrupt_Vector + is + pragma Unreferenced (intNum); + begin + return 0; + end Interrupt_Number_To_Vector; + + --------------- + -- semDelete -- + --------------- + + function semDelete (Sem : SEM_ID) return int is + function Os_Sem_Delete (Sem : SEM_ID) return int; + pragma Import (C, Os_Sem_Delete, "semDelete"); + begin + return Os_Sem_Delete (Sem); + end semDelete; + + ------------------------ + -- taskCpuAffinitySet -- + ------------------------ + + function taskCpuAffinitySet (tid : t_id; CPU : int) return int is + pragma Unreferenced (tid, CPU); + begin + return ERROR; + end taskCpuAffinitySet; + + ------------------------- + -- taskMaskAffinitySet -- + ------------------------- + + function taskMaskAffinitySet (tid : t_id; CPU_Set : unsigned) return int is + pragma Unreferenced (tid, CPU_Set); + begin + return ERROR; + end taskMaskAffinitySet; + +end System.VxWorks.Ext; -- 2.30.2