| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- I N T E R F A C E S . C H E R I . E X C E P T I O N S -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 2024-2025, AdaCore -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. -- |
| 17 |
-- -- |
| 18 |
-- As a special exception under Section 7 of GPL version 3, you are granted -- |
| 19 |
-- additional permissions described in the GCC Runtime Library Exception, -- |
| 20 |
-- version 3.1, as published by the Free Software Foundation. -- |
| 21 |
-- -- |
| 22 |
-- You should have received a copy of the GNU General Public License and -- |
| 23 |
-- a copy of the GCC Runtime Library Exception along with this program; -- |
| 24 |
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- |
| 25 |
-- <http://www.gnu.org/licenses/>. -- |
| 26 |
-- -- |
| 27 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 28 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 29 |
-- -- |
| 30 |
------------------------------------------------------------------------------ |
| 31 |
with Ada.Exceptions; |
| 32 |
|
| 33 |
-- This package defines exception types for CHERI-related errors |
| 34 |
|
| 35 |
package Interfaces.CHERI.Exceptions with |
| 36 |
Preelaborate |
| 37 |
is |
| 38 |
|
| 39 |
Capability_Bound_Error : exception; |
| 40 |
-- An out-of-bounds access was attempted |
| 41 |
|
| 42 |
Capability_Permission_Error : exception; |
| 43 |
-- An attempted access exceeded the permissions granted by a capability |
| 44 |
|
| 45 |
Capability_Sealed_Error : exception; |
| 46 |
-- A sealed capability was dereferenced |
| 47 |
|
| 48 |
Capability_Tag_Error : exception; |
| 49 |
-- An invalid capability was dereferenced |
| 50 |
|
| 51 |
private |
| 52 |
|
| 53 |
-- Expose C names for exception identifiers to allow raising from signal |
| 54 |
-- handlers in init.c. |
| 55 |
|
| 56 |
Capability_Bound_Error_Id : constant Ada.Exceptions.Exception_Id := |
| 57 |
Capability_Bound_Error'Identity; |
| 58 |
pragma Export (C, |
| 59 |
Capability_Bound_Error_Id, |
| 60 |
"capability_bound_error_id"); |
| 61 |
|
| 62 |
Capability_Permission_Error_Id : constant Ada.Exceptions.Exception_Id := |
| 63 |
Capability_Permission_Error'Identity; |
| 64 |
pragma Export (C, |
| 65 |
Capability_Permission_Error_Id, |
| 66 |
"capability_permission_error_id"); |
| 67 |
|
| 68 |
Capability_Sealed_Error_Id : constant Ada.Exceptions.Exception_Id := |
| 69 |
Capability_Sealed_Error'Identity; |
| 70 |
pragma Export (C, |
| 71 |
Capability_Sealed_Error_Id, |
| 72 |
"capability_sealed_error_id"); |
| 73 |
|
| 74 |
Capability_Tag_Error_Id : constant Ada.Exceptions.Exception_Id := |
| 75 |
Capability_Tag_Error'Identity; |
| 76 |
pragma Export (C, |
| 77 |
Capability_Tag_Error_Id, |
| 78 |
"capability_tag_error_id"); |
| 79 |
|
| 80 |
end Interfaces.CHERI.Exceptions; |