File : s-bbcpsp-spe.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
   4 --                                                                          --
   5 --               S Y S T E M . B B . C P U _ S P E C I F I C                --
   6 --                                                                          --
   7 --                                  S p e c                                 --
   8 --                                                                          --
   9 --        Copyright (C) 1999-2002 Universidad Politecnica de Madrid         --
  10 --             Copyright (C) 2003-2004 The European Space Agency            --
  11 --                     Copyright (C) 2003-2015, AdaCore                     --
  12 --                                                                          --
  13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14 -- terms of the  GNU General Public License as published  by the Free Soft- --
  15 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 --                                                                          --
  23 --                                                                          --
  24 -- You should have received a copy of the GNU General Public License and    --
  25 -- a copy of the GCC Runtime Library Exception along with this program;     --
  26 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  27 -- <http://www.gnu.org/licenses/>.                                          --
  28 --                                                                          --
  29 -- GNAT was originally developed  by the GNAT team at  New York University. --
  30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  31 --                                                                          --
  32 ------------------------------------------------------------------------------
  33 
  34 --  This package contains the primitives which are dependent on the
  35 --  underlying processor.
  36 
  37 pragma Restrictions (No_Elaboration_Code);
  38 
  39 with System;
  40 with Interfaces;
  41 
  42 package System.BB.CPU_Specific is
  43    pragma Preelaborate;
  44 
  45    ------------------------
  46    -- Context management --
  47    ------------------------
  48 
  49    --  The context buffer is a type that represents thread's state and is not
  50    --  otherwise stored in main memory. This typically includes all user-
  51    --  visible registers, and possibly some other status as well.
  52 
  53    --  In case different contexts have different amounts of state (for example,
  54    --  due to absence of a floating-point unit in a particular configuration,
  55    --  or just the FPU not being used), it is expected that these details
  56    --  are handled in the implementation.
  57 
  58    type Context_Buffer is record
  59 
  60       --  Only callee-saved (ie dedicated and nonvolatile) registers need to
  61       --  be saved.
  62 
  63       R1h  : Interfaces.Unsigned_32;
  64       R1   : System.Address;
  65       R2   : Interfaces.Unsigned_64;
  66       R13  : Interfaces.Unsigned_64;
  67       R14h : Interfaces.Unsigned_32;
  68       R14  : System.Address;
  69       R15h : Interfaces.Unsigned_32;
  70       R15  : System.Address;
  71       R16 : Interfaces.Unsigned_64;
  72       R17 : Interfaces.Unsigned_64;
  73       R18 : Interfaces.Unsigned_64;
  74       R19 : Interfaces.Unsigned_64;
  75       R20 : Interfaces.Unsigned_64;
  76       R21 : Interfaces.Unsigned_64;
  77       R22 : Interfaces.Unsigned_64;
  78       R23 : Interfaces.Unsigned_64;
  79       R24 : Interfaces.Unsigned_64;
  80       R25 : Interfaces.Unsigned_64;
  81       R26 : Interfaces.Unsigned_64;
  82       R27 : Interfaces.Unsigned_64;
  83       R28 : Interfaces.Unsigned_64;
  84       R29 : Interfaces.Unsigned_64;
  85       R30 : Interfaces.Unsigned_64;
  86       R31 : Interfaces.Unsigned_64;
  87 
  88       CR  : System.Address;
  89       LR  : System.Address;
  90 
  91       SPEFPSCR : Interfaces.Unsigned_32;
  92    end record;
  93 
  94    Stack_Alignment : constant := 16;
  95    --  Stack alignment defined by the ABI
  96 
  97    --------------------
  98    -- Initialization --
  99    --------------------
 100 
 101    procedure Initialize_CPU;
 102    --  Initialize the CPU
 103 
 104    procedure Finish_Initialize_Context
 105      (Buffer : not null access Context_Buffer);
 106    --  Complete context initialization
 107 
 108    ---------------------------------
 109    -- Interrupt and Trap Handling --
 110    ---------------------------------
 111 
 112    type Vector_Id is range 0 .. 63;
 113    --  This corresponds to the IVOR number
 114 
 115    External_Interrupt_Excp : constant Vector_Id := 4;
 116    Decrementer_Excp : constant Vector_Id := 10;
 117    Floatting_Point_Data_Excp : constant Vector_Id := 33;
 118 
 119    procedure Install_Exception_Handler
 120      (Service_Routine : System.Address;
 121       Vector          : Vector_Id);
 122    --  Install a new handler in the exception table
 123 
 124    procedure Install_Error_Handlers;
 125    --  Called at system initialization time to install a CPU specific trap
 126    --  handler, GNAT_Error_Handler, that converts synchronous traps to
 127    --  appropriate exceptions.
 128 
 129    -------------
 130    -- Variant --
 131    -------------
 132 
 133    PowerPC_Book_E : constant Boolean := True;
 134    --  Does the CPU implement PowerPC Book-E standard
 135 
 136 end System.BB.CPU_Specific;