diff options
Diffstat (limited to 'gcc/ada/libgnarl')
-rw-r--r-- | gcc/ada/libgnarl/s-taskin.ads | 2 | ||||
-rw-r--r-- | gcc/ada/libgnarl/s-tassta.adb | 18 | ||||
-rw-r--r-- | gcc/ada/libgnarl/s-tsgsba.adb | 40 | ||||
-rw-r--r-- | gcc/ada/libgnarl/s-tsgsba__cheri.adb | 49 |
4 files changed, 106 insertions, 3 deletions
diff --git a/gcc/ada/libgnarl/s-taskin.ads b/gcc/ada/libgnarl/s-taskin.ads index d68e199..dbf2e7b 100644 --- a/gcc/ada/libgnarl/s-taskin.ads +++ b/gcc/ada/libgnarl/s-taskin.ads @@ -390,7 +390,7 @@ package System.Tasking is System_Domain : Dispatching_Domain_Access; -- All processors belong to default system dispatching domain at start up. -- We use a pointer which creates the actual variable for the reasons - -- explained bellow in Dispatching_Domain_Tasks. + -- explained below in Dispatching_Domain_Tasks. Dispatching_Domains_Frozen : Boolean := False; -- True when the main procedure has been called. Hence, no new dispatching diff --git a/gcc/ada/libgnarl/s-tassta.adb b/gcc/ada/libgnarl/s-tassta.adb index b1eb842..98ee15b 100644 --- a/gcc/ada/libgnarl/s-tassta.adb +++ b/gcc/ada/libgnarl/s-tassta.adb @@ -133,6 +133,11 @@ package body System.Tasking.Stages is -- Different code is used at master completion, in Terminate_Dependents, -- due to a need for tighter synchronization with the master. + function Get_Stack_Base (Self_ID : Task_Id) return System.Address; + -- Get the stack base of Self. + -- + -- If the stack base cannot be determined, then Null_Address is returned. + ---------------------- -- Abort_Dependents -- ---------------------- @@ -1113,7 +1118,7 @@ package body System.Tasking.Stages is -- Address of the base of the stack begin - Stack_Base := Self_ID.Common.Compiler_Data.Pri_Stack_Info.Base; + Stack_Base := Get_Stack_Base (Self_ID); if Stack_Base = Null_Address then @@ -1139,7 +1144,7 @@ package body System.Tasking.Stages is (Self_ID.Common.Analyzer, Self_ID.Common.Task_Image (1 .. Self_ID.Common.Task_Image_Len), Natural (Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size), - SSE.To_Integer (Stack_Base), + Stack_Base, Pattern_Size); STPO.Unlock_RTS; Fill_Stack (Self_ID.Common.Analyzer); @@ -1966,6 +1971,15 @@ package body System.Tasking.Stages is System.Task_Primitives.Operations.Finalize_TCB (T); end Vulnerable_Free_Task; + -------------------- + -- Get_Stack_Base -- + -------------------- + + -- Get_Stack_Base is architecture-specific + + function Get_Stack_Base (Self_ID : Task_Id) return System.Address + is separate; + -- Package elaboration code begin diff --git a/gcc/ada/libgnarl/s-tsgsba.adb b/gcc/ada/libgnarl/s-tsgsba.adb new file mode 100644 index 0000000..450513d --- /dev/null +++ b/gcc/ada/libgnarl/s-tsgsba.adb @@ -0,0 +1,40 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . T A S K I N G . S T A G E S . G E T _ S T A C K _ B A S E -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- +-- -- +-- GNARL 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 -- +-- <http://www.gnu.org/licenses/>. -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the default version for most platforms which tries to get the +-- stack base from the compiler info. It returns Null_Address if the stack +-- base is not available. + +separate (System.Tasking.Stages) +function Get_Stack_Base (Self_ID : Task_Id) return System.Address is +begin + return Self_ID.Common.Compiler_Data.Pri_Stack_Info.Base; +end Get_Stack_Base; diff --git a/gcc/ada/libgnarl/s-tsgsba__cheri.adb b/gcc/ada/libgnarl/s-tsgsba__cheri.adb new file mode 100644 index 0000000..5c17836 --- /dev/null +++ b/gcc/ada/libgnarl/s-tsgsba__cheri.adb @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . T A S K I N G . S T A G E S . G E T _ S T A C K _ B A S E -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- +-- -- +-- GNARL 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 -- +-- <http://www.gnu.org/licenses/>. -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ +with Interfaces.CHERI; + +-- This is the version for CHERI targets where we can derive the stack base +-- from the upper bound of the capability stack pointer (CSP). + +separate (System.Tasking.Stages) +function Get_Stack_Base (Self_ID : Task_Id) return System.Address is + pragma Unreferenced (Self_ID); + + use type SSE.Integer_Address; + + CSP : constant System.Address := Interfaces.CHERI.Get_CSP; +begin + return Interfaces.CHERI.Capability_With_Address + (Cap => CSP, + Addr => Interfaces.CHERI.Get_Base (CSP) + + SSE.Integer_Address + (Interfaces.CHERI.Get_Length (CSP))); +end Get_Stack_Base; |